Tool for converting fonts to data for use with pimoroni-pico graphics

Bit of an odd request. I have (ahem) ported the pimoroni graphics C++ code to run on a Pi, rather than a Pico, because I use SPI LCD panels on otherwise headless machines.

I wrote my own SPI wrapper class using spidev and libgpiod and it is working fine. I see the output I expect.

I now find that I want to change fonts, as the 6 and 8 bitmap fonts supplied aren’t really what I want. Now, I have previously used libfreetype to allow me to dynamically load a TTF, and render text, but I would prefer to be able to define my own font bitmaps and include them statically - with the added advantage that the same fonts would also be available for my Pico projects (I have Pico Display 2, among other things).

So I am seeking more information on the bitmap font format, or possibly a tool I can use to generate the font data (although I might be able to write this IF I have the right answers to the first part of the query!).

It looks like the code expects either one byte per column, or two, which if I understand it correctly, means the font can be no taller than 16 pixels.

Aside from the code itself, is there any additional documentation on how the data is generated, and is a tool to generate the data available?

Thanks
Steve

There are a number of tools around, search for “font to c-array”, e.g. GitHub - jdmorise/TTF2BMH: A conversion tool for Truetype Fonts to bitmap C header files for any character and for use with monochrome LCD or OLED displays. Also have a look at GitHub - bablokb/pic-st7735: ST7735 TFT-Library for PIC-Microcontrollers. There is a section “Fonts” in the Readme which points you to some tools.

I am not sure if these tools generate pimoroni-pico-graphics compatible code, but they will give you an idea on what to do.