403
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
byte encoding, the orientation field of the header defines whether pixels are
combined horizontally or vertically.
The drawings below illustrate how character bitmaps are stored in the font file. As
an example, characters of 10x14 size (in pixels) are used. Drawing A is for one
pixel/byte encoding, drawing B -- for 8 pixels/byte with vertical orientation, C --
for 8 pixels/byte with horizontal orientation. Notice that for cases B and C a portion
of some bytes used to store the bitmaps is unused. Offsets of bytes relative to the
beginning of the bitmap data are shown with a '+' sign.
Bitmap A takes 140 bytes. The first byte (+0) represents the pixel at the top left
corner of the bitmap. Subsequent bytes represent all other pixels and the order is
"left-to-right, top-to-bottom".
Bitmap B takes 20 bytes. The first byte encodes 8 vertically arranged pixels at the
top left corner of the bitmap. Subsequent bytes represent all other pixel groups
and the order is "left-to-right, top-to-bottom". There are 2 rows of bytes, and bits
6 and 7 of each byte in the second row are unused.
Bitmap C takes 28 bytes. The first byte encodes 8 horizontally arranged pixels at
the top left corner of the bitmap. Subsequent bytes represent all other pixel groups
and the order is "top-to-bottom, left-to-right". There are 2 columns of bytes, and
bits 2-7 of each byte in the second column are unused.
Searching for a character bitmap
Here is how a target character bitmap is found within the font file. Again, we are
using the example of the font file that contains characters '0'-'9' and 'A'-'Z'.
Supposing, we need to find the bitmap of character 'C' (code 0043H).
First, we need to see which code group code 004AH belongs to. We read the
num_of_groups field of the header to find out how many code groups are
contained in the font file. The field tells us that there are two groups.
Next, we start reading the code groups table (located at file 00000010H),
entry by entry, in order to determine which code group the target character belong
to. The first group starts from code 0030H and contains 10 character. Therefore,
target character doesn't belong to it. The second group starts from code 0041H
and contains 26 characters. The target code is 0043H. Therefore, target character
belongs to this second group.
Next, we find the corresponding entry in the bitmap offset table. For this, we do a