AAF File Format

The AAF Font File Format is used to store fonts in Fallouts 1 & 2. Only the AAF files used in the English versions are discussed here, there may or may not be variations for other languages.

The AAF file stores a separate glyph for each of the 256 position in the ASCII table. The fonts in an AAF file are typically non-fixed size, i.e. each glyph has it's own width and height. A glyph is defined by a rectangular bitmap representing the pixels of the glyph, corresponding to the way that it appears on the screen. Each pixel can have a possible value in the range of 0 to 9.

Here is an example of the bitmap of a glyph. This glyph is from the file FONT1.AAF and represents the character 'b' (ASCII 98).

  77    
  77    
  777763
  77  76
  77  77
  77  76
  777763

Pixels with value 0 are not shown as they are transparent. The higher numbers 7 and 6 represent the brighter parts of the glyph, while the 3 would be much duller in colour. This would be expected for the rounder corners of the b.

Offset Bytes Data Type Description
0x000 4 char[4] = "AAFF" Signature used to identify file type.
0x004 2 unsigned short Maximum glyph Height.This is the maximum height of the glyph, including ascenders and descenders.
0x006 2 unsigned short Horizontal gap.Gap size (in pixels) between adjacent glyphs.
0x008 2 unsigned short Width of space.The width of the space character.
0x00A 2 unsigned short Vertical gap.The number of pixels between two lines of glyphs.
0x00C 2 unsigned short GLYPH-0-WIDTH : Width of glyph 0.The width (in pixels) of the glyph corresponding to ascii 0.
0x00E 2 unsigned short GLYPH-0-HEIGHT : Height of glyph 0.The height (in pixels) of the glyph corresponding to ascii 0.
0x010 4 unsigned long Offset of glyph 0.The offset in this AAF file where the data for glyph 0 is stored.You need add 0x080C to this value to getting REAL offset from begin of file. Note: If GLYPH-x-WIDTH * GLYPH-x-HEIGHT = 0 (NULL glyph), then this value is offset of next "REAL" glyph.
0x014 2 unsigned short GLYPH-1-WIDTH : Width of glyph 1.
0x016 2 unsigned short GLYPH-1-HEIGHT : Height of glyph 1.
0x018 4 unsigned long Offset of glyph 1. You need add 0x080C to this value to getting REAL offset from begin of file.
0x01C (2 + 2 + 2) * (256 - 2) Descriptions of glyphs 2 through 255, as described above.
0x80C GLYPH-0-WIDTH * GLYPH-0-HEIGHT byte = [0..9] Pixel data for glyph 0. Contains the pixel data for the glyph. Each pixel in the glyph is represented by one byte, with possible values in the range 0 to 9. A value of 0 means the pixel is transparent, while values 1 to 9 represent different brightness values of the pixel (1 is dark and 9 is bright). Pixel data is starts at the top left corner of the glyph and increases left to right, then top to bottom.
0x080C + (GLYPH-0-WIDTH * GLYPH-0-HEIGHT) GLYPH-1-WIDTH * GLYPH-1-HEIGHT byte = [0..9] Pixel data for glyph 1.
0x080C + (GLYPH-0-WIDTH * GLYPH-0-HEIGHT) + (GLYPH-1-WIDTH * GLYPH-1-HEIGHT) ... byte = [0..9] Pixel data for glyphs 2 to 255, as described above.

Note: All integers are in Motorola / big-endian format.

History

2019-12-16 - Ported from https://falloutmods.fandom.com/wiki/AAF_File_Format by ghost
Patched by Anchorite (anchorite2001@yandex.ru)
Created by Noid (noid@888.nu)