From MultimediaWiki
Jump to navigation Jump to search

This page is some preliminary in-progress documentation for the LucasArts Font format (LAF).


0x00|Number of characters         |4 bytes little endian
0x04|Raw font data size           |4 bytes little endian
0x08|Max character width (pixels) |4 bytes little endian
0x0C|Max character height (pixels)|4 bytes little endian
0x10|Unknown                      |4 bytes little endian
0x14|Unknown                      |4 bytes little endian
0x18|First character ASCII code   |4 bytes little endian
0x1C|Last character ASCII code    |4 bytes little endian

Character Code Table

After the preamble we have a table that contains the ASCII code for each character. Each such code is 2 bytes little endian, and there are as many codes as there are characters. The code at offset 0x20 + (i * 2) is the ASCII code of the i-th character, starting at i = 0.

Character Info Table

The character code table is followed by a table that contains information about each character. Each information block is 16 bytes, and contains several fields. There are as many information blocks as there are characters. The structure of an information block is as follows, with addresses relative to the block's address:

0x00|Bitmap data offset    |4 bytes little endian
0x04|Logical width (pixels)|1 byte
0x05|Unknown               |1 byte
0x06|Vertical offset       |1 byte signed
0x07|Unknown               |1 byte
0x08|Width (pixels)        |4 bytes little endian
0x0C|Height (pixels)       |4 bytes little endian
  • Bitmap data offset is the offset relative to the end of the character info table.
  • Logical width is the amount of space between the X coordinate and the next character, when drawing, as opposed to the Width field, which is the physical width, of the character's bitmap and it is only used to load the bitmap data itself.
  • Vertical offset is used to determine where exactly the character should appear vertically, relative to the Y coordinate, and it is usually the negative of the character's physical height.

Bitmap Data

The character info table is followed by a chunk of bitmap data. The chunk's size is the one advertised in the first field of the Preamble. A character's bitmap size is its width * height bytes, where each byte is one pixel color value. The bitmap lines are stored in the intuitive way; that is, the pixels of each line are stored left to right, and the lines are stored from top to bottom.