Recommended method to subset TTFs and Webfonts

Ramiro Espinoza
Ramiro Espinoza Posts: 839
edited May 2013 in Technique and Theory
After checking subsetter.com (which sadly works only for FF files) and reading http://typophile.com/node/75698 (last post from 2010) I guess what is your recommended method / software to do subsetting.
Thanks in advance.

Comments

  • For webfonts, take a look at FontPrep.
    With Glyphs, each glyph has a flag that can be cleared to exclude it when generating the font.
  • I use FontPrep but it has no subsetting capabilities.
  • Apparently, FontPrep does do subsetting. Ramiro, how are you finding FontPrep, I'm curious.
  • Oh, I see. It looks like I updated FontPrep but I didn't realize that now it can subset fonts. I will look into it. Sorry!
  • Dave Crossland
    Dave Crossland Posts: 1,429
    http://code.google.com/p/googlefontdirectory/source/browse/tools/subset/subset.py is used by Google Fonts to do static subsets (latin, latin-ext, etc) and http://code.google.com/p/sfntly is used for the on-the-fly text= GF API subsetting. Also https://bitbucket.org/philip/font-optimizer/src/default/subset.pl for the menu subsets.
  • Do this tools also clean up the kerning tables?
  • And OT features?
  • I did some testing with the FontPrep subset function but when I try to open the resulting TTFs (inside the webkit) to check what it is happening in the kerning and OT tables, they won't work. The file seem to be corrupted or invalid, etc. Without subsetting the generated TTFs can be opened with no problem. Any idea?
  • Do the GPOS and GSUB contain references to glyphs removed by subsetting?
  • @David Yes, indeed. But the software should be able to deal with it. I mailed FontPrep already and I am waiting for an answer.
    I am also finding that their EOTs don't work in IE8 (with and without subsetting). If I generate the EOTs with a sfntly based tool, then there is no problem.
  • And... if I generate a subsetted webfont with FontPrep using a TTF with no OT features at all, still the resulting TTF won't open. So, I think in this case it is not a problem related to references to missing glyphs...
  • Hi Ramiro,
    I remembered one possible cause of problems in IE8:
    When generating the font file for conversion, make sure that Font Info → Names and Copyright → Width: is manually set to "Medium (normal)" (As opposed to just leaving the default "Normal" value)
  • There are bugs in FontPrep subset files and EOTs. They are working on it :)
  • Chris Lozos
    Chris Lozos Posts: 1,458
    Thanks, Ramiro!
  • The user and all related content has been deleted.
  • Reporting: I just tested the newest Fontprep 3.0.6 and although it subsets the character set, it erase all OT and kerning tables... so it is far from doing a goos subsetting job. In that regard FontSquirrel do crop kerning classes, kerning and OT feature properly....
  • Ramiro Espinoza
    Ramiro Espinoza Posts: 839
    edited October 2013
    I confirm Frode statemet. Current FontPrep version (3.0.6) ignores the setting "No autohint" and ruin existing hinting.
  • https://github.com/behdad/fonttools/ now has an EXCELLENT subsetter, that takes care of OTL and CFF :)
  • @Dave: I will check it when I have time. But now that Gustavo Ferreira made me a custom Pyhton script for subsetting I am less motivated :)

    New FontPrep release (3.08) have two options: "Autohint" and "Make fonts 'Web-Friendly' upon". If both options are unchecked the original hinting will be preserved. Developers are working on giving users more control and options on the 'Web-Friendly' algorithm (it erase kerning, and hinting, among other things). If you uncheck these options (for the moment) it is mandatory to have equal names in "Family Name" and "PS Font Name"...
  • @Dave: OK, I downloaded the latest FontTool and found the subset.py
    Can you tell me how to use it or point out an online help? I couldn't find a tutorial...
  • i was curious and found:
    usage: pyftsubset font-file glyph... [--text=ABC]
    (via github

    it's a bit opaque, it seems like the recommended method is to clone the repo, install it in a virtualenv (so as to not conflict with your extant fonttools install) and then call python tools/pytfsubset.py blah.otf U+f00 U+f01 ... or somesuch. the main method would benefit from import argparse because it's a bit rough around the edges.

    the --option doesn't seem to do anything and the --text option appears to let you specify an arbitrary piece of text as a representative sample of the glyphs you want... i think...

    i'm curious to know how it goes @Ramiro (but i'm not exactly keen to test this out myself ;)
  • Dave Crossland
    Dave Crossland Posts: 1,429
    edited November 2013
    .
  • Yeah, we need to do a 'designers tutorial' sometime. @Twardoch is using it...