Skip to content

5x7

5x7 fixed

The 5x7 fixed width font is a standard for many embedded applications. It is fairly compact and requires only 5 bytes per glyph.

Code

Model 100

There are many implementations, such as TRS80 Model 100 shown above and defined in hudson/model100/font.c, which has raw hex for each column. This is difficult to edit, but makes for a simple file:

  ['K']('K') = {0x00,0x7F,0x08,0x14,0x22,0x41},

AVR NTSC

For the NTSC system I needed to slice the characters the other way so that they can more quickly be retrieved and scanlines generated. github.com/osresearch/avr-video/font.c contains characters defined like this G:

[ 'G' + (0 << 7) ] = 0x3e, //   #####
[ 'G' + (1 << 7) ] = 0x63, //  ##   ##
[ 'G' + (2 << 7) ] = 0xc0, // ##
[ 'G' + (3 << 7) ] = 0xc0, // ##
[ 'G' + (4 << 7) ] = 0xcf, // ##  ####
[ 'G' + (5 << 7) ] = 0xc3, // ##    ##
[ 'G' + (6 << 7) ] = 0xc3, // ##    ##
[ 'G' + (7 << 7) ] = 0x63, //  ##   ##
[ 'G' + (8 << 7) ] = 0x3d, //   #### #
[ 'G' + (9 << 7) ] = 0x00, //
[ 'G' + (10 << 7) ] = 0x00, //
[ 'G' + (11 << 7) ] = 0x00, //

Others

My SolderTime Desk Clock clock, the SparkSign and the Christmas clock all share the same 5x7 font file. These take it another step an uses a helper file that defines all 256 possible bitpatterns and then encodes the strings visually. The character R in github.com/osresearch/soldertime/ST_DeskClock/font.c:

            // R
            {
                    _XXXXXXX,
                    ____X__X,
                    ___XX__X,
                    __X_X__X,
                    _X___XX_,
            },

Font 2015


Last update: November 8, 2020