Font documentation

Is there documentation on how to define a font in an .h file?

I know that it starts with Width, Height, First char, Number of chars, then a jump table followed by font data. But I don't understand the jump table nor the format of the font data.


You're describing a variable pitch font.
A fixed pitch would be much simpler - just a simple 2d array.

Presumably you have a graphics library in mind to display the font. One approach is to examine the library documentation and/or code to determine what format it expects for font data.

There must be documentation on the file format. I read that it is Open Source, but I cannot find it.

If you look at one of the font files, you see that even a fixed pitch font is described as in my first post. But I cannot figure out how to create my own. It is not a simple array.


You need to tell us which library you're using.

I am using a ESP32-LoRa board with an OLED. It is made by Heltec. It uses the library called "Heltec_ESP32_Dev-Boards".

Its documentation says:
setFont sets the current font. Available default fonts:
ArialMT_Plain_10, ArialMT_Plain_16, ArialMT_Plain_24.
Or create one with the font tool at
Syntax: void setFont(const uint8_t fontData);*

If you go to the mentioned website, it will generate the code to put into a .h file defining a specific font. But I don't know how to make my own file. I want to make a font that they do not have.

Thank you,

Library code is here: Heltec ESP32 Dev-Boards - Arduino Reference

Thank you, but I already have the library. I read all of the documentation that came with it. I even rewrote it in proper English so I could understand it. But the only mention of custom fonts is what I quoted in my earlier post. I read somewhere that the algorithm for creating the .h files is known. But I cannot find it.

Thanks anyway,

Sounds like you want a font editor, like this one:

Thank you John. Your link led me to the doc I was hoping for. It does not specifically describe the file format, but it gave me the tools needed to figure it out. Now I can use the font editor, or do it by myself.

Best regards to all who tried to help,

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.