Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TTFAutohint: Making Hinting Fast, Easy, and Global (TypeCon 2016)

Dave Crossland
August 27, 2016

TTFAutohint: Making Hinting Fast, Easy, and Global (TypeCon 2016)

TypeCon 2016 Program Summary:

Hinting TrueType fonts can be a slow and expensive process, especially for multiscript projects with 1,000s of glyphs, but it is required by Windows. Sadly, many TTFs completely lack hinting after a simple conversion from OTF. TTFAutohint provides reasonable quality hinting in an instant, and sets a foundation for hand adjusting for ultimate hinting quality.

In 2010 Dave Crossland suggested to Werner Lemberg, the primary developer of FreeType, the idea of extending FreeType’s rendering system into a TTF autohinter, so that all fonts could look good on Windows.

Werner made a prototype that had promising results, and he since raised over $100,000 from individual professional type designers and with support from Adobe, Microsoft, Google, Extensis WebInk (RIP), FontLab, RoboFont and Glyphs.

In this session you will see the quality of hinting that TTFAutohint can produce for various scripts, learn tips on using it with your favorite font editor, and hear about the project’s future.

Presentation reported at LWN:

https://lwn.net/Articles/700424/

Dave Crossland

August 27, 2016
Tweet

More Decks by Dave Crossland

Other Decks in Design

Transcript

  1. “Look at all the i letters, they have become l

    letters. Look at the f letters, they are not very readable. Some letters (like u) have two pixels in the bottom stem instead of one which similar letters have.” web.archive.org/web/20120927004229/http://lettersfromsweden.se/ttfautohintingreview
  2. “With not too much more effort, autohinting directly in FontLab

    can produce the same kind of result as ttfautohint, but with the major advantage that the hints are editable directly after the autohinting process, so I can’t really see the point of using ttfautohint at all.” – Göran Söderström web.archive.org/web/20120927004229/http://lettersfromsweden.se/ttfautohintingreview
  3. $ ./ttfautohint Usage: ttfautohint [OPTION]... [IN-FILE [OUT-FILE]] Replace hints in

    TrueType font IN-FILE and write output to OUT-FILE. If OUT-FILE is missing, standard output is used instead; if IN-FILE is missing also, standard input and output are used. The new hints are based on FreeType's auto-hinter. This program is a simple front-end to the `ttfautohint' library. Options: --debug print debugging information -c, --composites hint glyph composites also -d, --dehint remove all hints -D, --default-script=S set default OpenType script (default: latn) -f, --fallback-script=S set fallback script (default: none) -F, --family-suffix=S append suffix to the family name string(s) in the `name' table -G, --hinting-limit=N switch off hinting above this PPEM value (default: 200); value 0 means no limit -h, --help display this help and exit -H, --fallback-stem-width=N set fallback stem width (default: 50 font units at 2048 UPEM) -i, --ignore-restrictions override font license restrictions -I, --detailed-info add detailed ttfautohint info to the version string(s) in the `name' table ...
  4. -l, --hinting-range-min=N the minimum PPEM value for hint sets (default:

    8) -m, --control-file=FILE get control instructions from FILE -n, --no-info don't add ttfautohint info to the version string(s) in the `name' table -p, --adjust-subglyphs handle subglyph adjustments in exotic fonts -r, --hinting-range-max=N the maximum PPEM value for hint sets (default: 50) -s, --symbol input is symbol font -t, --ttfa-table add TTFA information table -v, --verbose show progress information -V, --version print version information and exit -w, --strong-stem-width=S use strong stem width routine for modes S, where S is a string of up to three letters with possible values `g' for grayscale, `G' for GDI ClearType, and `D' for DirectWrite ClearType (default: G) -W, --windows-compatibility add blue zones for `usWinAscent' and `usWinDescent' to avoid clipping -x, --increase-x-height=N increase x height for sizes in the range 6<=PPEM<=N; value 0 switches off this feature (default: 14) -X, --x-height-snapping-exceptions=STRING specify a comma-separated list of x-height snapping exceptions, for example "-9, 13-17, 19" (default: "") The program accepts both TTF and TTC files as input. Use option -i only if you have a legal permission to modify the font. The used PPEM value for option -p is FUnits per em, normally 2048. With option -s, use default values for standard stem width and height, otherwise they are derived from script-specific characters resembling the shape of character `o'.
  5. GUI

  6. From: Frederik Berlaen <[email protected]> Date: August 16, 2012 7:58:23 AM

    EDT To: Eben Sorkin <[email protected]> Subject: ttfautohint UI He Eben quickly sketched out a UI that is fitting the human guidelines look at the aligment of various UI elements and I guess it makes more sense and very straight forward and clear to users I can provide you some quides how to built and app but only for mac with python - vanilla - py2app I know that is a big restriction but I dont have time to learn and test other frameworks, languages and OSs hope this helps good luck
  7. “With not too much more effort, autohinting directly in FontLab

    can produce the same kind of result as ttfautohint, but with the major advantage that the hints are editable directly after the autohinting process, so I can’t really see the point of using ttfautohint at all.” – Göran Söderström web.archive.org/web/20120927004229/http://lettersfromsweden.se/ttfautohintingreview
  8. A control instructions file contains entries of the form [<font

    idx>] <script> <feature> @ <glyph ids> [<font idx>] <glyph id> l|r <points> [(<left offset>,<right offset>)] [<font idx>] <glyph id> n <points> [<font idx>] <glyph id> t|p <points> [x <shift>] [y <shift>] @ <ppems> <font idx> is the current subfont, <glyph id> is a glyph name or index, <glyph ids> is a set of <glyph id>s, <shift> is a real number in px, <points> and <ppems> are integer ranges as with option `-X'. <script> and <feature> are four-letter tags that define a style the <glyph ids> are assigned to; possible values for <script> are the same as with option -D, possible values for <feature> are c2cp (petite capitals from capitals), c2sc (small capitals from capitals), ordn (ordinals), pcap (petite capitals), ruby (ruby), sinf (scientific inferiors), smcp (small capitals), subs (subscript), sups (superscript), titl (titling). `l' (`r') creates one-point segments with direction left (right). <left offset> and <right offset> specify offsets (in font units) relative to the corresponding points to give the segments a length. `n' removes points from horizontal segments, making them `weak' points. `t' (`p') applies delta exceptions to the given points before (after) IUP. `#' starts a line comment, which gets ignored. Empty lines are ignored, too. Key letters `l', `r', `n', `p', `t', `x', and `y' have the verbose aliases `left', `right', `nodir', `point', `touch', `xshift', and `yshift'.
  9. 22 Latin, Arabic, Armenian, Bengali, Cherokee, Cyrillic, Devanagari, Ethiopic, Georgian,

    Greek, Gujarati, Gurmukhi, Hebrew, Kannada, Khmer, Lao, Malayalam, Myanmar, Sinhala, Tamil, Telugu, Thai
  10. How to harmonize styles within a font family (eg, Regular

    and Bold)? Maybe, increase glyph height by one pixel
  11. But heights should be at crisp whole pixels, and be

    the same for each style in a family If we scale the whole glyph to increase x height by one pixel, then, the glyph overall grows by 1.1 – 2.0 pixels :(
  12. So, we will use *two* scaling values to distort the

    glyph non-linearly -z LIST_OF_SIZES increase the x height by one pixel for given PPEM values -Z LIST_OF_SIZES increase the glyph height by one pixel for given PPEM values
  13. -z = the lower part of a glyph gets scaled

    up, while the upper part gets scaled down to stay at the same height. -Z = the lower part stays the same, while the upper part gets scaled up to increase the size by one pixel -z & -Z = uniformly scale the whole glyph up by two pixels
  14. CJK

  15. Dave Arnold, Vernon Adams, Frederik Berlaen, Frank E. Blokland, James

    Cloos, Girish Dalvi, Erwin Denissen, Ralf S. Engelschall, Greg Hitchcock, Hirwen Harendal, Khaled Hosny, Wei Huang, Denis Jacquerye, Daniel Johnson, David Lemon, Karsten Lücke, Thomas Phinney, Thomas Rutter, Alexandre Saumier Demers, Marc Schönefeld, Eben Sorkin, Adam Twardoch, Jasper de Waard, Zack Weinberg, Benjamin Yang