Introduction
A Printer Cartridge Metrics file, .pcm, describes the fonts of one printer cartridge to the Windows 3.x PCL driver (the driver for HP LaserJet printers and compatibles). A font cartridge plugs into the printer and holds fonts that the printer already has, so there is nothing to download; Windows only needs their metrics. The file holds those metrics as a 16 byte header, a title and then the PFM files of the cartridge’s fonts, one after another, one PFM for each font. It is defined in the Windows 3.0 Device Driver Kit, Printer and Font Kit, section 2.4.
The extension .pcm is also used for raw PCM audio, which has no header at all; the two are told apart by the first word of the file, 0x0CAC (3244), together with the size and the offsets described below.
Structure
All numbers are little-endian. The header is followed by the title string and by the PFM files; every offset in the header is counted from the start of the file, and every offset inside a PFM is counted from the start of that PFM (the driver calls that start lPCM).
0pcmMagic WORD, 0x0CAC (3244)2 bytes2pcmVersion WORD, binary coded decimal, 0x0310 for version 3.102 bytes4pcmSize DWORD, the size of the whole file4 bytes8pcmTitle DWORD, the offset of the title, a zero-terminated string that is not empty (an offset of 0 is not allowed)4 bytes12pcmPFMList DWORD, the offset of the first PFM4 bytes16Title the cartridge title as the installer lists it, zero terminatedvaries…PFM 1, PFM 2, … each PFM’sdfSize(the DWORD at offset 2 of a PFM) is the distance to the next one; the last ends at the end of the filedfSize each
Cartridge PFM files
The PFMs inside a cartridge are ordinary printer font metrics files (PFMHEADER, PFMEXTENSION and the PCL DRIVERINFO that is described on the PostScript, CJK and PCL page), set up as section 12.7 of the DDK says for resident and cartridge fonts: the symbol set is GENERIC7 (index 16) or GENERIC8 (index 17), epVersion is 1, and the translation table offset, length and first character are all 0. The escape string selects the cartridge font in the printer.
A cartridge PFM that has no extended text metrics (dfExtMetricsOffset is 0) has no room for the orientation of the font, so the driver’s loadFontPFM (FONTBLD.C) reads it from a byte of the translation table information, the last character byte of DRIVERINFO, when the table length is 0:
- bits 0 and 1: 0 either orientation, 1 portrait, 2 landscape, 3 matches neither (used only when no orientation is asked for);
- 0x10: the Z-cartridge hack;
- 0x20: the quote hack.
The viewer shows the three values for every font in the table of fonts, beside the face, size, weight, character set, symbol set and escape string.
Installing a cartridge
The Printer Font Installer finds a cartridge in two ways. With a FINSTALL.DIR file it uses the CARTRIDGE entry described below. Without one it scans the disk for files that have a valid magic word, version and title. Once installed, the driver keeps the cartridge in WIN.INI, in the section of the printer and port, as cartridgen=PCM-file; in version 3.2 the index is at least 50. The PFM Editor also writes a text file with the same name and the extension .ini next to the .pcm.
FINSTALL.DIR
FINSTALL.DIR links each soft font file to its PFM and screen font. Comments are /* … */ and do not nest. It has three kinds of entries:
DRIVE id[:] = label-file [, "label-descriptor"]names a floppy disk by its.LBLlabel file; files are then written asid:name. The installer asks for the disk until the label file is found.FAMILY ["family-name"] { … }holds screen font linesaspect = "description", screen-font-file(aspects such as 72:72, 96:96, 108:108, 120:120, 144:144, 96:72 for EGA and 96:48 for CGA; several may be listed with commas) and printer font lines"font-description" = orient, [download-file] [, PFM-file], where orient is P, L, PL or LP, and the download file may be left out with two commas. A missing PFM is generated from the font.CARTRIDGE { … }holds the same screen font lines and"cartridge title" = PCM-filelines.
CARTRIDGE {
1:1 = "Acme Tms 1:1", TR1:TR11.FON
"Acme Font Ser" = TR1:ACMECART.PCM
}
Tables of the PFM generator
When there is no PFM, the installer builds one from the soft font (DDK chapter 11). It sets dfVersion 256, dfType 128, the resolution 300, epVersion 1 and epEscape 0, and takes the weight from the HP stroke weight and the character set from the HP symbol set:
| HP stroke weight | Windows weight |
|---|---|
| −7, −6 | 100 |
| −5, −4 | 200 |
| −3, −2 | 300 |
| −1, 0 | 400 |
| 1 | 500 |
| 2 | 600 |
| 3, 4 | 700 |
| 5, 6 | 800 |
| 7 | 900 |
| HP symbol set | Character set | Translation |
|---|---|---|
| 8U (Roman-8) | 0 | Roman-8 table |
| 0U (USASCII) | 0 | USASCII table |
| 11Q (ECMA-94) | 0 | ECMA-94 table |
| 8M | 180 | 8-bit pass through |
| 15U | 181 | 8-bit pass through |
| 0B (LineDraw) | 182 | 7-bit |
| 4Q (PC Line) | 183 | 7-bit |
| 0B (TaxLnDrw) | 184 | 7-bit |
| 1U (US Legal) | 185 | 7-bit |
| all others | 0 | pass through (8-bit when the font type byte is not zero, 7-bit when it is zero) |
The viewer
The viewer reads the header field by field, the title, and every PFM in the list, using the same parser as the .pfm viewer. The Cartridge tab lists the fonts in a table that opens at any length; the Font option chooses the font whose PFM is shown in the tabs that follow (names, header, extension, metrics, extents, kerning), with every byte offset moved to the offset in the .pcm file. The tree covers every byte of the file. It checks the magic word, that the version is binary coded decimal, pcmSize against the file, the title and list offsets, and the dfSize chain (a PFM that runs past the end of the file, or one shorter than the 147 bytes of its two fixed structures, is a problem); a click on a problem selects the bytes it is about.
Not described
Known, not yet covered
- None.
Unknown
- The PFM Editor’s
.inifile beside a cartridge is named by the DDK but its contents are not described there.
Divergence from spec
The DDK says the version of the current PCM format is 0x0310; the viewer accepts any binary coded decimal version and notes one that is not 3.10 instead of refusing it. The DDK gives no limit for the number of fonts in a cartridge; the viewer reads as many as the dfSize chain gives. The orientation byte that the driver source reads from a cartridge PFM is not mentioned in the DDK text of section 2.4 or 12.7; it is taken from FONTBLD.C only. No real .pcm file was found, so the page rests on the DDK and the driver source.
Sources
- Windows 3.0 Device Driver Kit, Printer and Font Kit: section 2.4 (printer cartridge metrics), chapter 9 (FINSTALL.DIR), chapter 11 (the PFM generator), section 12.7 (resident and cartridge fonts).
- Windows 3.1 DDK PCL driver source,
FONTBLD.C,loadFontPFM: the orientation and hack bits of a cartridge PFM.
Also used for
- Raw PCM audio – Bare audio samples with no header: the format must be known in advance.
Links
Reference
- Windows 3.0 Device Driver Kit, Printer and Font Kit – Microsoft’s chapters on cartridge metrics, FINSTALL.DIR and the PFM generator, as published by PCjs
- Windows Printer Font Metrics – the format of each font inside a cartridge
- Raw PCM audio – the other use of the extension