Skip to Main Content
Fonts & Encodings
book

Fonts & Encodings

by Yannis Haralambous
September 2007
Intermediate to advanced content levelIntermediate to advanced
1040 pages
31h 23m
English
O'Reilly Media, Inc.
Content preview from Fonts & Encodings

A.2. The DOS World

A.2.1. The CPI Format

The DOS font format is CPI (for "Code Page Information", in the Microsoft sense; see page 45). The peculiarity of the CPI fonts is the fact that they contain several fonts, arranged first by code page, then by type size.

They are console fonts, therefore monospaced; what is more, they have a constant width equal to 8 pixels (which is equal to 8 bits, or 1 byte). Usually three sizes are found: 8, 14, and 16 pixels. Each font contains exactly 256 glyphs.

The structure of CPI fonts [91] is quite natural: there is a global heading, then the file is divided into sections corresponding to code pages (each with its own heading), themselves subdivided into subsections corresponding to the various available sizes, and each subsection again has its own heading and, finally, the bitmap data for the size in question.

The global heading is fixed:

    ff 46 4f 4e 54 20 20 20 00 00 00 00 00 00 00 00
    01 00 01 17 00 00 00 01 00

except for the last two bytes, which indicate the number of code pages supplied in the file (in this case, just one; the number 1 is written in little-endian order).

Next comes a section for each code page, with the following heading:

  • a fixed 2-byte number: 00 1c; a 4-byte pointer to the heading of the following code page (or ff ff ff ff); a 2-byte number with the value 1 (screen font) or 2 (printer font); an 8-byte ASCII string to indicate the type of screen/printer (for example, "EGA "); the Microsoft code-page number, written as ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Unicode Demystified

Unicode Demystified

Richard Gillam
Unicode Explained

Unicode Explained

Jukka K. Korpela
Blender 3D By Example - Second Edition

Blender 3D By Example - Second Edition

Oscar Baechler, Xury Greer

Publisher Resources

ISBN: 9780596102425Catalog PageErrata