At some point in time I found myself needing to extract a customer logo from a custom icon font. Since finding the solution required some homework, I’ll share the results here to save you some time in case you stumble upon this via a search engine.

The solution

Turns out the open source font editor FontForge is able to do exactly what we want (and more).

For this task it wasn’t my interest to learn how to use a new application, so I installed the command-line tool via Homebrew:

brew install fontforge

Then, we can use FontForge to extract the glyphs from the font and save them as SVG images using the following command:

# e.g. for a font file named "font.ttf"

fontforge -lang=ff -c 'Open($1); SelectWorthOutputting(); foreach Export("svg"); endloop;' font.ttf 

Caution: this writes the images in the same directory as the font is located in, you might want to place it in a separate folder.


Sources