Better Fonts for the SSD1306 OLED Display

The Adafruit SSD1306 support library uses the 5×7 pixel fonts as default. That is a fine and compact font, but wouldn’t it be nice to have some pretty high-res fonts to take advantage of the memory and resolution we have to work with?

In the previous tutorial (Tutorial 9), the script worked straight away , as it has the default font set.

This tutorial will guide you through how to change the default font to something else. Lets have a look at the following example in details :


The first line of the example code snipet is a Python Comment line to tell you what the line below does in English. The second line to define “default fonts being used”. The third and fourth lines also comment lines.

The fifth and sixth lines of the code also commented to disable that parts of the program to remove them temporarily. These lines also to define fonts, but custom fonts. Usually contains the full path, and the size of the fonts.

Here’s how you use comments in Python:

Python Comments

Python has two ways to annotate Python code.
One is by using comments to indicate what some part of the code does.
Single-line comments begin with the hash character (“#”) and are terminated by
the end of line.
Python is ignoring all text that comes after the # to the end of the line,
they are not part of the command.
Comments spanning more than one line are achieved by inserting a multi-line string
(with “”” as the delimiter one each end) that is not used in assignment or
otherwise evaluated, but sits in between other statements.
They are meant as documentation for anyone reading the code.

To change the default font to something different and something cool, we will need to get some new fonts. You can download the fonts used by EduBoard using the command:

Path we used /home/pi/Fonts , Make sure to download to this location.

The terminal prompt should look like this: pi@raspberrypi ~ $

Unzip content

Once extracted, remove the .ZIP file using the following command:

Navigate to the Fonts folder:

List the content of the folder:

The output should look like this:

Capture_it_2.ttf chigger.ttf FFF_Tusj.ttf GrandHotel-Regular.otf LokiCola.ttf ostrich-bold.ttf ostrich-light.ttf ostrich-rounded.ttf PWShaded.ttf unlearn2.ttf
Capture_it.ttf Chunkfive.otf Fipps-Regular.ttf handwriting.ttf ostrich-black.ttf ostrich-dashed.ttf ostrich-regular.ttf Persona.ttf SEASRN__.ttf unlearne.ttf

Now you can test out all the EduBoard_examples for the OLED display. Navigate to the containing folder:

List the content of the folder:

For an example, execute



To clear the display, and turn off the LED use the script:

As we have some new fonts, we can go back to the script to change the default font to something else.

At the prompt type:

Find the following six lines in the script:

Comment out the second line by putting # in front.

Remove the # from the front of the sixth line.

Run the script. The output should look like this:


You can use any of the downloaded fonts. Simply, just change the font name in the following line:

For an example, change it to:

Should look like this:


To change the font size, reduce or increase the number at the end of the line:

Good site to download new fonts from: Fontsquirrel. To easily download the fonts straight to your pi, use right click on the “download otf” button.



Choose “Copy link location”.

On your Pi, at command prompt pi@raspberrypi ~/Adafruit_Python_SSD1306/EduBoard_examples $, use right click to paste the file location.

Should look like this:

pi@raspberrypi ~/Adafruit_Python_SSD1306/EduBoard_examples $

Add the wget command to the front of the URL:


The above method assumes you are connected to your Raspberry Pi via SSH connection.

If not, just paste the file location into a text reader, and type it in at the Pi command prompt.

To unzip the downloaded file, follow the above steps. Make sure, the downloaded “font” location and the /path/font defined in the script are matching.


 Next tutorial, Install Midnight Commander