An SVG to TrueType (TTF) font converter

Background

Scalable vector graphics (SVG) is a file format that allows specifying fonts (see W3C specification). The glyphs are defined in a declarative and system-independent way, which makes the format particularly beautiful and easy to handle. Several font editors can produce such fonts, in particular also PowerLine, the free SVG slide editor with Latex support.

Unfortunately, the W3C and the browser vendors are inching towards a depreciation of SVG fonts — each citing each other's unwillingness to support the format (Google search).

This makes Truetype (TTF) the only supported alternative. The newer formats WOFF and OpenType are just container formats that sit on top of TTF. Unfortunately, TTF is a binary font format that requires dealing with search indexes, binary flags, and memory management. Consequently, it is impossible to write such a file by hand.

Personally, I find it sad and irresponsible to give up a declarative and clean font format for an ancient, binary, and system-dependent font format. However, since this is the decision, so be it. Here is an attempt at a Java program that converts SVG font files to Truetype font files.

The Font Converter

This converter takes as input an SVG Font file, and produces as output a truetype TTF font file. It supports different character ranges (Cyrillic, Greek, Hebrew, Arabic, etc.), not just Western characters. It also supports kerning — although it produces only the KERN table, and not the newer GPOS table. The font of the present document was produced by the tool.

The converter is experimental code. It understands only a very limited set of SVG font files — most notably those produced by PowerLine. If you wish to do anything else with it, you have to mess with the code!

Download source code

Legal

The converter code is based on DoubleType, a Java font editor. Since this code is available under a copy-left license, the SVG to TTF font converter also has to follow this license. Hence, this program is made available under a GNU general public license.

This page does not use cookies and is free of Javascript.