Another feature of this engine is that it draws string faster than Ti-OS routines does. So, even if you don't use special font, you can use the HibDLL routines to draw string fast.
The datas
The datas of the font are stored in variables of the Ti, with the extension "FONT". One of this variable will describe only one size of font. In consequence, to describe the three Ti-OS fonts, three variables will be necessary.
The format of the variable is quite simple:
2B: the size of the variable (as for every variables)
2B: the version of description of the font variable format
1B: the maximum width of a caracter
1B: the maximum height of a caracter
1B: the width of the space between two caracters
1B: the code of the first described caracter
the table of width of caracter: table of 256-FisrtChar elements of 1B
the table of picture of caracter: table of 256-FisrtChar elements of ( height * (width / 8) ) Bytes
a string which describe the font (for example "TI-OS Font 1")
a string of the name of the author (for example "Me")
the FONT tag: "FONT\0\xF8"
Load a font
Before using a font, you have to load the font. In fact, it simply search the FONT variable, gets its handle, locks it, and fills the h_Font structure.
typedef struct { HANDLE h; unsigned char filename[18]; unsigned char * name; unsigned char x; unsigned char y; unsigned char charSpace; unsigned char firstChar; unsigned char * xTable; unsigned char * spriteTable; } h_Font;
So, because it locks the handle, you have to unload a font before leaving your software: use the macro \TiC{h_unloadFont(font)} to do it.
Load every font
Another way to load font is to use the h_loadAllFont function. It search in the Ti every FONT variable and store the h_Font structures in a table. Then when you want a specific font, you just have to use h_findFont which return the index of the table of the font you want.
The table is described by the folowing structure:
typedef struct { h_Font * tab; short nb; } h_FontTab;
By this way too, you have to unload every FONT by using the macro h_unloadAllFont(fonttab).