CreateFontIndirect

Syntax

HFONT CreateFontIndirect(lpLogFont)

This function creates a logical font that has the characteristics given in the data structure pointed to by the lpLogFont parameter. The font can subsequently be selected as the current font for any device.

Parameter Type/Description  
lpLogFont LOGFONT FAR * Points to a LOGFONT data structure that defines the characteristics of the logical font.  

Return Value

The return value identifies a logical font if the function is successful. Otherwise, it is NULL.

Comments

The CreateFontIndirect function creates a logical font that has all the specified characteristics. When the font is selected by using the SelectObject function, GDI's font mapper attempts to match the logical font with an existing physical font. If it fails to find an exact font, it provides an alternate whose characteristics match as many of the requested characteristics as possible. For a description of the font mapper, see Chapter 2, “Graphics Device Interface Functions.”