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 / psf < prev    next >
Encoding:
Text File  |  1999-04-08  |  2.8 KB  |  103 lines

  1.             The PSF file-format
  2.  
  3.         (C) 1997 Yann Dirson <dirson@debian.org>
  4.  
  5.  
  6.  This file documents the PSF font-file-format, as understood by version 0.94
  7. and above of the Linux console utilities ('kbd'). This file makes obsolete
  8. the old `psffile.doc'.
  9.  
  10.  This file has revision number 1.1, and is dated 1998/04/20.
  11.  Any useful additionnal information on PSF files would be great.
  12.  
  13.  
  14. 0. Changes:
  15.  
  16. 1998/08/20: updated author's e-mail.
  17. 1998/08/20: History of the format from hpa himself.
  18. 1998/08/20: Fixed `filemode' description from hpa's input.
  19.  
  20.  
  21. 1. Summary
  22.  
  23.  PSF stands for PC Screen Font.
  24.  
  25.  A PSF file basically contains one character-font, whose width is 8 pixels,
  26. ie. each scanline in a character occupies 1 byte.
  27.  
  28.  It may contain characters of any height between 0 and 255, though character
  29. heights lower than 8 or greater than 32 are not attested to exist or even be
  30. useful [more info needed on this].
  31.  
  32.  Fonts can contain either 256 or 512 characters.
  33.  
  34.  The file can optionnally contain a unicode mapping-table, telling, for each
  35. character in the font, which UCS2 characters it can be used to display.
  36.  
  37.  The "file mode" byte controls font size (256/512) and whether file contains
  38. a unicode mapping table.
  39.  
  40.  
  41. 2. History
  42.  
  43.  The PSF file format was designed by H. Peter Anvin
  44. <hpa@transmeta.com> in 1989 or so for his DOS screen font editor,
  45. FONTEDIT.EXE. When he became involved with Linux, he used it for the
  46. Linux font stuff he worked with, released a binary of FONTEDIT.EXE for
  47. free distribution, and added the Unicode table to the spec.
  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/W)
  56.     psfaddtable (R/W)
  57.     psfstriptable (R/W)
  58.     psfgettable (R)
  59.  
  60.  
  61. 4. Technical data
  62.  
  63.  The file format is described here in sort-of EBNF notation. Upper-case
  64. WORDS represent terminal symbols, ie. C types; lower-case words represent
  65. non-terminal symbols, ie. symbols defined in terms of other symbols.
  66.  [sym] is an optional symbol
  67.  {sym} is a symbol that can be repeated 0 or more times
  68.  {sym}*N is a symbol that must be repeated N times
  69.  Comments are introduced with a # sign.
  70.  
  71.  
  72. # The data (U_SHORT's) are stored in LITTLE_ENDIAN byte order.
  73.  
  74. psf_file =    psf_header
  75.         raw_fontdata
  76.         [unicode_data]
  77.         
  78.  
  79. psf_header =    CHAR = 0x36  CHAR = 0x04    # magic number
  80.         filemode
  81.         fontheight
  82.         
  83. fontheight =    CHAR        # measured in scan lines
  84. filemode =    CHAR        # 0 : 256 characters, no unicode_data
  85.                 # 1 : 512 characters, no unicode_data
  86.                 # 2 : 256 characters, with unicode_data
  87.                 # 3 : 512 characters, with unicode_data
  88.  
  89. #
  90.  
  91. raw_fontdata =    {char_data}*<fontsize>
  92.  
  93. char_data =    {BYTE}*<fontheight>
  94.  
  95. #
  96.  
  97. unicode_data =    { unicode_array psf_separator }*<fontsize>
  98.  
  99. unicode_array =    { unicode }                # any necessary number of times
  100.  
  101. unicode =    U_SHORT                    # UCS2 code
  102. psf_separator =    unicode = 0xFFFF
  103.