Skip to content
Snippets Groups Projects
Commit 5d07bf02 authored by deuce's avatar deuce
Browse files

Add notes on TheDraw .TDF font format.

parent c1cad148
No related branches found
No related tags found
No related merge requests found
<dig dig dig>
It does use pascal strings...
struct TDHeader {
/* Pascal string [23] - TheDraw Font signature */
/* There may be unknown data after this string instead of a 23 char string */
unsigned char sig_len;
char sig[23];
/* Pascal string [16] - Font name */
unsigned char name_len;
char name[16];
unsigned char font_type; /* 0=outline,
* 1=Block (mono)
* 2=Block(colour)
*/
unsigned char font_spaces; /* Spaces between each letter */
unsigned short font_data_len; /* Total bytes in the font data... file
* size is font_data_len+233
*/
unsigned short chartable[94]; /* Offsets to character start from end of
* header ie:
* fseek(file, chartable[x]+233, SEEK_SET);
*/
};
So basically:
string[23]
string[16]
byte
byte
word
word[94]
Is the header... which is 233 bytes long.
sizeof(struct TDHeader)==233;
Now on to the font data...
index into the chartable array is asc(char)-asc("!") ie: ! is the first char.
The char data starts at file offset 233+chartable[char].
At that position are two bytes, the X and Y extents in that order for that char.
Following that is a series of font data **rows** each row is terminated by an
ASCII 10 (\x0a). The character data is terminated by an ASCII NULL (\x00)
This is true for all three font types. The meaning of each char however varies
as follows:
0) Outline fonts:
Each char *MUST* be between 'A' and 'Q'. Any other char is translated as an
empty space.
A: Horiz. Line #1
B: Horiz. Line #2
C: Vertical Line #1
D: Vertical Line #2
E: Top-left corner #1
F: Top-right corner #1
G: Top-left corner #2
H: Top-right corner #2
I: Bottom-left corner #1
J: Bottom-right corner #1
K: Bottom-left corner #2
L: Bottom-right corner #2
M: Left-facing tee
N: Right-facing tee
O: UNKNOWN
P: UNKNOWN
Q: UNKNOWN
I note that the Up-facing and Down-facing tees are absent and speculate that
they are O and P but have no hard evidence of this. If anyone has a TD
outline font editor, I would be happy to get a sample of a font using them.
I also suspect that Q is a blank space.
1) Block fonts
Each char is the ASCII value that should be displayed at this point.
2) Block colour fonts
Each char has an attribute, in char, attribute format. The newlines and NULL
terminator do NOT have an attribute byte... be carefull.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment