Font optimizer tool

Since it's possibly relevant to some past discussions here (around
EOT, compression, etc) and I don't think it's been mentioned before, I
thought it might be useful to point out my code at (open source, written in

The main feature is subsetting TTFs based on a list of characters. It
tries to remove all unnecessary data - in particular, it rewrites the
GSUB and GPOS tables to remove anything that is no longer needed by
the included glyphs. (In one font I've tested, GSUB+GPOS is 130KB and
can be substantially reduced by subsetting, so this seems worth
doing). It's also careful to not remove any glyphs that could be
needed for the input characters (e.g. if you ask for the characters
'i' and 'f', it will look in GSUB and find and include the 'fi' and
'ffi' ligature glyphs, and similarly it should work fine with complex
scripts that rely heavily on substitution).

It can also remove unwanted GSUB/GPOS features, e.g. one particular
1MB font (with lots of optional glyph variants) is reduced to 213KB by
including only ASCII characters, and reduced further to 47KB by
including only the 'kern' and 'liga' features.

There's also some simple uncompressed EOT<->TTF conversion code
(easily tweaked for EOT-Lite), a tool for mangling the 'name' and
'post' tables (making the font invalid so it's harder to use outside
of a web browser; I don't have an opinion on whether this is a good
idea or not), and some other bits and pieces.

It's quite possible there are bugs (the GSUB/GPOS code is somewhat
hairy and full of special cases, and I ought to add some verification
checks on the output), but I've tested with a range of fonts on all
browsers and OSes and it seems to be reasonably robust and hopefully

Philip Taylor

Received on Saturday, 1 August 2009 16:45:33 UTC