CHARFORMAT to LOGFONT

Thought someone might require this conversion. CharformatToLogfont(CHARFORMAT & cf, LOGFONT & lf, COLORREF & cr) {   lf.lfCharSet = cf.bCharSet; lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; lf.lfEscapement = 0; lf.lfOrientation = 0; lf.lfOutPrecision = OUT_DEFAULT_PRECIS; lf.lfQuality = DEFAULT_QUALITY; lf.lfPitchAndFamily = DEFAULT_PITCH;     if ( (cf.dwEffects & CFE_BOLD) == CFE_BOLD) { lf.lfWeight = FW_BOLD; }   CDC dc;…

Read More

LOGFONT to CHARFORMAT

Thought someone might require this conversion.   LogfontToCharformat(LOGFONT & lf, COLORREF & cr, CHARFORMAT & cf) {   cf.cbSize = sizeof(CHARFORMAT); cf.dwMask = CFM_COLOR | CFM_FACE | CFM_SIZE | CFM_CHARSET | CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_OFFSET; cf.dwEffects = 0;   if (lf.lfWeight >= FW_BOLD) { cf.dwEffects |= CFE_BOLD; }   if…

Read More