... using FontForge
Because CircuitPython uses bitmapped fonts (.bdf) as well as the binary .pcf format but many free fonts online are in .ttf format, following the Custom Fonts for CircuitPython Displays learning guide I came up with a cheatsheet to quickly take a full font, select only the limited characters I wanted and generate a small .bdf file. As I only do it once in a while if I don't write it down I wouldn't remember. Below is all covered in the above linked learning guide, but I wanted a quick and dirty cheatsheet, so here it is.
-
Open .ttf font file in FontForge
-
Select characters wanted including space before the “!” (you may need to scroll up). This is important and is missed in the learning guide example screenshot. Without selecting the ASCII 32 spot before the "!" character you won't have a way to display a space, so your display willlooklikethis. See first graphic below showing red box of missing space character you want to be sure to select.
-
Besides the basics of numbers, letters, and punctuation, be sure to select any others you want. I have noticed many .bdf fonts, including CircuitPython's built in terminalio.FONT, don't include a degree symbol (e.g. 78°F will display as 78F) even though many projects people create include temperature. So grab that symbol plus others that might be useful such as ± as another example.
-
Edit -> Select -> invert selection (selects everything you don’t want).
-
Encoding -> Detach & remove glyphs… (everything you don't want is removed)
-
Element -> Simplify -> Simplify and click OK on the warning box.
-
Element -> Bitmap Strikes Available…
-
In 3rd field, Pixel Sizes, enter size you want to create. For example if you want a 36 pixel font then type "36" (the first two fields will auto fill with values). Note that when you create a .bdf file you are only creating a file for that one pixel size.
-
File -> Generate Fonts…. Pick location to save then click Generate. Accept default of Other = 96.
To create other sizes go to step 7 and change the pixel size to the next pixel size file you want to create from the same font and characters already selected earlier. For example if you had just created a 36 pixel font, now change it to 24 in step 8 and generate the new file (step 9). Repeat for as many sizes as you need.
Finally if you really want to make the files small, following the online instructions using the web based Adafruit tool you can convert the .bdf files you just created to even smaller .pcf files. As an example, a (downloaded from Adafruit but further reduced by me) Arial-Bold-36.bdf font which was already a very compact 25kB on my disk got reduced further to a Arial-Bold-36.pcf file of only 16kB.
This page (Creating Reduced Sized Bitmap Fonts From .ttf File) was last updated on January 29, 2025.