Introduction
A Printer Font Metrics file, .pfm, is the binary file in which Windows keeps the metrics of a printer font: the width of every character, the kerning
pairs, the names under which the font is listed and selected, and a few numbers (ascent, weight, character set, pitch and family) that Windows asks of every font. It was defined in the
Windows 3.0 Device Driver Kit for the printer drivers, which read one PFM file for each font on a printer (the PostScript and PCL drivers each have their own chapter). For a
PostScript Type 1 font the PFM file is the metrics file that goes with the .pfb outline file: Adobe’s font installer
(Adobe Type Manager) asks for both, and the AFM file is the text form of the same metrics, from which PFM files were built.
The extension .pfm is also used by the Portable Float Map image format, which has nothing to do with fonts; a file is told apart by its start (a float map starts
with PF or Pf; a font metrics file starts with a version word, 0x0100 in Adobe’s files, and its own size).
Structure
A PFM file is little-endian and made of structures that follow one another: the 117 byte PFMHEADER (the header of a Windows font file), an optional width table, the 30 byte PFMEXTENSION whose offsets point at the rest, the strings, the 52 byte EXTTEXTMETRIC, the extent table, and the pair and track kerning tables. Only the first two structures have a fixed place; every other part is found by an offset. The layout Adobe’s tools write for a PostScript font is:
0PFMHEADER version, size, copyright, type, ascent, weight, character set, pitch and family, first and last character, offsets of the names117 bytes117PFMEXTENSION offsets of the extended metrics, extents, kerning tables and driver data30 bytes147EXTTEXTMETRIC cap height, x height, underline, kerning counts52 bytes199Device namePostScriptand a zero byte11 bytes210Windows face name the name in the font menu, zero terminatedvaries…PostScript name the name given tofindfont, zero terminated (pointed to bydfDriverInfo)varies…Extent table one word of width, in 1/1000 em, for each code from the first to the last character2 bytes a character…Pair kerning table four bytes a pair: two character codes and a signed amount (optional)4 bytes a pair…Track kerning table five signed words a track (optional)10 bytes a track
The viewer
The viewer reads every field of the header, the extension and the extended text metrics, the three strings, the extent table, every kerning pair and every track, and
checks them against the Windows DDK and Adobe’s Technical Note #5178: the size in the header against the size of the file, the offsets against the file, structures that overlap, the string terminators, the extent table against the first and last
character, the kerning counts against the tables, the order of the pairs, and the values the DDK and the note fix. A click on a problem selects the bytes it is about. The tree covers every byte of the file; the
extents and kerning pairs are listed in tables that open at any length. When the Type 1 font is dropped with the file (same base name, .pfb,
.pfa or .t1), the viewer draws a sample line with the font’s outlines and the file’s extents, with the kerning pairs applied and without them.
Not described
Known, not yet covered
- Reference: the meaning of the bits of
dfTypeand the other Windows 2.x font header conventions are defined in the Microsoft Windows Device Driver Adaptation Guide (the DDK says the header is the Windows 2.xFONTINFOstructure). That guide was not found; the header page gives only the values the DDK and Technical Note #5178 state (129 and 128). - Reference: the printer cartridge metrics file (
.pcm, which holds PFM files), the PCL chapter’s details (the HP symbol set and weight tables of the Printer Font Installer,FINSTALL.DIR), and the Universal Printer Driver’s version of the driver data (DRIVERINFOwithsSize,iVersion,fCapsand the like, from the Windows 95 and 98 DDK) are documented by Microsoft and are not described beyond what the PostScript, CJK and PCL page says. - Viewer: a PFM file has no glyph names, so the sample line looks each character code up in the Type 1 font’s own Encoding, which is not what a Windows driver does for a font installed with the Windows ANSI character set (the two agree for the letters and digits, and differ at codes such as 39 and 96 and above 127). The sample is not drawn for a CJK (CID-keyed) font, and uses no track kerning.
- Viewer: PCL driver data is read as the 22 bytes of
DRIVERINFOwithTRANSTABLE; the escape string that selects the font, and the user defined translation table, are named by their offsets and not read. A.pcmfile is not recognised.
Unknown
- Reference: the stored size of the
SYMBOLSETenumeration insideTRANSTABLE: the DDK declares it as an enumerated type and does not say how many bytes it takes. The viewer takes 16 bits, as anintof 16-bit Windows, and says so beside the structure.
Also used for
- Portable Float Map – Uncompressed 32-bit float images after a three-line text header.
Links
Software
- FontForge – free font editor that opens and writes Type 1 fonts with their metrics files (Windows, macOS, Linux)
- Ghostscript – PostScript interpreter that uses Type 1 fonts (Windows, macOS, Linux)
Reference
- Building PFM Files for PostScript-Language CJK Fonts – Adobe Technical Note #5178, 10 January 1997 (PDF, Internet Archive copy)
- Windows 3.0 Device Driver Kit, Printer and Font Kit – Microsoft’s chapters 2, 4 and 5 on PFM files, as published by PCjs
- Printers and Fonts Kit (3.1), Metrics File Formats – the Windows 3.1 DDK help topics on PFMHEADER, PFMEXTENSION and EXTTEXTMETRIC
- PostScript Type 1 font – the outline font a PFM file describes
- Adobe Font Metrics – the text form of the same metrics