The first structure of every PFM file is PFMHEADER. The Windows 3.0 Device Driver Kit says its fields are identical to the fields of a Windows screen font file (the Windows 2.x
FONTINFO structure), which the Windows Device Driver Adaptation Guide documents. All values are little-endian. Adobe Technical Note #5178, which describes the files for CJK fonts, gives the size as
117 bytes and the values Adobe’s tools write; both sources are used below, and where they differ the difference is said.
The fields
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 2 | dfVersion | The version of the structure. 256 (0x0100) in TN 5178. |
| 2 | 4 | dfSize | The exact size of the PFM file in bytes (TN 5178). The Windows 3.0 DDK lists the field as a WORD; the 117 bytes of the header in TN 5178 only add up with four bytes here. |
| 6 | 60 | dfCopyright | The copyright string, padded with zeros to 60 bytes; shortened if longer (for example Copyright 1985-1997 Adobe Systems Inc.). |
| 66 | 2 | dfType | 129 (0x81) in TN 5178. The HP LaserJet driver’s PFM generator (DDK, “PFM Data From Font Data”) writes 128. |
| 68 | 2 | dfPoints | The nominal point size. TN 5178 writes 10; the DDK’s PostScript chapter says the driver ignores it, because it assumes all PostScript fonts are scalable. |
| 70 | 2 | dfVertRes | The vertical resolution in dots per inch. 300 in TN 5178; the PostScript driver assumes 300. |
| 72 | 2 | dfHorizRes | The horizontal resolution in dots per inch. 300 in TN 5178. |
| 74 | 2 | dfAscent | The font-level ascent: the fourth element of the FontBBox array (the top of the highest point in the font), which an AFM file’s FontBBox gives. |
| 76 | 2 | dfInternalLeading | The internal leading. TN 5178: 0 if ascent minus descent is under 1000, otherwise ascent minus descent minus 1000, the descent being the second element of FontBBox. |
| 78 | 2 | dfExternalLeading | The external leading. 196 in TN 5178. |
| 80 | 1 | dfItalic | Nonzero for an italic font. The italic attribute is taken out of a PostScript font name and kept here (DDK, chapter 4). |
| 81 | 1 | dfUnderline | Nonzero for an underlined font. 0 in TN 5178. |
| 82 | 1 | dfStrikeOut | Nonzero for a struck-out font. 0 in TN 5178. |
| 83 | 2 | dfWeight | The weight, in the Windows range 0 to 1000. TN 5178: 700 for bold fonts, 400 for all others. The bold attribute is taken out of a PostScript font name and kept here. |
| 85 | 1 | dfCharSet | The Windows character set; the table below. TN 5178: 128, 129, 134 or 136. |
| 86 | 2 | dfPixWidth | The width of each character of a fixed-pitch raster font; 0 for variable pitch. 0 in TN 5178. |
| 88 | 2 | dfPixHeight | The character cell height. 1000 in TN 5178; the PostScript driver ignores it. |
| 90 | 1 | dfPitchAndFamily | The pitch and family; the table below. |
| 91 | 2 | dfAvgWidth | The average character width, in units of 1,000 to the em for a PostScript font. 500 in TN 5178. |
| 93 | 2 | dfMaxWidth | The widest character, in the same units. 1000 in TN 5178. |
| 95 | 1 | dfFirstChar | The first character code of the font. 32 in TN 5178. |
| 96 | 1 | dfLastChar | The last character code. 255 in TN 5178. |
| 97 | 1 | dfDefaultChar | The default character, counted from dfFirstChar: the DDK computes it as 127 minus the first character for PCL fonts. 0 in TN 5178. |
| 98 | 1 | dfBreakChar | The word break character, counted from dfFirstChar: 32 minus the first character in the DDK. 0 in TN 5178. |
| 99 | 2 | dfWidthBytes | The bytes in one row of a raster font’s bitmap. 0 in a printer font. |
| 101 | 4 | dfDevice | The offset from the start of the file of the device name string (PostScript, or PCL / HP LaserJet in the DDK’s PCL table). 199 in Adobe’s layout. |
| 105 | 4 | dfFace | The offset of the Windows face name string. 210 in Adobe’s layout. |
| 109 | 4 | dfBitsPointer | 0 in a printer font (a raster font’s bitmap address). |
| 113 | 4 | dfBitsOffset | 0 in a printer font. |
The sizes add up to 117: the header ends at offset 117, where the extension (or the width table) begins.
Character set
dfCharSet tells Windows how to treat the font in terms of language, character set and encoding. The values are those of the Windows lfCharSet constants (the values here are from the Windows GDI header wingdi.h):
| Value | Name | Value | Name |
|---|---|---|---|
| 0 | ANSI_CHARSET (Windows ANSI, code page 1252) | 161 | GREEK_CHARSET |
| 1 | DEFAULT_CHARSET | 162 | TURKISH_CHARSET |
| 2 | SYMBOL_CHARSET | 163 | VIETNAMESE_CHARSET |
| 77 | MAC_CHARSET | 177 | HEBREW_CHARSET |
| 128 | SHIFTJIS_CHARSET (Japanese, Shift-JIS) | 178 | ARABIC_CHARSET |
| 129 | HANGEUL_CHARSET (Korean) | 186 | BALTIC_CHARSET |
| 130 | JOHAB_CHARSET (Korean, Johab) | 204 | RUSSIAN_CHARSET (Cyrillic) |
| 134 | GB2312_CHARSET (Simplified Chinese) | 222 | THAI_CHARSET |
| 136 | CHINESEBIG5_CHARSET (Traditional Chinese) | 238 | EASTEUROPE_CHARSET |
| 255 | OEM_CHARSET |
For CJK fonts TN 5178 uses 128 for Japanese (Shift-JIS), 129 for Korean (EUC-KR or Unified Hangul Code), 134 for Simplified Chinese (EUC-CN or GBK) and 136 for Traditional Chinese (Big Five).
Weight
The Windows weights, 0 to 1000: 100 thin, 200 extra light, 300 light, 400 normal, 500 medium, 600 semibold, 700 bold, 800 extra bold, 900 heavy; 0 means “do not care”. Other numbers in the range are legal.
Pitch and family
dfPitchAndFamily is a byte. Its high four bits are the family, one of:
| Value | Family | Meaning |
|---|---|---|
| 0x00 | FF_DONTCARE | Use the default font. |
| 0x10 | FF_ROMAN | Variable stroke width (proportional), with serifs. |
| 0x20 | FF_SWISS | Variable stroke width, without serifs. |
| 0x30 | FF_MODERN | Constant stroke width (monospace), with or without serifs. |
| 0x40 | FF_SCRIPT | Fonts designed to look like handwriting. |
| 0x50 | FF_DECORATIVE | Novelty fonts. |
The pitch is in the low bit, and it is set for a variable pitch font: Windows’ tmPitchAndFamily bit TMPF_FIXED_PITCH is 1 and its header comment says it “means variable pitch”, and TN 5178 says “if the pitch of the one-byte Roman characters is proportional, then add 1”.
For its CJK fonts TN 5178 gives 16 (serif-like designs: Mincho, Song, Myungjo; the Japanese Kyokasho is treated as serif-like), 48 (other designs, including sans serif: Gothic, Hei) and 64 (script-like designs: Kaisho, Gyosho, Kai), plus 1 for proportional Roman characters: 16, 17, 48, 49, 64, 65. The DDK’s table for the PCL
font installer says “pitch bit is set if fixed pitch”, the other way round; a reader should take the bit as the font’s own file states and not assume which of the two conventions a file follows.