0

I noticed that the TomThumb.h font included in the Adafruit GFX library has characters that have different widths, which is a problem for me because I'm doing text processing that requires characters to have the same dimensions (width and height). I also noticed that the TomThumb.h font misses some characters (such as ') and so on. I need a way to create/edit fonts for the Adafruit GFX (where I'm using the Adafruit_ST7735 on a 1.8" TFT Display). I've looked around the internet but I couldn't find anything decent.

20
  • The library comes with a number of fonts. The ones named *Mono* are monospaced, which means that all the characters are the same size.
    – Majenko
    May 2, 2020 at 14:18
  • @Majenko Interesting. I thought that by default all characters are required to take equal dimensions. May 2, 2020 at 14:21
  • Nope. Each character in the font ("glyph") specifies the dimensions and offset of the character, and also the "advance" - how far to move the cursor after printing the character.
    – Majenko
    May 2, 2020 at 14:32
  • @Majenko I'm surprised there isn't an easy way to create fonts for the Adafruit GFX. It's a relatively supported and used library. May 2, 2020 at 14:36
  • I have various utilities for DisplayCore, but DisplayCore doesn't run on an Arduino.
    – Majenko
    May 2, 2020 at 14:47

3 Answers 3

1

I found an online editor that can parse Adafruit GFX font headers, modify, and export the result to create a new font header. It works very well. May be a bit late to help OP, but for anyone else looking...

It uses regexes to extract info from the header files, so it's pretty strict on following the layout of GFX font headers provided by Adafruit.

webpage: https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
github: https://github.com/tchapi/Adafruit-GFX-Font-Customiser

1
  • That works nicely, once you figure it out. Mar 7, 2022 at 0:36
0

One possible solution you might already have: There’s a small utility called fontconvert that’s part of the Adafruit GFX library. The source code is installed by default together with the Adafruit GFX library in Arduino/libraries/Adafruit_GFX_Library/fontconvert You need Linux to compile it from the provided source code. It also compiles and runs on a Raspberry Pi.

It takes care of converting TrueType fonts (completely or partially) to Adafruit GFX format. There’s some documentation on compiling and using it in the fontconvert directory.

3
  • Thanks, I found it. Unfortunately, I don't have a Linux nor a Raspberry Pi. I could install a Linux VM. Isn't there an easier way? Like, some tool where you put the individual pixels for each character. May 2, 2020 at 14:33
  • Well, there’s This. I don’t know how useful this is for you, but you could take a look at it.
    – StarCat
    May 2, 2020 at 14:36
  • Thanks, I'll take a look. I hope it'll do the job May 2, 2020 at 14:47
0

I have used this website to generate various fonts, sizes, etc. with success.

http://oleddisplay.squix.ch/#/home

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.