Converting TTF fonts to WOFF2

by John M. Higginscalendar Jul 22, 2025

I had to search a bit to find this answer. I found multiple answers but they weren't satisfactory as they were a bit inconvenient and clunky. All I really wanted was a way to do this on a Linux desktop from the command line. Here's the best answer I found after searching for a bit:

First install fontforge using your package manager. (I'm using apt because I run Pop_os like a normy.)

sudo apt install fontforge

Then write a little script called ttf2woff2 with this code inside it.

#!/usr/bin/env sh
fontforge -lang=ff -c 'Open($1); Generate($2);' $1 $2

Now you can run the script by specifying a source ttf file and an output woff2 file like so:

ttf2woff2 ComicCodeRegular.ttf ComicCodeRegular.woff2