CMFCFontInfo Class
The CMFCFontInfo class describes the name and other attributes of a font.
class CMFCFontInfo : public CObject
Members
Public Constructors
Name |
Description |
---|---|
CMFCFontInfo |
Constructs a CMFCFontInfo object. |
Public Methods
Name |
Description |
---|---|
Retrieves the concatenated names of a font and its character set (script). |
Data Members
Name |
Description |
---|---|
A value that specifies the character set (script) associated with the font. |
|
A value that specifies the pitch and family of the font. |
|
A value that specifies the type of the font. |
|
The name of the font; for example, Arial. |
|
The name of a character set (script) associated with the font. |
Remarks
You can attach a CMFCFontInfo object to an item of the CMFCToolBarFontComboBox Class class. Call the CMFCToolBarFontComboBox::GetFontDesc method to retrieve a pointer to a CMFCFontInfo object.
Example
The following example demonstrates how to use various members of the CMFCFontInfo class. The example demonstrates how to get a CMFCFontInfo object from a CMFCRibbonFontComboBox, and how to access its local variables. This example is part of the MSOffice 2007 Demo sample.
CMFCRibbonFontComboBox* pFontCombo = DYNAMIC_DOWNCAST(CMFCRibbonFontComboBox, pRibbon->FindByID(ID_FONT_FONT));
if (pFontCombo == NULL)
{
return;
}
CCharFormat cf;
cf.szFaceName[0] = NULL;
cf.dwMask = CFM_FACE | CFM_CHARSET;
const CMFCFontInfo* pDesc = pFontCombo->GetFontDesc();
ASSERT_VALID(pDesc);
ASSERT(pDesc->m_strName.GetLength() < LF_FACESIZE);
#if _MSC_VER >= 1300
lstrcpyn(cf.szFaceName, pDesc->m_strName, LF_FACESIZE);
#else
lstrcpynA(cf.szFaceName, T2A((LPTSTR)(LPCTSTR) pDesc->m_strName), LF_FACESIZE);
#endif
cf.bCharSet = pDesc->m_nCharSet;
cf.bPitchAndFamily = pDesc->m_nPitchAndFamily;
Requirements
Header: afxtoolbarfontcombobox.h
See Also
Concepts
Reference
CMFCToolBarFontSizeComboBox Class