AAF File Format
The AAF file format stores bitmap fonts used by Fallout and Fallout 2. This page describes the English-version files; localized releases may contain variations that are not covered here.
An AAF file stores one glyph descriptor for each of the 256 byte values. Glyphs are usually proportional: each glyph has its own width and height. The glyph bitmap is stored as one byte per pixel, with values in the range 0 through 9.
0means the pixel is transparent.1through9represent relative brightness, with9being the brightest. The brightness scale does not appear to be linear.
The following bitmap is a glyph from FONT1.AAF representing the character b (ASCII 98):
77
77
777763
77 76
77 77
77 76
777763
Pixels with value 0 are omitted because they are transparent. The values 7 and 6 mark brighter parts of the glyph, while 3 is dimmer and appears around the rounded corners.
All integer fields are stored in Motorola / big-endian byte order. The file starts with a 12-byte header followed by 256 glyph descriptors. Each descriptor is 8 bytes: width, height, and an offset relative to the start of the glyph data block. The glyph data block starts at 0x000C + 256 * 8 = 0x080C.
AAF viewer
The viewer below reads an uploaded .aaf file, validates the header and glyph descriptors, and renders both a text preview and a 256-slot glyph grid. Pixel values are shown as brightness levels of the selected foreground color.
| Maximum glyph height | - |
| Horizontal gap | - |
| Space width | - |
| Vertical gap | - |
| Glyph data size | - |
Text preview
Glyph grid
| Offset | Bytes | Data Type | Description |
|---|---|---|---|
| 0x000 | 4 | char[4] = "AAFF" | Signature used to identify the file type. |
| 0x004 | 2 | unsigned short | Maximum glyph height, including ascenders and descenders. |
| 0x006 | 2 | unsigned short | Horizontal gap, in pixels, added between adjacent glyphs. |
| 0x008 | 2 | unsigned short | Width, in pixels, used for the space character. |
| 0x00A | 2 | unsigned short | Vertical gap, in pixels, added between two lines of glyphs. |
| 0x00C | 2 | unsigned short | Width, in pixels, of glyph 0. |
| 0x00E | 2 | unsigned short | Height, in pixels, of glyph 0. |
| 0x010 | 4 | unsigned long | Offset of glyph 0, relative to the glyph data block at 0x080C. If width * height = 0, this can be the offset of the next non-empty glyph. |
| 0x014 | 2 | unsigned short | Width, in pixels, of glyph 1. |
| 0x016 | 2 | unsigned short | Height, in pixels, of glyph 1. |
| 0x018 | 4 | unsigned long | Offset of glyph 1, relative to the glyph data block at 0x080C. |
| 0x01C | (2 + 2 + 4) * (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. Pixels are stored left to right, then top to bottom. Each pixel is one byte in the range 0 through 9. |
| 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 through 255, as described above. |
Parsing notes
The AAFF signature identifies the file type. After the 12-byte header, the descriptor table always contains 256 entries and therefore always ends at 0x080C. Descriptor offsets are relative to this glyph data block, not to the beginning of the file.
Each glyph consumes width * height bytes. A NULL glyph has no pixel data of its own, and its offset can be the same as the next glyph with data, so readers should use width and height to decide whether to read pixels.
AAF stores glyph brightness, not final palette colors. At render time, the engine blends each non-zero pixel value with the selected text color.
Runtime notes
In Fallout 2 CE, the AAF loader attempts to load interface fonts named font0.aaf, font1.aaf, and so on. The interface font manager exposes AAF fonts as font ids 100 through 110, separate from the FON text font manager.
When rendering a string, a space character uses the header's space width field instead of the width in glyph descriptor 32. Each character advances by its character width plus the horizontal gap. The line height reported by the engine is the maximum glyph height plus the vertical gap.
Glyph pixels are bottom-aligned within the maximum glyph height. If a glyph is shorter than the maximum height, rendering skips the difference before drawing that glyph's rows.
AAF and FON comparison
| Feature | AAF | FON |
|---|---|---|
| Typical role | Interface font manager | Low-numbered text font manager |
| Typical files | font0.aaf and other interface font files | font0.fon through font9.fon |
| Font id range | 100 through 110 in Fallout 2 CE | 0 through 9 in Fallout 2 CE |
| Glyph slots | Always 256 descriptor slots | Glyph count is stored in the file header |
| Pixel data | One byte per pixel; values 1 through 9 represent brightness levels | 1 bit per pixel; set bits draw the chosen text color |
| Integer byte order | Big-endian 16-bit and 32-bit integers | Little-endian 32-bit integers |
Source code
Fallout 2 Community Edition AAF interface font manager - C++
History
Fallout 2 Community Edition FON text font manager - C++
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)