Font subsetting tool

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Font subsetting tool

BobH-5
On 2013-02-14 at 14:41 Steve White wrote:
> By the way, one thing on the big To Do list has been a subsetting tool.

In case this would be of help, we (in SIL) have been working on a subsetting tool, and it is currently part of our open source FontUtils package (http://scripts.sil.org/fontutils).

Not guaranteeing it is completely free of bugs [yet] but we have used it successfully on our own fonts and invite others to give it a go as well -- and let us know how you get on.

As is the case for the whole FontUtils package, the tools are all command-line, cross-platform, and written in Perl. To help you understand the current ttfsubset command, its "help" message is appended below. And I'll add, because it isn't obvious from the help message, that the tool does actually subset the GPOS, GSUB, and GDEF tables in addition to the more obvious things like the glyf table.

Because FontUtils as a whole is in active development I suggest that interested parties download the Font::TTF and Font::TTF::Scripts Perl packages directly from our SVN repository (rather than using the Windows installer or even the CPAN release). More instructions about this are at the FontUtils link given above.

Regards,

Bob Hallissy
SIL International

---------------------------------------------------------------------------------
TITLE
    ttfsubset - subset a font

SYNOPSIS
    ttfsubset [options] infont outfont

    Opens infont (a .ttf file), subsets it according to the supplied
    options, then writes the resulting file to outfont.

OPTIONS
      -h            Get full help
      -d tag[,...]  List of font tables to remove.
      -g listfile   File containing list of glyphs to retain
      -s tag[,...]  List of OpenType script tags to retain
      -l tag[,...]  List of OpenType language tags to retain
      -n name       Renames the font to the given name (as per ttfname -n)

DESCRIPTION
    ttfsubset removes parts of a font in order to produce a working,
    smaller, font. Multiple subsetting strategies are provided and
    controlled by options.

    The "-d" option is used to delete whole font tables, e.g., all Graphite
    tables. A list of four-letter table tags identifies the tables to be
    removed. As in ttftable, the following (case insensitive) pseudo tags
    can also be used:

      graphite  all SIL Graphite tables (Silf Feat Gloc Glat Sill Sile)
      volt      all Microsoft VOLT tables (TSIV TSID TSIP TSIS)
      opentype  all OpenTYpe tables (GDEF GSUB GPOS)

    The "-g" option specifies a file that lists glyphs to be retained in the
    subset font -- ttfsubset will remove all other glyphs and then do what
    it can to simplify remaining features. Glyphs are identified in the file
    using space-separated indentifiers which can be decimal numeric glyph
    IDs, postscript glyph names, or hexidecimal Unicode scalar values in the
    format of U+xxxx. Ranges of glyphs (specified by either glyph ID or
    postscript name) and of Unicode scalar values can be specified using
    '..' between the values. Glyph identifiers or ranges may be followed
    immediately by equals sign and 4 to 6 hex digits to indicate the
    glyph(s) should be encoded.

    The "-s" and "-l" options identify OpenType script and language
    (respectively) tags to retain in the font. The Default language is
    always retained, so specify "-l ''" to remove all but the default
    language.

BUGS
    ttfsubset is an evolving tool and the invitation is given to contribute
    improvements that will result in smaller output fonts.