Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CFont Class

Encapsulates a Windows graphics device interface (GDI) font and provides member functions for manipulating the font.

class CFont : public CGdiObject

Name

Description

CFont::CFont

Constructs a CFont object.

Name

Description

CFont::CreateFont

Initializes a CFont with the specified characteristics.

CFont::CreateFontIndirect

Initializes a CFont object with the characteristics given in a LOGFONT structure.

CFont::CreatePointFont

Initializes a CFont with the specified height, measured in tenths of a point, and typeface.

CFont::CreatePointFontIndirect

Same as CreateFontIndirect except that the font height is measured in tenths of a point rather than logical units.

CFont::FromHandle

Returns a pointer to a CFont object when given a Windows HFONT.

CFont::GetLogFont

Fills a LOGFONT with information about the logical font attached to the CFont object.

Name

Description

CFont::operator HFONT

Returns the Windows GDI font handle attached to the CFont object.

To use a CFont object, construct a CFont object and attach a Windows font to it with CreateFont, CreateFontIndirect, CreatePointFont, or CreatePointFontIndirect, and then use the object's member functions to manipulate the font.

The CreatePointFont and CreatePointFontIndirect functions are often easier to use than CreateFont or CreateFontIndirect since they do the conversion for the height of the font from a point size to logical units automatically.

For more information on CFont, see Graphic Objects.

Header: afxwin.h

Show:
© 2014 Microsoft. All rights reserved.