home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / console-tools / file-formats / cp next >
Encoding:
Text File  |  1999-04-08  |  2.6 KB  |  87 lines

  1.             The CP file-format
  2.  
  3.         (C) 1997 Yann Dirson <dirson@debian.org>
  4.  
  5.  
  6.  This file documents the CP font-file-format, as understood by version 0.94
  7. and above of the Linux console utilities ('kbd').
  8.  
  9.  This file has revision number 1.0, and is dated 1997/09/02.
  10.  Any useful additionnal information on CP files would be great.
  11.  
  12.  
  13. 0. Changes
  14.  
  15. 1998/08/20: updated author's e-mail.
  16.  
  17.  
  18. 1. Summary
  19.  
  20.  CP files are usually generated by codepage(1) from MS-DOS CPI files.
  21.  
  22.  The CP file format is an awful thing. It was intended (IMHO) to be an easy
  23. mean of using MS-DOS CPI font-files (see "cpi" file). They are generated by
  24. the codepage(1) program, which just copies some headers from the CPI file,
  25. without even changing a byte of their contents, and the font data
  26. corresponding to a given code-page.
  27.  
  28.  Especially, the following things are erroneous:
  29. - next_header_offset (should be 0, is only 0 for the last codepage in the CPI
  30.  file)
  31. - font_offset (should be 53, which is even found in no MS-DOS-distributed
  32.  CPI, as they store all headers first, and then all font_data)
  33.  
  34.  setfont(1) assumes when reading them that contain fonts of heights 08, 14
  35. and 16, for one particular MS-DOS code-page, and wisely ignores the headers;
  36. however, the only CP files that will be accepted by setfont(1) are those that
  37. effectively contain the requested font sizes (setfont checks the file size
  38. for this). 
  39.  In particular, CP files generated by codepage(1) from MS-DOS'
  40. {ega,ega2,ega3}.cpi should be OK. Those generated from iso.cpi WILL NOT, as
  41. they will only contain size 16 (anyway, they won't be recognized as CP files
  42. by setfont).
  43.  
  44.  
  45. 2. History
  46.  
  47.  Unknown. But this horror probably appeared with codepage(1).
  48.  
  49.  
  50. 3. Known programs understanding this file-format.
  51.  
  52.  The following program in the Linux console utilities can read and/or write
  53. PSF files:
  54.  
  55.     setfont (R)
  56.     codepage (R/W)
  57.  
  58.  
  59. 4. Technical data
  60.  
  61.  The file format is described here in sort-of EBNF notation. Upper-case
  62. WORDS represent terminal symbols, ie. C types; lower-case words represent
  63. non-terminal symbols, ie. symbols defined in terms of other symbols.
  64.  [sym] is an optional symbol
  65.  {sym} is a symbol that can be repeated 0 or more times
  66.  {sym}*N is a symbol that must be repeated N times
  67.  Comments are introduced with a # sign.
  68.  
  69.  
  70. #
  71.  
  72. cp_file =
  73. (off = 0)    cp_entry_header
  74. (off = 28)    cp_info_header
  75. (off = 34)    cp_fontdata
  76.  
  77.  
  78. # All refered symbols are defined in file "cpi"
  79.  
  80.  Invariants in headers of files usable by setfont provide a "magic":
  81.  
  82. offset    type        value
  83. 6    short+char*8    "\001\000EGA     "    # driver    - seems the best way to detect it
  84. 0    short        28        # header size        \
  85. 30    u_short        3        # nb of fonts        -| these just provide more checks
  86. 32    u_short        9746        # size of font_data    /
  87.