EXTTEXTMETRIC
The extended text metrics are 26 little-endian 16-bit values, 52 bytes, found at dfExtMetricsOffset. All the measurements are given in the specified units, whatever the current mapping mode. The fields, in order
(the offset is from the start of the structure):
| Offset | Field | Meaning |
|---|---|---|
| 0 | etmSize | The size of this structure in bytes: 52. (Not a point size.) |
| 2 | etmPointSize | The nominal point size, in twips (twentieths of a point): the intended graphic arts size of the font. 240 (12 points) in TN 5178. The PostScript driver ignores it. |
| 4 | etmOrientation | The orientation the font can be imaged on: 0 either, 1 portrait, 2 landscape. |
| 6 | etmMasterHeight | The font size in device units for which the extent table is exact. The PostScript driver assumes 300 (DDK chapter 4); TN 5178 writes 1000. |
| 8 | etmMinScale | The smallest valid size in device units; the smallest point size is etmMinScale × 72 ÷ dfVertRes. 3 in TN 5178. |
| 10 | etmMaxScale | The largest valid size in device units. 1000 in TN 5178. |
| 12 | etmMasterUnits | The font units to the em, where an em equals etmMasterHeight. 1000 for a PostScript font (Adobe’s standard). |
| 14 | etmCapHeight | The height of the capitals, in font units; the H is measured. |
| 16 | etmXHeight | The height of the lower-case letters; the x. |
| 18 | etmLowerCaseAscent | How far the ascender of the lower-case d reaches above the baseline. |
| 20 | etmLowerCaseDescent | How far the descender of the lower-case p reaches below the baseline, as an absolute value (TN 5178). The DDK’s structure spells the field etmUpperCaseDescent and its text etmLowerCaseDescent. |
| 22 | etmSlant | The slant in tenths of a degree clockwise from upright. |
| 24 | etmSuperScript | The recommended offset of superscripts from the baseline, typically negative. −500 in TN 5178. |
| 26 | etmSubScript | The recommended offset of subscripts, typically positive. 250 in TN 5178. |
| 28 | etmSuperScriptSize | The recommended size of superscripts. 500 in TN 5178. |
| 30 | etmSubScriptSize | The recommended size of subscripts. 500 in TN 5178. |
| 32 | etmUnderlineOffset | The offset downward from the baseline to the top of a single underline bar. 100 in TN 5178 (0 for a vertical font). |
| 34 | etmUnderlineWidth | The thickness of the underline bar. 50. |
| 36 | etmDoubleUpperUnderlineOffset | The offset to the top of the upper bar of a double underline. 50. |
| 38 | etmDoubleLowerUnderlineOffset | The offset to the top of the lower bar. 100. |
| 40 | etmDoubleUpperUnderlineWidth | The thickness of the upper bar. 25. |
| 42 | etmDoubleLowerUnderlineWidth | The thickness of the lower bar. 25. |
| 44 | etmStrikeOutOffset | The offset upward from the baseline to the top of the strikeout bar. 405. |
| 46 | etmStrikeOutWidth | The thickness of the strikeout bar. 50. |
| 48 | etmKernPairs | The number of kerning pairs; the DDK says it will not be greater than 512. |
| 50 | etmKernTracks | The number of kerning tracks; the DDK says it will not be greater than 16. |
The DDK says the only field it knows an application to use is etmKernPairs, so a font with kerning pairs must fill it in, and the other fields should still have reasonable values.
Font units and scaling
A driver can measure widths in device units (dots) or font units. etmMasterHeight is in device units; etmMasterUnits is the units to the em, where an em equals etmMasterHeight. The conversions are:
- font units = device units ×
etmMasterUnits÷etmMasterHeight; - device units = font units ×
etmMasterHeight÷etmMasterUnits; - height in points =
etmMasterHeight× 72 ÷dfVertRes.
The extent table is exact for a font height equal to etmMasterHeight; for another height the driver scales linearly: character width = font height × extent ÷ etmMasterUnits, in the unit of the height. Its worked example: at 300 dpi with 1000 units to the em, an H of 500 units set at 12 points (50 device units) is
50 × 500 ÷ 1000 = 25 device units wide.
The extent table
An array of 16-bit values, one for each character from dfFirstChar to dfLastChar (so dfLastChar − dfFirstChar + 1 words), found at dfExtentTable: the unscaled widths of the characters, in 1/1000 em for a PostScript font. It
must be present in a PostScript PFM file. For CJK fonts the value of a code that is the first byte of a two-byte character is 500 (TN 5178).
The pair kerning table
An array of etmKernPairs structures of 4 bytes, found at dfPairKernTable (NULL if there are none). The kerning values are in the same 1000-to-the-em units as the extents.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 1 | kpPair.each[0] | The character code of the first character of the pair. |
| 1 | 1 | kpPair.each[1] | The character code of the second character. |
| 2 | 2 | kpKernAmount | A signed amount by which the pair is kerned when the two sit side by side in the same font and size; typically negative, since kerning usually sets two characters closer. |
The two bytes are also a 16-bit word, kpPair.both, with the first character in the low-order byte and the second in the high-order byte. The DDK says the table must be sorted in increasing order by kpPair.both (or by the second character, then the first), so that an application can search it by halving.
The track kerning table
An array of etmKernTracks structures of five signed 16-bit values (10 bytes), found at dfTrackKernTable (NULL if none). The DDK’s PostScript chapter says it knows of no application that uses it.
| Offset | Field | Meaning |
|---|---|---|
| 0 | ktDegree | Increasingly negative values are tighter track kerning, increasingly positive values looser. |
| 2 | ktMinSize | The minimum font size, in device units, for which linear track kerning applies. |
| 4 | ktMinAmount | The amount of track kerning, in font units, to apply to sizes ktMinSize and below. |
| 6 | ktMaxSize | The maximum font size, in device units, for which linear track kerning applies. |
| 8 | ktMaxAmount | The amount, in font units, for sizes ktMaxSize and above. |
Between ktMinSize and ktMaxSize the track kerning is a linear function from ktMinAmount to ktMaxAmount. The same idea, in points, is the TrackKern line of an AFM file.