beautypg.com

Matrix Orbital GLT240128 Legacy User Manual

Page 28

background image

Table 8: Font File Header

Nominal Width

Height

ASCII Start Val

ASCII End Val

0x05

0x07

0x68

0x6A

Next we will have to find out how many bytes each character will use up, in order to create the character

table. The bitmaps are encoded horizontally and may have variable widths, h has a width of five, i a width
of three and j a width of four, see the figure below for an example of encoding the first letter h:

Bitmap Data

Byte

Hex Value

1

0

0

0

0

1

0

0

0

0

10000100

0x84

1

0

1

1

0

00101101

0x2D

1

1

0

0

1

10011000

0x98

1

0

0

0

1

11000110

0xC6

1

0

0

0

1

00100000

0x20

1

0

0

0

1

Figure 23: Bitmap Encoding

As you can see the letter h will take up five bytes with the last five bits being zero padded to form a full

byte. So if you continue the process you will get the character data as seen in table 5.1.2.

Character Data

Character Data

Byte Size (For Reference)

h

0x84

0x2D

0x98

0xC6

0x20

0x05

i

0x43

0x24

0x84

0x03

j

0x2D

0x98

0x19

0x60

0x04

The second part of the font file is the character table. The character table is comprised of three bytes for

every glyph in the font file.

The first two bytes represents the position, in bytes, of the glyph stored MSB LSB referenced from the

beginning of the file (including the header. The third byte is the width of the glyph in pixels. So because
there will be 0x09 bytes in the character table (three bytes for each glyph) and four bytes in the header
section, the first entry in the table will be 13, or 0x00 0x0D in hexadecimal, and 0x05 for the width.

To calculate the second entry in the character table, representing the position and width of the second

glyph, take the offset of the first entry and add the size of the first bitmap in bytes. Since the first glyph
occupies 0x05 bytes as seen in table 5.1.2 above, and the offset is 0x00 0x0D, the offset of the second entry
will be 0x00 0x12 and the width of the glyph is 0x03.

Calculate the third entry the same way as the second to get table 9 below.

Table 9: Character Table

High Offset (MSB)

Low Offset (LSB)

Character Width

h

0x00

0x0D

0x05

i

0x00

0x12

0x03

j

0x00

0x15

0x04

Matrix Orbital

GLT240128

23