This page is taken from Adobe Technical Note #5004, “Adobe Font Metrics File Format Specification”, version 4.1 of 7 October 1998 (section numbers below are the note’s). It covers the syntax of the file and every key outside the character, kerning and composite lines, which have pages of their own: character metrics, kerning and composite, multiple master and CID fonts.
Line syntax
- The file is line oriented. Each line begins with a key (a property name), followed by the values for it. Keys and values are separated by one or more white space characters, a space or a tab. Lines are no longer than 255 characters (section 3.1).
- Key names are case sensitive. All keys beginning with a capital letter are reserved for Adobe; user-defined non-standard keys must begin with a lower-case letter. Other keys are allowed and are ignored by a parser that does not know them.
- Empty lines, or lines of white space only, may occur anywhere after the first line and are ignored. White space is the ASCII space, newline and tab.
- A value is one of: a string (to the end of the line, from the first non-white-space character after the key;
printable ASCII plus space, tab and ESC; byte values above
<7F>are not permitted), a name (like a string, but with no white space inside, ended by white space), a number (real or integer, signed or unsigned: it may or may not have a decimal point or a leading minus sign), an integer, an array (names, numbers, integers, booleans or other arrays, in square brackets) or a boolean (trueorfalse). - With a few explicitly noted exceptions all keys are optional; font software developers are “strongly recommended to include as much information as is reasonable”.
Commentfollowed by any text, to the end of the line: the text is arbitrary and is ignored.- The version 3.0 changes (the appendix of the note) forbid byte values above
<7F>and semicolons without spaces before them.
The first line is StartFontMetrics (or StartCompFontMetrics, StartMasterFontMetrics) with the version number of the
format, and the last non-empty line is the matching End key. The version number is that of the specification the file was written to:
fractional increases are minor, upward-compatible revisions, whole-number increases are major, potentially incompatible changes.
The versions are 2.0, 3.0, 4.0 and 4.1.
Control and structure keys
| Key | Values | Meaning |
|---|---|---|
StartFontMetrics … EndFontMetrics | version | Required. Delimit an AFM file (section 4). |
StartCompFontMetrics … EndCompFontMetrics | version | Required. Delimit an ACFM file (section 5). |
StartMasterFontMetrics … EndMasterFontMetrics | version | Required. Delimit an AMFM file (section 6.1). |
Comment | string | A comment. |
MetricsSets | integer 0, 1 or 2 | Optional. The writing directions described: 0 direction 0 only, 1 direction 1 only, 2 both. 0 is implied when absent. It must occur in the header before the first StartDirection (section 4.1). |
StartDirection … EndDirection | integer 0, 1 or 2 | Optional if MetricsSets is 0, required otherwise. Enclose the metrics of writing direction 0, 1 or 2; 2 means the metrics of both directions are the same. When omitted StartDirection 0 is implied (section 7.2). |
StartCharMetrics … EndCharMetrics | count | Required if individual character metrics are present. The count is the number of lines to expect (section 8). |
StartKernData … EndKernData | none | Required if track or pair kerning are present (section 9). |
StartTrackKern … EndTrackKern | count | Required if track kerning data are present; the number of TrackKern lines (section 9.1). |
StartKernPairs, StartKernPairs0, StartKernPairs1 … EndKernPairs | count | Required if pair kerning is present; the number of pairs. The first two denote writing direction 0, the last direction 1 (section 9.2). |
StartComposites … EndComposites | count | Required if composite character data are present (section 10). |
The ACFM and AMFM structure keys (Descendents, StartDescendent, Masters, Axes, StartAxis,
StartMaster, StartPrimaryFonts and their values) are on the
families page.
Global font information
These keys are the same as those in the top level or the FontInfo dictionary of the PostScript font. All numeric values are in units of
1/1000 of the scale factor (point size) of the font. They appear at the top of the file and, in an ACFM file, in each descendent font’s section
(section 7.1).
| Key | Value | Meaning |
|---|---|---|
FontName | string | Required. The name of the font program as the PostScript findfont operator takes it, for example ITC Garamond-Light. For a CID-keyed font it is the CIDFontName of the CIDFont file (the note’s version 4.1 correction of 7 October 1998). |
FullName | string | The full text name, for example ITC Garamond Light. |
FamilyName | string | The typeface family, for example ITC Garamond. |
Weight | string | The weight: Roman, Bold, Light. |
FontBBox | four numbers | Required. The lower-left and upper-right corners of the font bounding box, llx lly urx ury, of the flattened paths, not the Bézier curve descriptions. Integers up to version 3.0; numbers since multiple master fonts. |
Version | string | The font program’s version, matching the FontInfo dictionary. |
Notice | string | The trademark or copyright notice. |
EncodingScheme | string | The default encoding vector: AdobeStandardEncoding, JIS12-88-CFEncoding, or FontSpecific. |
MappingScheme | integer | Not present in a base font. The mapping scheme of a composite font (section 5.9 of the PostScript Language Reference Manual, second edition): 2 is 8/8 mapping, 3 escape mapping. |
EscChar | integer | Required if MappingScheme is 3, not present otherwise: the byte value of the escape character. |
CharacterSet | string | The character set (glyph complement): AdobeStandardLatin, AdobeStandardCyrillic, Adobe-Japan1-2. |
Characters | integer | The number of characters defined in the font program. |
IsBaseFont | boolean | true for a base font; taken as true when absent; always false at the top level of an ACFM file. |
VVector | two numbers | Required when MetricsSets is 2. The vector from origin 0 to origin 1. When present the vector is the same for all characters and IsFixedV is true. The note’s own CID-keyed example (section 11.7) has MetricsSets 2 without it, so the viewer notes a missing VVector and does not call it a problem. |
IsFixedV | boolean | true if VVector is the same for every character. Its value must not conflict with VVector; if absent it is taken as true when VVector is present and false otherwise. |
IsCIDFont | boolean | Required in the AFM file of a CID-keyed font. true: the metrics are in CID number order, and a CID that is omitted has no character. Added in 4.1. |
CapHeight | number | Usually the y value of the top of the capital H; 0 or absent when the font has none. |
XHeight | number | Typically the y value of the top of the lower-case x. |
Ascender | number | For roman fonts usually the y value of the top of the lower-case d. |
Descender | number | For roman fonts typically the y value of the bottom of the lower-case p, so negative. |
StdHW, StdVW | number | The dominant width of horizontal stems (measured vertically) and of vertical stems (measured horizontally). Added in 4.1. |
The multiple master keys BlendAxisTypes, BlendDesignPositions, BlendDesignMap and WeightVector are listed in the same section of the note
and described on the families page.
Writing direction keys
Writing direction 0 is the horizontal one of roman typefaces, direction 1 the vertical one of Japanese typefaces (section 3.2 and figure 1 of the
note). These keys appear inside StartDirection … EndDirection (section 7.2). A file that describes direction 0 only may give them at the
top level, which is how the version 2.0 format and the note’s Times-Roman example (section 11.1) write them.
| Key | Value | Meaning |
|---|---|---|
UnderlinePosition | number | The distance from the baseline for centring underlining strokes: a y displacement for direction 0, an x displacement for direction 1. |
UnderlineThickness | number | The stroke width for underlining, generally proportional to the character stems. |
ItalicAngle | number | The angle in degrees counter-clockwise from the vertical of the dominant vertical strokes; 0 for a non-italic font, for example -12. |
CharWidth | two numbers | The x and y components of the width vector that all characters of the font have in this direction; implies IsFixedPitch true. |
IsFixedPitch | boolean | true for a fixed pitch (monospaced) font. It must not conflict with CharWidth; if absent it is true when CharWidth is present and false otherwise. |
Section 6.3 of the note, which lists the keys of an AMFM file, prints the type of UnderlinePosition as “boolean”; section 7.2 and every example give a number, and the viewer reads a number.
Units and the coordinate systems
Every measurement is in units equal to 1/1000 of the scale factor (point size) of the font in use. To get a size in points, multiply by the scale
factor and divide by 1000 (72 points to the inch). The origin of a roman character is on the baseline, a little to the left of the character, and the x axis runs along the
baseline; the em square is 1000 units. For a Japanese font in writing direction 0 the character is centred in a square from 0 to 1000 in x and from -120 to 880 in y; in direction 1 the
origin is above the centre of the character, the square runs from -500 to 500 in x and from 0 to -1000 in y, and the width CharWidth is negative in y (figure 1 and
section 11.3 of the note).
Example: the start of a file
StartFontMetrics 3.0
Comment Copyright 1985, 1987, 1989, 1990 Adobe Systems ...
FontName Times-Roman
FullName Times Roman
FamilyName Times
Weight Roman
ItalicAngle 0
IsFixedPitch false
FontBBox -170 -223 1024 896
UnderlinePosition -109
UnderlineThickness 49
Version 001.004
EncodingScheme AdobeStandardEncoding
CapHeight 662
XHeight 448
Ascender 682
Descender -217
This is the header of the example in section 11.1 of the note, which keeps only the keys of version 2.0 so that both 2.0 and 3.0 readers can parse it.