How to use a custom font?

Besides the TinyFont library, there is any recommended way to use 3x8, 4x8, etc custom fonts?

As far as I know, other than TinyFont, there are no Arduboy specific external libraries for rendering text. You could use TinyFont or the text functions in the Arduboy2 class as examples to write your own text handling functions, or even a generic text handling library.

The Adafruit GFX library, which handles custom fonts, may also provide some ideas.

I already thought about a “dynamic” font library where you can throw in any custom font with a pointer to progmem you want. In fact it was my first idea behind tinyfont.

Sadly it is quite complex if i want optimal progmem usage (no power of 2 stuff with unused bits), performance and small footprint.

I could definitely come up with a solution but i don’t feel it is worth it yet. It is basically simple to modify tinyfont to work with one particular sized font where the most work would go in optimizing the height to avoid unused bits.
Tinyfont stores 2 chars in 4 bytes, where the upper 4x4 bits and lower 4x4 are two glyphs.

1 Like

There was an issue raised about changing the original Arduboy library to handle multiple fonts. This discussion might provide some additional inspiration.

1 Like