The TEXTMETRIC structure provides a wealth of information about the current font selected in the device context. However, the vertical size of a font is defined by only five values, as shown in Figure 2-3 on the following page.
These are fairly self-explanatory. The tmInternalLeading value is the amount of space allowed for an accent mark above a character. If the value is set to 0, accented capital letters are made a little shorter so that the accent fits within the ascent of the character. The tmExternalLeading value is the amount of space that the designer of the font is suggesting be added between character rows. You can accept or reject the font designer's suggestion for including external leading when spacing lines of text.
The TEXTMETRIC structure has two fields that describe character width: tmAveCharWidth (a weighted average width of lowercase characters) and tmMaxCharWidth (the width of the widest character in the font). For a fixed-pitch font, these two values are the same.
The sample programs in this chapter will require another character width—the average width of uppercase letters. This can be calculated as 150% of tmAveCharWidth.
It's important to realize that the dimensions of the system font are dependent on the resolution of the video display on which Windows runs. Windows provides a device- independent graphics interface, but you have to help. Don't write your Windows program so that it guesses at character dimensions. Don't hard code any values. Use the GetTextMetrics function to obtain this information.