Code Page Font Files

 DOS 3.3+ device drivers which support code page switching (via Fn 44H
 IOCTL commands) read specially-formatted data files in order to prepare a
 device to handle a selected code page font.  These .CPI files are in the
 following format:

    font library name
    offset of FontInfo
       pointer to next CodePageInfo header
       device type (display or printer) and subtype (EGA, LCD, etc.)
       CodePage number.  See Code Page
       offset of FontData Header for this code page

    FontDataHdrRec        FontData Header
      number of fonts defined
      Font 1 data (ScreenFontDataRec or PrinterFontDataRec)
      Font 2 data
      Font n

  The following describes the structures used in .CPI files:

  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
   +0      8  abSig        font library identifier: ffH,'FONT',20H,20H,20H
   +8      8  res          8 bytes reserved; must be 00
  +10H     2  wPtrCnt      Count of pointers in hdr (0001 for DOS 3.3-6.0)
  +12H     1  bPtrType     Type of info pointer (use 01 for DOS 3.3-6.0)
  +15H     4  lOffset      DWORD file offset of a FontInfoRec
          23               size of a FontLibHdrRec (designed to be longer,
                           but DOS 3.3-6.0 define only one font).

  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
   +0      2  wCpEntryCnt  number of CpEntryHdrRecs to follow
           2               size of a FontInfoHdrRec

  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
   +0      2  wCpEntryCnt  number of CpEntryHdrRecs to follow
   +2      2  wLen         size of this structure, in bytes
   +4      4  lNextCpEH    DWORD file offset of next CpEntryHdrRec
                           (0000 0000 indicates this is the last)
   +8      2  wDevType     device type (0001=display, 0002=printer)
  +0aH     8  abDevSubType device subtype and font file name;
                           left-justified, blank-padded.  For instance,
                           'EGA     ' means EGA.CPI.
  +12H     2  wCpID        code page number (e.g., 01b5H = 437 = US
  +14H     6  res          (6 bytes reserved, 0)
  +18H     4  lOffset      file offset of FontDataHdrRec for this code page
          24               length of a CpEntryHdrRec

  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
   +0      2  res          (reserved: must be 0001)
   +2      2  wFontCnt     number of fonts defined for this code page
   +4      2  wLen         total length of all following font definitions
           6               length of a FontDataHdrRec

  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
   +0      1  bCharHeight  lines per character (e.g., 0eH=14; 350-line mode)
   +1      1  bCharWidth   clms per character (usually 08)
   +2      1  bRelHeight   must be 00
   +3      1  bRelWidth    must be 00
   +4      2  wCharCnt     number of characters defined (e.g., 100H = 256)
   +6      ?  abFontData   pixel data.  Each character has (rows * clms)
                           bits, formatted row by row.  Thus, in a 14-row by
                           8-clm character, each byte defines one row so a
                           set of 14 bytes define one character.
          ?+6              length of a ScreenFontDataRec
                           (256 chars * 14) = 3584 = 0e00H total bytes.

  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
   +0      2  wSelType     0001=the rCtrlSeq selects the default (hardware)
                           font and the data that follows it contains codes
                           to select a downloaded font followed by down-
                           laodable data.  See below.
                           0002=the rCtrlSeq consists of a single sequence
                           of data to select a character set (for instance,
                           if it is supported in the hardware).
   +2      2  wSeqLength   size of the rCtrlSeq data (31 or less).
                           For wSelType=0001, this is the entire length.
                           For wSelType=0002, is just the length of the
                           first escape sequence (that selects the default
                           hardware font).

   +4      ?  rCtrlSeq     this data is in the form of a PrnSelType1Rec or a
          ?+4              length of a PrinterFontDataRec

  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
    +0     1  bResetLen    the length of the escape sequence which selects
                           the default (hardware) character set.
    +1     n  abResetData  the escape sequence to select the default
                           character set
  +n+1     1  bSelLen      the length of the escape sequence which selects
                           this character set (once the download has been
  +n+2     m  abSelData    escape codes to select this character set
+m+n+2     1  bDnldLen     the length of the download data that sets up this
                           character set.
+m+n+3     ?  abDnldData   bytes to download
          +?+m+n+3         length of a PrSelType1Rec structure

  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
    +0     ?  abSelData    the escape sequence to select this character set.
                           The length is in PrinterFontDataRec.wSeqLength

See Also: National Language Support
          fn 44H (IOCTL functions)
          fn 66H (code page switching)
          Code Page