Font description file format

To create and use a hgeFont object you will need a couple of files that describe your font.

Font description file

This file must be passed to the hgeFont constructor. It is just plain text file that contains specification for all the font symbols.

The first line should contain the font description file marker:

[HGEFONT]

The font bitmap file name should follow (the path is relative to the description file itself):

Bitmap=font_bitmap.png

Then should follow descriptions for each character in the font:

Char=" ",1,1,3,30,-1,4
Char="!",5,1,7,30,1,0
Char=""",13,1,8,30,3,2
...
Char=FE,445,187,17,30,0,0
Char=FF,463,187,16,30,-2,-1

The first value in a line specifies the character to be described. This can be a character itself within double quotes or it's hexadecimal code.

Then follow four numbers, defining the character placing on the font bitmap: X-coordinate, Y-coordinate, character's width and character's height.

The last two numbers define horizontal position offsets when rendering the character in a line of text. First is offset before the character, second is offset after the character. The offsets can be negative. These allow usage of italic, script and artistic fonts.

The complete font description file may look like this:

[HGEFONT]

Bitmap=font_bitmap.png

Char=" ",1,1,3,30,-1,4
Char="!",5,1,7,30,1,0
Char=""",13,1,8,30,3,2
...
Char=FE,445,187,17,30,0,0
Char=FF,463,187,16,30,-2,-1

Font bitmap file

This file must hold the images of all the symbols, specified in the font description file. The font bitmap file dimensions must be a power of 2.

See also

Bitmap Font Builder