home *** CD-ROM | disk | FTP | other *** search
- The CP file-format
-
- (C) 1997 Yann Dirson <dirson@debian.org>
-
-
- This file documents the CP font-file-format, as understood by version 0.94
- and above of the Linux console utilities ('kbd').
-
- This file has revision number 1.0, and is dated 1997/09/02.
- Any useful additionnal information on CP files would be great.
-
-
- 0. Changes
-
- 1998/08/20: updated author's e-mail.
-
-
- 1. Summary
-
- CP files are usually generated by codepage(1) from MS-DOS CPI files.
-
- The CP file format is an awful thing. It was intended (IMHO) to be an easy
- mean of using MS-DOS CPI font-files (see "cpi" file). They are generated by
- the codepage(1) program, which just copies some headers from the CPI file,
- without even changing a byte of their contents, and the font data
- corresponding to a given code-page.
-
- Especially, the following things are erroneous:
- - next_header_offset (should be 0, is only 0 for the last codepage in the CPI
- file)
- - font_offset (should be 53, which is even found in no MS-DOS-distributed
- CPI, as they store all headers first, and then all font_data)
-
- setfont(1) assumes when reading them that contain fonts of heights 08, 14
- and 16, for one particular MS-DOS code-page, and wisely ignores the headers;
- however, the only CP files that will be accepted by setfont(1) are those that
- effectively contain the requested font sizes (setfont checks the file size
- for this).
- In particular, CP files generated by codepage(1) from MS-DOS'
- {ega,ega2,ega3}.cpi should be OK. Those generated from iso.cpi WILL NOT, as
- they will only contain size 16 (anyway, they won't be recognized as CP files
- by setfont).
-
-
- 2. History
-
- Unknown. But this horror probably appeared with codepage(1).
-
-
- 3. Known programs understanding this file-format.
-
- The following program in the Linux console utilities can read and/or write
- PSF files:
-
- setfont (R)
- codepage (R/W)
-
-
- 4. Technical data
-
- The file format is described here in sort-of EBNF notation. Upper-case
- WORDS represent terminal symbols, ie. C types; lower-case words represent
- non-terminal symbols, ie. symbols defined in terms of other symbols.
- [sym] is an optional symbol
- {sym} is a symbol that can be repeated 0 or more times
- {sym}*N is a symbol that must be repeated N times
- Comments are introduced with a # sign.
-
-
- #
-
- cp_file =
- (off = 0) cp_entry_header
- (off = 28) cp_info_header
- (off = 34) cp_fontdata
-
-
- # All refered symbols are defined in file "cpi"
-
- Invariants in headers of files usable by setfont provide a "magic":
-
- offset type value
- 6 short+char*8 "\001\000EGA " # driver - seems the best way to detect it
- 0 short 28 # header size \
- 30 u_short 3 # nb of fonts -| these just provide more checks
- 32 u_short 9746 # size of font_data /
-