The following table specifies the most important font metrics for applications that require portable documents and the functions that allow an application to retrieve them.
Function | Metric | Use |
---|---|---|
EnumFontFamilies | ntmSizeEM | Retrieval of design metrics; conversion to device metrics |
GetCharABCWidths | ABCWidths | Accurate placement of characters at the start and end of margins, picture boundaries, and other text breaks |
GetCharWidth32 | AdvanceWidths | Placement of characters on a line |
GetOutlineTextMetrics | otmfsType | Font-embedding bits |
otmsCharSlopeRise | Y-component for slope of cursor for italic fonts | |
otmsCharSlopeRun | X-component for slope of cursor for italic fonts | |
otmAscent | Line spacing | |
otmDescent | Line spacing | |
otmLineGap | Line spacing | |
otmpFamilyName | Font identification | |
otmpStyleName | Font identification | |
otmpFullName | Font identification (typically, family and style name) |
The otmsCharSlopeRise, otmsCharSlopeRun, otmAscent, otmDescent, and otmLineGap members of the OUTLINETEXTMETRIC structure are scaled or transformed to correspond to the current device mode and physical height (as given in the tmHeight member of the NEWTEXTMETRIC structure).
Font identification is important in those instances when an application must select the same font — for example, when a document is reopened or moved to a different operating system. The font mapper always selects the correct font when an application requests a font by full name. The family and style names provide input to the standard font dialog box, which ensures that the selection bars are properly placed.
The otmsCharSlopeRise and otmsCharSlopeRun values are used to produce a close approximation of the main italic angle of the font. For typical roman fonts, otmsCharSlopeRise is 1 and otmsCharSlopeRun is 0. For italic fonts, the values attempt to approximate the sine and cosine of the main italic angle of the font (in counterclockwise degrees past vertical); note that the italic angle for upright fonts is 0. Because these values are not expressed in design units, they should not be converted into device units.
The character placement and line spacing metrics enable an application to compute device-independent line breaks that are portable across screens, printers, typesetters, and even platforms.
Device-independent page layout requires the following seven basic steps:
If all applications adopt these techniques, developers can virtually guarantee that documents moved from one application to another will retain their original appearance and format.