Command-line tool for converting TTF/OTF fonts to SVG

David Jones picture David Jones · Oct 26, 2012 · Viewed 13.7k times · Source

Does anyone know of a command-line tool that will convert both TTF and OTF fonts to SVG fonts?

Answer

Erik Dahlström picture Erik Dahlström · Oct 26, 2012

You can use fontforge or batik to do this from the commandline.

With fontforge (see scripting documentation):

#!/usr/bin/fontforge
Open($1)
Generate($1:r + ".svg")

Save the above to convert2svgfont.pe file, then invoke as:

convert2svgfont.pe myfont.ttf

For batik see this documentation, install and then invoke as:

java -jar batik-ttf2svg.jar myfont.ttf -o myfont.svg