EnumFontFamProc

  int CALLBACK EnumFontFamProc(lplf, lptm, FontType, lParam)    
  LPLOGFONT lplf; /* address of structure with logical-font data */
  LPTEXTMETRIC lptm; /* address of structure with physical-font data */
  DWORD FontType; /* type of font */
  LPARAM lParam; /* address of application-defined data */

The EnumFontFamProc function is an application-defined callback function that retrieves information about available fonts.

Parameters

lplf

Points to a NEWLOGFONT structure that contains information about the logical attributes of the font. This structure is locally-defined and is identical to the Windows LOGFONT structure except for two new members. The NEWLOGFONT structure has the following form:

struct tagNEWLOGFONT { /* nlf */

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];

BYTE lfFullName[2 * LF_FACESIZE]; /* TrueType only */

BYTE lfStyle[LF_FACESIZE]; /* TrueType only */

} NEWLOGFONT;

The lfFullName and lfStyle members are appended to a LOGFONT structure when a TrueType font is enumerated in the EnumFontFamProc function.

The lfFullName member is a character array specifying the full name for the font. This name contains the font name and style name.

The lfStyle member is a character array specifying the style name for the font.

For example, when bold italic ArialÒ is enumerated, the last three members of the NEWLOGFONT structure contain the following strings:

lfFaceName = “Arial”; lfFullName = “Arial Bold Italic”; lfStyle = “Bold Italic”;

lptm

Points to a NEWTEXTMETRIC structure that contains information about the physical attributes of the font, if the font is a TrueType font. If the font is not a TrueType font, this parameter points to a TEXTMETRIC structure.

The NEWTEXTMETRIC structure has the following form:

typedef struct tagNEWTEXTMETRIC { /* ntm */

LONG tmHeight;

LONG tmAscent;

LONG tmDescent;

LONG tmInternalLeading;

LONG tmExternalLeading;

LONG tmAveCharWidth;

LONG tmMaxCharWidth;

LONG tmWeight;

LONG tmOverhang;

LONG tmDigitizedAspectX;

LONG tmDigitizedAspectY;

BYTE tmFirstChar;

BYTE tmLastChar;

BYTE tmDefaultChar;

BYTE tmBreakChar;

BYTE tmItalic;

BYTE tmUnderlined;

BYTE tmStruckOut;

BYTE tmPitchAndFamily;

BYTE tmCharSet;

DWORD ntmFlags;

UINT ntmSizeEM;

UINT ntmCellHeight;

UINT ntmAvgWidth;

} NEWTEXTMETRIC;

The TEXTMETRIC structure is identical to NEWTEXTMETRIC except that it does not include the last four members.

FontType

Specifies the type of the font. This parameter can be a combination of the following masks:

DEVICE_FONTTYPE RASTER_FONTTYPE TRUETYPE_FONTTYPE

lParam

Points to the application-defined data passed by EnumFontFamilies.

Return Value

This function must return a nonzero value to continue enumeration; to stop enumeration, it must return zero.

Comments

An application must register this callback function by passing its address to the EnumFontFamilies function. The EnumFontFamProc function is a placeholder for the application-defined function name. The actual name must be exported by including it in an EXPORTS statement in the application's module-definition (.DEF) file.

The AND (&) operator can be used with the RASTER_FONTTYPE, DEVICE_FONTTYPE, and TRUETYPE_FONTTYPE constants to determine the font type. If the RASTER_FONTTYPE bit is set, the font is a raster font. If the TRUETYPE_FONTTYPE bit is set, the font is a TrueType font. If neither bit is set, the font is a vector font. A third mask, DEVICE_FONTTYPE, is set when a device (for example, a laser printer) supports downloading TrueType fonts or when the font is a device-resident font; it is zero if the device is a display adapter, dot-matrix printer, or other raster device. An application can also use the DEVICE_FONTTYPE mask to distinguish GDI-supplied raster fonts from device-supplied fonts. GDI can simulate bold, italic, underline, and strikeout attributes for GDI-supplied raster fonts, but not for device-supplied fonts.

See Also

EnumFontFamilies, EnumFonts