FONT (FON Files)

These LFD resources store a proportional character set, which may be incomplete.

I found two examples : font6 and font8.

Note: the .fon extension is a convention adopted by add-on developers when writing conversion programs, there are no real FON files in DARK FORCES. There are FNT files however, which are quite different !

FON_Header IS

{

First int // First character in font
Last int // Last character in font
u1 int // 8, could be bits per char line
Height int // Height of Chars
u2 int // could be average Width
  // or the minimal Width to use
pad1 byte[2] // 2 times 0x00

}

Then follows a block of (Last-First+1) bytes (one per character), which code the width of the corresponding character.

FON_Characters_Widths IS

{

Widths byte[Last-First+1] // each byte is the width of one
  // character

}

Then each character is described in turn:

FON_Character IS

{

Bitmap Byte[Height] // Height bytes for each character

}

Now the funny part: each of these bytes is a bitmap representation of a line of the character. A bit set correspond to a pixel drawn on the screen.

For example, if the bytes are 48h, FCh, 48h, FCh, 48h, 00h

this gives

48h .X..X...
FCh XXXXXX..
48h .X..X...
FCh XXXXXX..
48h .X..X...
00h ........

Which is the # character.

Note that the width as referenced in the FON_Characters_Widths array would be 6 for this character.

In fact, FON_Characters_Widths must be used to determine where on the screen to draw the next character.