MCPcopy Create free account
hub / github.com/cinience/RedisStudio / SetFont

Method SetFont

DuiLib/Control/UIRichEdit.cpp:756–780  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754}
755
756void CTxtWinHost::SetFont(HFONT hFont)
757{
758 if( hFont == NULL ) return;
759 LOGFONT lf;
760 ::GetObject(hFont, sizeof(LOGFONT), &lf);
761 LONG yPixPerInch = ::GetDeviceCaps(m_re->GetManager()->GetPaintDC(), LOGPIXELSY);
762 cf.yHeight = -lf.lfHeight * LY_PER_INCH / yPixPerInch;
763 if(lf.lfWeight >= FW_BOLD)
764 cf.dwEffects |= CFE_BOLD;
765 if(lf.lfItalic)
766 cf.dwEffects |= CFE_ITALIC;
767 if(lf.lfUnderline)
768 cf.dwEffects |= CFE_UNDERLINE;
769 cf.bCharSet = lf.lfCharSet;
770 cf.bPitchAndFamily = lf.lfPitchAndFamily;
771#ifdef _UNICODE
772 _tcscpy(cf.szFaceName, lf.lfFaceName);
773#else
774 //need to thunk pcf->szFaceName to a standard char string.in this case it's easy because our thunk is also our copy
775 MultiByteToWideChar(CP_ACP, 0, lf.lfFaceName, LF_FACESIZE, cf.szFaceName, LF_FACESIZE) ;
776#endif
777
778 pserv->OnTxPropertyBitsChange(TXTBIT_CHARFORMATCHANGE,
779 TXTBIT_CHARFORMATCHANGE);
780}
781
782void CTxtWinHost::SetColor(DWORD dwColor)
783{

Callers

nothing calls this directly

Calls 3

GetPaintDCMethod · 0.80
GetManagerMethod · 0.80
GetFontMethod · 0.45

Tested by

no test coverage detected