Font file format

The font can be broken down into the following sections:-

Signature
Header info
Character map
Font metrics
Font encoding
Signature
T.B.S, will be designed to fit in with a global Protea standard
Header Info
{
WORD cell_height;
WORD ascent;
WORD descent;
BYTE uline_pos;
UBYTE uline_hgt;
WORD section_count;
UWORD flags;
TEXT name[PRF_NAME_SIZE];
}
Character map
List of section_count of following structure specifying sections of the character space that contain characters. (Note, it is assumed there will be very large empty sections so a solid block of characters with holes would be very inefficient).
{
WORD start;
WORD end;
}
Font metrics
{
BYTE leftAdjust;	// Adjustment for left hand side of the character cell
BYTE rightAdjust; // Adjustment for right hand side of the character cell
WORD ascent;	// Ascent of top of character cell from print position
WORD height;	// Height of character cell
WORD move;		// Amount to move the print position
LONG offset;	// Offset of character encoding from start of encoding data
}
Font encoding
The font encoding is compacted together with no bit alignement within each character, although each character will start on a byte boundary. Each section of encoding is preceeded by a count that specifies either the number of times the next line will repeat or the number of non-repeating lines to read before another count is encountered. The count is stored in 5 bits, if the first is set the count is a count of non-repeating lines following, if the bit is clear the count specifies the number of times to repeat the following line.

Example of encoding.
XXX.....XXX
.X.......X.
.X.......X.
.X.......X.
.XXXXXXXXX.
.X.......X.
.X.......X.
.X.......X.
XXX.....XXX

First count could either be specified as a repeat of 1 or 1 non-repeating scan line, followed by 11 bits of picture data (XXX.....XXX). Then a repeat count of 3 followed the next 11 bits of picture data specifying the line to repeat (.X.......X.). Then again either a repeat of 1 or a non-repeat count of 1 followed by the picture data (.XXXXXXXXX.). Another repeat of 3 and the picture data (.X.......X.), and a repeat of non-repeat count of 1 and the final line of picture data (XXX.....XXX).
The total storage space for this example would be 80 bits (10 bytes), .Made up of 5x5bits of count info + 5x11 bits of picture info.