After you set up the logical font structure, you call CreateFontIndirect to get a handle to the logical font. When you use SelectObject to select that logical font into a device context, Windows finds the real font that most closely matches the request. In doing so, it uses a ”font-mapping algorithm.“ Certain fields of the structure are more important than other fields.
The best way to get a feel for font mapping is to spend an hour or so experimenting with PICKFONT. Here are some general guidelines:
The lfCharSet (character set) field is very important. For the display, if you specify OEM_CHARSET, you'll get either one of the stroke fonts or the terminal font, because these are the only fonts that do not use the ANSI character set. You have to use OEM_CHARSET if you want a GDI stroke font. A value of ANSI_CHARSET always gives you a raster font.
A pitch value of FIXED_PITCH (in the lfPitchAndFamily field) is important, because you are in effect telling Windows that you don't want to deal with a variable-pitch font.
The lfFaceName field is important, because you're being specific about the typeface of the font that you want. If you leave lfFaceName set to NULL and set the lfFamily field to a value other than FF_DONTCARE, then the latter field becomes important, because you're being specific about the font family.
Windows will attempt to match the lfHeight value even if it needs to increase the size of a smaller font. The height of the actual font will always be less than or equal to that of the requested font unless there is no font small enough to satisfy your request.
You can prevent Windows from scaling a font by setting lfQuality to PROOF_QUALITY. By doing so, you're telling Windows that the requested height of the font is less important than the appearance of the font.
If you specify lfHeight and lfWidth values that are out of line for the particular aspect ratio of the display, Windows can map to a font that is designed for a display or other device of a different aspect ratio. You can use this trick to get a particularly thin or fat font. In general, however, you'll probably want to avoid this situation, which you do in PICKFONT by clicking the check box marked Match Aspect. PICKFONT makes a call to SetMapperFlags with a flag set to 1:
SetMapperFlags (hdc, 1L) ;
This specifies that Windows should only match fonts that have the same aspect ratio as the display. You can get fonts of other aspect ratios by setting the mapper flag back to the default value:
SetMapperFlags (hdc, 0L) ;
If you don't like the way that Windows weights these various characteristics of the logical font to match a real font, you can change them all using the SetFontMapperFlags function.