6.6 Code-Page Information Files (.CPI)

Code-page information files, also called font files, contain the bitmap and escape-sequence data required to support multiple code pages for screen or printer devices. Included with MS-DOS are five font files, identified by a filename extension of .CPI:

File Supported device

EGA.CPI Color console used with EGA and VGA display adapters
LCD.CPI Liquid crystal display
4201.CPI IBM Proprinters II and III Model 4201 and IBM Proprinters II and IIIXL Model 4202
4208.CPI IBM Proprinter X24 Model 4207 and IBM Proprinter XL24 Model 4208
5202.CPI IBM Quietwriter III Model 5202

A font file has the following form:

FONTFILEHEADER <> ;font file header

FONTINFOHEADER <> ;font information header

CPENTRYHEADER <> ;first code-page entry header

.

.

.

FONTDATAHEADER <> ;first font data

.

.

.

Copyright db 150 dup(?) ;copyright notice

A font file begins with a FONTFILEHEADER structure that identifies the file as a valid font file and specifies how many fonts it has. Currently, only one font per file is permitted. A font file always ends with a copyright notice.

Each font in a font file has a corresponding FONTINFOHEADER structure, beginning at the offset contained in the ffhOffset field in the FONTFILEHEADER structure, that specifies how many code pages the font file supports.

For each code page, the file contains one CPENTRYHEADER structure, which defines the code page and device for which the font was designed. This structure also points to the next CPENTRYHEADER structure if the font file supports more than one code page. The first CPENTRYHEADER structure immediately follows the FONTINFOHEADER structure.

The cpeOffset field in each CPENTRYHEADER structure points to a font-data block consisting of a FONTDATAHEADER structure and data for either a screen font or a printer font. The cpeDevType field specifies whether the font data defines a screen font or a downloadable printer font.

The FONTDATAHEADER structure specifies the number of fonts defined for the code page. Each font for a screen device begins with a SCREENFONTHEADER structure that specifies the raster dimensions of each character in the font and the number of characters in the font. This structure is followed by the raster bitmaps for the characters. A font for a printer begins with a PRINTERFONTHEADER structure that specifies which of two formats the font data has. This structure is followed by control sequences that initialize and define the font.

For a full description of these structures, see Section 6.7, “Structures.”