Search code examples
command-linefontssvgfile-conversion

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


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


Solution

  • 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