CFont::CreateFontIndirect

Syntax

BOOL CreateFontIndirect( LPLOGFONT lpLogFont );

Parameters

lpLogFont

Points to a LOGFONT structure that defines the characteristics of the logical font.

The LOGFONT structure has the following form:

typedef struct tagLOGFONT {

int lfHeight;

int lfWidth;

int lfEscapement;

int lfOrientation;

int lfWeight;

BYTE lfItalic;

BYTE lfUnderline;

BYTE lfStrikeOut;

BYTE lfCharSet;

BYTE lfOutPrecision;

BYTE lfClipPrecision;

BYTE lfQuality;

BYTE lfPitchAndFamily;

BYTE lfFaceName[LF_FACESIZE];

} LOGFONT;

Remarks

Initializes a CFont object with the characteristics given in a LOGFONT structure pointed to by lpLogFont. The font can subsequently be selected as the current font for any device.

This font has the characteristics specified in the LOGFONT structure. When the font is selected by using the CDC::SelectObject or CMetaFileDC::SelectObject functions, GDI's font mapper attempts to match the logical font with an existing physical font. If it fails to find an exact match for the logical font, it provides an alternative whose characteristics match as many of the requested characteristics as possible.

Return Value

TRUE if successful; otherwise FALSE.

See Also

CFont::CreateFont, CDC::SelectObject, CMetaFileDC::SelectObject, ::CreateFontIndirect