-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaaf.html
143 lines (135 loc) · 5 KB
/
aaf.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<html>
<head>
<title>AAF File Format</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div style="width: 1200px; margin: auto;">
<h1>AAF File Format</h1>
<p>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.</p>
<p>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.</p>
<ul>
<li>0 means that the pixel is transparent.</li>
<li>The values 1 to 9 represent the relative brightness of that pixel, with 9 being the brightest. There does not appear to be a linear increase in brightness from values 1 to 9.</li>
</ul>
<p>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).</p>
<pre style="background: #222; margin: 10px; width: 80px; padding: 5px;">
77
77
777763
77 76
77 77
77 76
777763
</pre>
<p>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.</p>
<table style="background: #222; margin: 10px;">
<thead>
<tr>
<th style="width: 150px;">Offset</th>
<th style="width: 125px;">Bytes</th>
<th style="width: 150px;">Data Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>0x000</td>
<td>4</td>
<td>char[4] = "AAFF"</td>
<td>Signature used to identify file type. </td>
</tr>
<tr>
<td>0x004</td>
<td>2</td>
<td>unsigned short</td>
<td>Maximum glyph Height.This is the maximum height of the glyph, including ascenders and descenders.</td>
</tr>
<tr>
<td>0x006</td>
<td>2</td>
<td>unsigned short</td>
<td>Horizontal gap.Gap size (in pixels) between adjacent glyphs.</td>
</tr>
<tr>
<td>0x008</td>
<td>2</td>
<td>unsigned short</td>
<td>Width of space.The width of the space character.</td>
</tr>
<tr>
<td>0x00A</td>
<td>2</td>
<td>unsigned short</td>
<td>Vertical gap.The number of pixels between two lines of glyphs. </td>
</tr>
<tr>
<td>0x00C</td>
<td>2</td>
<td>unsigned short</td>
<td>GLYPH-0-WIDTH : Width of glyph 0.The width (in pixels) of the glyph corresponding to ascii 0.</td>
</tr>
<tr>
<td>0x00E</td>
<td>2</td>
<td>unsigned short</td>
<td>GLYPH-0-HEIGHT : Height of glyph 0.The height (in pixels) of the glyph corresponding to ascii 0.</td>
</tr>
<tr>
<td>0x010</td>
<td>4</td>
<td>unsigned long</td>
<td>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.</td>
</tr>
<tr>
<td>0x014</td>
<td>2</td>
<td>unsigned short</td>
<td>GLYPH-1-WIDTH : Width of glyph 1.</td>
</tr>
<tr>
<td>0x016</td>
<td>2</td>
<td>unsigned short</td>
<td>GLYPH-1-HEIGHT : Height of glyph 1. </td>
</tr>
<tr>
<td>0x018</td>
<td>4</td>
<td>unsigned long</td>
<td>Offset of glyph 1. You need add 0x080C to this value to getting REAL offset from begin of file. </td>
</tr>
<tr>
<td>0x01C</td>
<td>(2 + 2 + 2) * (256 - 2) </td>
<td></td>
<td>Descriptions of glyphs 2 through 255, as described above.</td>
</tr>
<tr>
<td>0x80C</td>
<td>GLYPH-0-WIDTH * GLYPH-0-HEIGHT</td>
<td>byte = [0..9]</td>
<td>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. </td>
</tr>
<tr>
<td>0x080C + (GLYPH-0-WIDTH * GLYPH-0-HEIGHT)</td>
<td>GLYPH-1-WIDTH * GLYPH-1-HEIGHT</td>
<td>byte = [0..9]</td>
<td>Pixel data for glyph 1.</td>
</tr>
<tr>
<td>0x080C + (GLYPH-0-WIDTH * GLYPH-0-HEIGHT) + (GLYPH-1-WIDTH * GLYPH-1-HEIGHT)</td>
<td>...</td>
<td>byte = [0..9]</td>
<td>Pixel data for glyphs 2 to 255, as described above. </td>
</tr>
</tbody>
</table>
<p>Note: All integers are in <a href="https://en.wikipedia.org/wiki/Endianness#Big-endian">Motorola / big-endian format.</a></p>
<h1 style="text-align: left;">History</h3>
<p>
2019-12-16 - Ported from <a href="https://falloutmods.fandom.com/wiki/AAF_File_Format">https://falloutmods.fandom.com/wiki/AAF_File_Format</a> by <a href="https://github.com/ghost2238">ghost</a><br/>
Patched by Anchorite ([email protected]) <br/>
Created by Noid ([email protected])
</p>
</div>