1. 1. Where to find fonts?
  2. 2. Preparation
  3. 3. Install fontconvert utility
  4. 4. Create custom fonts
  5. 5. Tips

Based on the Adding New Fonts blog post I tried to add new fonts to the Adafruit GFX Library. It was quite a struggle, so I decided to write a blog post about how I finally did it.

Where to find fonts?

By default Adafruit GFX Library contains fonts from the GNU FreeFont project. A more popular alternative source can be the Font Squirrel website.

The rule of thumb is that a TTF TrueType Font file has to be obtained somewhere.


You have to do the followings:

  1. Obtain a TTF file for the selected font
  2. Install the fontconvert utility from the Adafruit GFX Library

Install fontconvert utility

The fontconvert custom font creator utility can be found in the fontconvert subfolder of the Adafruit GFX Library. This is a script written in the C programming language, which means it has to be compiled before it can be used. The code of this script depends on the FreeType project, which is for rendering fonts on Unix type operating systems. It is a problem, if you - like me - mostly work on Windows! Adafruit provided a guide about how to setup a Windows based environment for font conversion. You might try it out, but for this post I took another approach.

I quickly installed the latest Ubuntu 16.04.03 LTS edition as a VirtualBox VM (Virtual Machine) into my host Windows operating system. You can exchange files through shared folders, so it is not a problem to move TTF font and the generated custom font files between Ubuntu Linux and Windows.

If your Ubuntu is up and running, you have to install FreeType 2.8 version onto it. It can be done based on this article. Don’t forget, that the development files are also required!

Open a Terminal window and type the followings:

sudo add-apt-repository ppa:glasen/freetype2
sudo apt update
sudo apt install freetype2-demos
sudo apt install libfreetype6
sudo apt install libfreetype6-dev

Now you are ready to compile the fontconvert utility:

  1. Go to the fontconvert subfolder of the Adafruit GFX Library
  2. Type make

As a result a new fontconvert executable was created, which can be used for font conversions.

Create custom fonts

Now you are able to follow the original guide to create your custom fonts. Let’s see an example!

  1. Dowload a font - e.g. Droid Sans Mono
  2. Unpack the zip file
  3. Copy the DroidSansMono.ttf file into the fontconvert subfolder
  4. Create a new 12 pt font - sudo ./fontconvert DroidSansMono.ttf 12 >DroidSansMono12pt.h
  5. Copy the created C header file into your project and use this font as the other custom fonts


I usually generate different size of fonts at once.

I keep the fonts in the Fonts subfolder to keep the Arduino project free.

If you use Sloeber IDE - like me, a separate C header file should be created for the font includes, because as part of the project source code compilation a file called sloeber.ino.cpp gets generated. This file contains the includes from the main ino sketch. If font imports can be found in this sketch, it will be included in the generated sloeber.ino.cpp file as well. This causes double imports, so the compilation will fail. If all the fonts are included in a separate C header file, this file will appear in the sloeber.ino.cpp file instead of the individual fonts, so double include won’t happen.

  1. 1. Where to find fonts?
  2. 2. Preparation
  3. 3. Install fontconvert utility
  4. 4. Create custom fonts
  5. 5. Tips