This Adafruit GFX font converter turns any TTF/OTF or system font into a ready-to-include GFX font header (.h) — the GFXfont structure the Adafruit GFX library renders with display.setFont(). Normally you would have to compile Adafruit's fontconvert C tool against FreeType from the command line; this GFX font generator does the whole thing in your browser by rasterizing each glyph on a Canvas. Pick a size, choose a character range, and copy a font header that drops straight into your Arduino or ESP32 sketch.
What is a GFXfont and why generate one?
The Adafruit GFX library ships with a single built-in 5×7 pixel font. It is legible but tiny and not very pretty. Custom GFX fonts let you render any typeface — a bold heading, an elegant serif, a clean monospace clock face — on an SSD1306 OLED, ST7735 TFT or any GFX-compatible display. Each custom font is a GFXfont struct: a packed bitmap blob, a per-character GFXglyph table (width, height, cursor advance, x/y offset), and the first/last character codes plus a line-height (yAdvance). Building that by hand is impractical, which is why a converter is essential.
Convert a TTF in your browser
Upload a .ttf or .otf file and the tool loads it through the browser's FontFace API, then draws every character in your chosen range onto an off-screen canvas, finds each glyph's ink bounding box, and packs it MSB-first exactly as Adafruit GFX expects. Prefer a font already installed on your computer? Just type its family name (e.g. Georgia or monospace) instead. The default range is printable ASCII 0x20–0x7E, matching Adafruit's own fontconvert default; narrow it (say 0x30–0x3A for digits and a colon) to shrink the flash footprint of a clock or counter.
Using the font in your sketch
Save the generated output as, for example, MyFont18pt.h, place it beside your .ino, then:
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "MyFont18pt.h"
Adafruit_SSD1306 display(128, 64, &Wire);
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setFont(&MyFont18pt);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 24); // baseline-anchored!
display.print("Hello");
display.display();
}
void loop() {}
The baseline gotcha
The single most common mistake with custom GFX fonts is the cursor anchor. The built-in font draws from the top-left corner, but custom fonts draw from the text baseline — the line letters sit on. If you call setCursor(0, 0) with a custom font, the text renders above the screen and you see nothing. Set the Y position roughly to the font's height (the yAdvance value printed in the output is a good starting point). Lines of text are spaced yAdvance pixels apart automatically.
Keeping the font small
Every glyph you include costs flash, so think about which characters you actually render. A clock only needs digits and a colon (0x30–0x3A); a temperature readout might add a degree sign and minus. Narrowing the range from the full ASCII set to a dozen glyphs can cut the font's footprint by 80 percent. Larger point sizes grow roughly with the square of the height, so a 36 px display font is far heavier than an 18 px one — generate only the sizes you truly need rather than one giant font you scale down. Bold and italic are separate fonts in GFX, so include them only when used.
Compatibility
The output is a standard GFXfont compatible with Adafruit GFX itself, TFT_eSPI (which accepts GFX fonts), and u8g2 via its GFX-font support. Because the bitmaps are stored in PROGMEM, the font lives in flash and uses no RAM. For images rather than fonts, use the image2cpp converter; for u8g2's own native bitmaps see the u8g2 converter.