The tcDspFont class allows various fixed and proportional fonts to be defined for use (with tcDspDisplay, for example). All fonts are 1 bits per pixel.
This is a simple example of tcDspFont creation and usage:
#define START_CHAR 32 #define CHARS_PER_FONT 96 // start at 32... // small font is 7x7 array with single decender #define SMALLFONT_HEIGHT 8 #define SMALLFONT_MAXWIDTH 7 #define BYTES_PER_SMALLFONT \ (SMALLFONT_HEIGHT * ((SMALLFONT_MAXWIDTH + 7) / 8)) // narrow font is 7x4 array with single decender #define NARROWFONT_HEIGHT 8 #define NARROWFONT_MAXWIDTH 4 #define BYTES_PER_NARROWFONT \ (NARROWFONT_HEIGHT * ((NARROWFONT_MAXWIDTH + 7) / 8)) // med font is 11x18 with 3 pixel decenders #define MEDFONT_HEIGHT 14 #define MEDFONT_MAXWIDTH 18 #define BYTES_PER_MEDFONT \ (MEDFONT_HEIGHT * ((MEDFONT_MAXWIDTH + 7) / 8)) { unsigned char SmallFontBitmaps[CHARS_PER_FONT][BYTES_PER_SMALLFONT] = { #include "smallfnt.bit" }; int SmallFontWidth[CHARS_PER_FONT] = { #include "smallfnt.wid" }; unsigned char NarrowFontBitmaps[CHARS_PER_FONT][BYTES_PER_NARROWFONT] = { #include "nrrwfnt.bit" }; int NarrowFontWidth[CHARS_PER_FONT] = { #include "nrrwfnt.wid" }; unsigned char MedFontBitmaps[CHARS_PER_FONT][BYTES_PER_MEDFONT] = { #include "medfnt.bit" }; int MedFontWidth[CHARS_PER_FONT] = { #include "medfnt.wid" }; tcDspFont *small, *medium, *narrow; // create fonts to use on display small = new tcDspFont ("small", START_CHAR, CHARS_PER_FONT, BYTES_PER_SMALLFONT, SMALLFONT_HEIGHT, SmallFontWidth, &SmallFontBitmaps[0][0]); medium = new tcDspFont ("medium", START_CHAR, CHARS_PER_FONT, BYTES_PER_MEDFONT, MEDFONT_HEIGHT, MedFontWidth, &MedFontBitmaps[0][0]); narrow = new tcDspFont ("narrow", START_CHAR, CHARS_PER_FONT, BYTES_PER_NARROWFONT, NARROWFONT_HEIGHT, NarrowFontWidth, &NarrowFontBitmaps[0][0]); ... }