// Initialize a CFontDescription object with the attributes that // make a font unique. BOOL CTextStyle::GetFontDescription(CFontDescription* pFontDescription) { BOOL fResult = FALSE; // Get the typeface number. int nTypeface = ((PMGFontServer*)(Database()->get_font_server()))->font_record_to_face(Font()); if (nTypeface != -1) { // Compute the style (bold, italic) of the typeface. int nFontStyle = 0; if (Bold()) { nFontStyle |= FONT_STYLE_Bold; } if (Italic()) { nFontStyle |= FONT_STYLE_Italic; } // Initialize the font description. pFontDescription->m_nTypeface = typeface_for_fstyle(nTypeface, (FONT_STYLE)nFontStyle); pFontDescription->m_lPointSize = Size(); pFontDescription->m_lHorizontalExpansion = Expansion(); pFontDescription->m_Fill = Fill(); pFontDescription->m_Outline = Outline(); pFontDescription->m_Shadow = Shadow(); fResult = TRUE; } return fResult; }
// // Initializing text display values. // void CTextDisplay::SetAll(CString * show_text, char *font_name, LONG font_size, TextAlignment alignment, BOOL bold, BOOL italic, BOOL underline, COLORREF color) { // Update all settings for the displayed text, but do not update the // window until everything has been updated. SetText(show_text, FALSE); SetFontType(font_name, FALSE); SetFontSize(font_size, FALSE); SetTextAlignment(alignment, FALSE); Bold(bold, FALSE); Italic(italic, FALSE); Underline(underline, FALSE); SetTextColor(color, FALSE); // Update the display. RedrawWindow(); }