CHR Format
Intel byte order

Information from File Format List 2.0 by Max Maischein.

--------!-CONTACT_INFO----------------------
If you notice any mistakes or omissions, please let me know!  It is only
with YOUR help that the list can continue to grow.  Please send
all changes to me rather than distributing a modified version of the list.

This file has been authored in the style of the INTERxxy.* file list
by Ralf Brown, and uses almost the same format.

Please read the file FILEFMTS.1ST before asking me any questions. You may find
that they have already been addressed.

         Max Maischein

Max Maischein, 2:244/1106.17
Max_Maischein@spam.fido.de
corion@informatik.uni-frankfurt.de
Corion on #coders@IRC
--------!-DISCLAIMER------------------------
DISCLAIMER:  THIS MATERIAL IS PROVIDED "AS IS".  I verify the information
contained in this list to the best of my ability, but I cannot be held
responsible for any problems caused by use or misuse of the information,
especially for those file formats foreign to the PC, like AMIGA or SUN file
formats. If an information it is marked "guesswork" or undocumented, you
should check it carefully to make sure your program will not break with
an unexpected value (and please let me know whether or not it works
the same way).

Information marked with "???" is known to be incomplete or guesswork.

Some file formats were not released by their creators, others are regarded
as proprietary, which means that if your programs deal with them, you might
be looking for trouble. I don't care about this.
--------------------------------------------

The CHR files are scalable fonts used by the Borland graphics interface
(BGI) to display fonts in graphics mode.
OFFSET              Count TYPE   Description
0000h                   4 char   ID='PK',08,08
0004h                   4 char   ID='BGI '
0008h                   ? char   Font description, terminated with #26
0008h                   1 word   Headersize
+????                            ="SIZ"
                        4 char   Internal font name
                        1 word   Font file size in bytes
                        1 byte   Font driver major version
                        1 byte   Font driver minor version
                        1 word   0100h
                    "SIZ" word   Zeroes to pad out the header
0080h                   1 char   Signature byte, '+' means stroke font
0081h                   1 word   Number of chars in font file
                                 ="NUM"
0083h                   1 byte   undefined
0084h                   1 byte   ASCII value of first char in file
0085h                   1 word   Offset to stroke definitions
0087h                   1 byte   Scan flag ??
0088h                   1 byte   Distance from origin to top of capital
0089h                   1 byte   Distance from origin to baseline
008Ah                   1 byte   Distance from origin to bottom descender
008Bh                   4 char   Four character name of font
0090h               "NUM" word   Offsets to character definitions
0090h+              "NUM" byte   Width table for the characters
"NUM"*2
0090h+                           Start of character definitions
"NUM"*3

The individual character definitions consist of a variable number of words
describing the operations required to render a character. Each word
consists of an (x,y) coordinate pair and a two-bit opcode, encoded as shown
here:

Byte 1          7   6   5   4   3   2   1   0     bit #
               op1  <seven bit signed X coord>

Byte 2          7   6   5   4   3   2   1   0     bit #
               op2  <seven bit signed Y coord>

          Opcodes

        op1=0  op2=0  End of character definition.
        op1=0  op2=1  Do scan
        op1=1  op2=0  Move the pointer to (x,y)
        op1=1  op2=1  Draw from current pointer to (x,y)

EXTENSION:CHR
OCCURENCES:PC
PROGRAMS:Borland Pascal, Borland C
REFERENCE:BGIKIT.ZIP
SEE ALSO:
VALIDATION:
