You can enumerate the available fonts by calling the EnumFonts or EnumFontFamilies function. These functions send information about the available fonts to a callback function that the application supplies. The callback function stores the information in the LOGFONT structure and in either the NEWTEXTMETRIC structure for TrueType fonts or the TEXTMETRIC structure for raster fonts. By using the information returned from these functions, you can limit the user's choices to available fonts only.
The EnumFontFamilies function is similar to the EnumFonts function, but includes some extra features for use with TrueType fonts. The EnumFontFamilies function enumerates all the styles associated with a specified typeface, and not simply the bold and italic attributes. For example, when the system includes a TrueType font called Courier New Extra-Bold, EnumFontFamilies lists it with the other Courier New fonts.
Note Despite its name, EnumFontFamilies actually enumerates the styles associated with a specified typeface—for example, Arial—rather than a font family, such as Swiss.
If you do not supply a typeface name, the EnumFonts and EnumFontFamilies functions supply information about one font in each available typeface. To enumerate all the fonts in a device context, you can specify NULL for the typeface name, compile a list of the available typefaces, and then enumerate each font in each typeface.