Next Previous Contents

4. CP and raw fonts

PSF is the Linux standard font format, but various old and very obsolete formats still exist.

CP font files are just fragments of CPI fonts, obtained by concatenating CPEntryHeader (28 bytes), FontDataHeader (6 bytes), and for each font ScreenFontHeader (6 bytes) and ScreenFontData, that is, the part of a CPI font describing one code page.

(History: the first .cp files used with Linux that I know of were 972.cp and 880.cp included in codepage.tar.gz by Joel M. Hoffman, dated June 14, 1992. Support for such files was added in kbd-0.84.)

Of the CPEntryHeader, the only meaningful field is codepage. Of the FontDataHeader, the only meaningful fields are num_fonts (1 or 3) and size, giving the size of the following ScreenFontData. A CP file containing three fonts of pointsizes 16, 14, 8 will have size 34+(6+16*256)+(6+14*256)+(6+8*256) = 9780 bytes, with the three fonts at offsets 40, 4142, 7732. A CP file containing one font of point size 16 will have size 34+(6+16*256) = 4136 bytes, with the font at offset 40.

There are other sources of fonts, and binary files with a length that is a multiple of 256 or a multiple of 256 plus 40 are accepted as possible binary font data (perhaps with a 40-byte header) for fonts of size 256.

Binary font files of size 32768 are treated as binary font data for a 512-char font of height 32. Such files are written by the obsolete restorefont -w.


Next Previous Contents