Font File (.fnt)
The font file contains the X and Y coordinates used in drawing text labels and values.
FORMAT
The format of the file is:
num char0 x0 y0 x1 y1 ... 255 char1 x0 y0 x1 y1 ... 255 ... charx x0 y0 x1 y1 ... 254 c0 c1 c2 c3 ... ... c254 c255
Where:
- num -- The total number of X,Y points in the font. This total includes X, Y (each X Y pair is considered 2) and terminator values.
- char0 -- The first character in the font. This will be an ASCII character. This is ignored by WXP but is handy for debugging.
- x0 y0 -- This is a X,Y coordinate pair. The possible values for a draw
coordinate are 0 to 127 in X and 0 to 160 in Y. The values for a move coordinate are 128
to 253 in X and 0 to 160 in Y. The character is drawn by connecting X,Y points. There are
two operations:
MOVE: This moves, but does not draw to a new X,Y location. A move coordinate is specified by adding 128 to the X coordinate.
DRAW: This draws a line from the previous point to the current one. The X and Y coordinates are taken literally.
The Y coordinate is defined as follows:
TOP 160
CAP 140
HALF 85
BASE 35
BOTTOM 0
Most letters are defined as extending from base to cap. Descendents fall to the bottom value. Some characters such as parentheses () extend above and below the cap and base. The total vertical height is 105 and this value is the divisor for character height.
- 255 -- Specifies that this is the end of this particular character. The terminator on the last character in the font is 254.
- c0 c1 c2 ... c255 -- The character lookup table. This gives the offset into the character table for the beginning of each character. This table has 256 values in, one for each possible character in the font. If the character is not defined in the X, Y table, the offset value is -1.
EXAMPLES
A sample of the modern.fnt file looks like:
2221 ! 133 140 5 70 133 45 0 40 5 35 10 40 5 45 255 " 128 140 0 105 168 140 40 105 255 # 168 160 5 0 198 160 35 0 133 95 75 95 128 65 70 65 255 $ 153 160 25 15 173 160 45 15 198 125 60 135 45 140 25 140 10 135 0 125 0 115 5 105 10 100 20 95 50 85 60 80 65 75 70 65 70 50 60 40 45 35 25 35 10 40 0 50 255 % 218 140 0 35 153 140 35 130 35 120 30 110 20 105 10 105 0 115 0 125 5 135 15 140 25 140 35 135 50 130 65 130 80 135 90 140 198 70 60 65 55 55 55 45 65 35 75 35 85 40 90 50 90 60 80 70 70 70 255 & 228 95 100 100 95 105 90 105 85 100 80 90 70 65 60 50 50 40 40 35 20 35 10 40 5 45 0 55 0 65 5 75 10 80 45 100 50 105 55 115 55 125 50 135 40 140 30 135 25 125 25 115 30 100 40 85 65 50 75 40 85 35 95 35 100 40 100 45 255 ' 128 140 0 105 255 ... ~ 128 75 0 85 5 100 15 105 25 105 35 100 55 85 65 80 75 80 85 85 90 95 128 85 5 95 15 100 25 100 35 95 55 80 65 75 75 75 85 80 90 95 90 105 255 _ 128 10 50 10 254 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 15 24 41 90 149 218 223 244 265 278 287 304 309 320 325 360 369 398 429 440 475 522 531 590 637 658 685 692 701 708 747 802 815 858 895 924 941 954 997 1010 1015 1036 1049 1058 1075 1088 1131 1156 1203 1232 1273 1282 1303 1312 1329 1338 1349 1362 1379 1384 1401 2217 1410 1421 1454 1487 1516 1549 1584 1599 1642 1661 1676 1697 1710 1715 1748 1767 1802 1835 1868 1883 1918 1933 1952 1961 1978 1987 2004 2017 2092 2097 2172 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
The sample file has 2221 values in the character table. The first character is '!'. Here is a summary of its points:
- move to 5,140
- draw to 5,70
- move to 5,45
- draw to 0,40
- draw to 5,35
- draw to 10,40
- draw to 5,45
- terminator
The lookup table specifies that characters 0 through 32 are not defined (-1). The space character (32) is automatically defined and need not be in the font file. The first defined character is 33, ! and it starts at value 0. The second defined character 34, " starts at value number 15. The first character has 7 X,Y points and a terminator for a total of 15 values.
SEE ALSO
Last updated May 10, 2020