Name
FONT (NFNT)
Synopsis
FONT ID <FontResourceId.n> FONTID <FontId.n> <FontFileName.s>FONT file format
The file containing the font information is plain ASCII. To understand how it works it is first necessary to understand how a font is arranged in memory. A font consists of four main parts: a header, a bitmap image, a bitmap location table, and an offset/width table. The bitmap image and location table are generated for you automatically.
The ASCII file consists of two parts: the header and the font data (glyph objects). A full font file is provided with the PilRC distribution.
The FONT header has the following fields:
- fontType
The purpose of this field is unknown. The ROM fonts define this value to be 36864.
- maxWidth
Defined as “maximum character width.” If not set, it is automatically set to the width of the widest character.
- kernMax
Defined as “negative of maximum kern value.” The purpose of this field is unknown.
- nDescent
Defined as “negative of descent.” The purpose of this field is unknown, and is not used in the ROM fonts.
- fRectWidth
Defined as “width of font rectangle.” If not set, it is automatically set to the width of the widest character.
- fRectHeight
Defined as “height of font rectangle.” If not set, it is automatically set when the first glyph is defined.
All characters must be exactly this height.
- ascent
The number of rows that make up the ascending part of the glyphs. Ascent plus descent equals
fRectHeight. This value should be set.- descent
The number of rows that make ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access