6 Copyright (C) 2011-2014 by Werner Lemberg.
8 This file is part of the ttfautohint library, and may only be used,
9 modified, and distributed under the terms given in `COPYING'. By
10 continuing to use, modify, or distribute this file you indicate that you
11 have read `COPYING' and understand and accept it fully.
13 The file `COPYING' mentioned in the previous paragraph is distributed
14 with the ttfautohint library.
22 **ttfautohint** is a library written in\ C that takes a TrueType font as
23 the input, removes its bytecode instructions (if any), and returns a new
24 font where all glyphs are bytecode hinted using the information given by
25 FreeType's auto-hinting module. The idea is to provide the excellent
26 quality of the auto-hinter on platforms that don't use FreeType.
28 The library has a single API function, `TTF_autohint`, which is described
29 [below](#the-ttfautohint-api).
31 Bundled with the library there are two front-end programs, [`ttfautohint`
32 and `ttfautohintGUI`](#ttfautohint-and-ttfautohintgui), being a command line
33 program and an application with a Graphics User Interface (GUI),
37 What exactly are hints?
38 -----------------------
40 To cite [Wikipedia](http://en.wikipedia.org/wiki/Font_hinting):
42 > **Font hinting** (also known as **instructing**) is the use of
43 > mathematical instructions to adjust the display of an outline font so that
44 > it lines up with a rasterized grid. At low screen resolutions, hinting is
45 > critical for producing a clear, legible text. It can be accompanied by
46 > antialiasing and (on liquid crystal displays) subpixel rendering for
49 and Apple's [TrueType Reference
50 Manual](https://developer.apple.com/fonts/TTRefMan/RM03/Chap3.html#features):
52 > For optimal results, a font instructor should follow these guidelines:
54 > - At small sizes, chance effects should not be allowed to magnify small
55 > differences in the original outline design of a glyph.
57 > - At large sizes, the subtlety of the original design should emerge.
60 In general, there are three possible ways to hint a glyph.
62 1. The font contains hints (in the original sense of this word) to guide
63 the rasterizer, telling it which shapes of the glyphs need special
64 consideration. The hinting logic is partly in the font and partly in
65 the rasterizer. More sophisticated rasterizers are able to produce
66 better rendering results.
68 This is how Type\ 1 and CFF hints work.
70 2. The font contains exact instructions (also called *bytecode*) on how to
71 move the points of its outlines, depending on the resolution of the
72 output device, and which intentionally distort the (outline) shape to
73 produce a well-rasterized result. The hinting logic is in the font;
74 ideally, all rasterizers simply process these instructions to get the
75 same result on all platforms.
77 This is how TrueType hints work.
79 3. The font gets auto-hinted (at run-time). The hinting logic is
80 completely in the rasterizer. No hints in the font are used or needed;
81 instead, the rasterizer scans and analyzes the glyphs to apply
82 corrections by itself.
84 This is how FreeType's auto-hinter works; see
85 [below](#background-and-technical-details) for more.
88 What problems can arise with TrueType hinting?
89 ----------------------------------------------
91 While it is relatively easy to specify PostScript hints (either manually or
92 by an auto-hinter that works at font creation time), creating TrueType
93 hints is far more difficult. There are at least two reasons:
95 - TrueType instructions form a programming language, operating at a very
96 low level. They are comparable to assembler code, thus lacking all
97 high-level concepts to make programming more comfortable.
99 Here an example how such code looks like:
103 PUSHB[ ] /* 3 values pushed */
106 PUSHB[ ] /* 2 values pushed */
109 PUSHB[ ] /* 3 values pushed */
114 Another major obstacle is the fact that font designers usually aren't
117 - It is very time consuming to manually hint glyphs. Given that the
118 number of specialists for TrueType hinting is very limited, hinting a
119 large set of glyphs for a font or font family can become very expensive.
125 The ttfautohint library brings the excellent quality of FreeType rendering
126 to platforms that don't use FreeType, yet require hinting for text to look
127 good -- like Microsoft Windows. Roughly speaking, it converts the glyph
128 analysis done by FreeType's auto-hinting module to TrueType bytecode.
129 Internally, the auto-hinter's algorithm resembles PostScript hinting
130 methods; it thus combines all three hinting methods discussed
131 [previously](#what-exactly-are-hints).
133 The simple interface of the front-ends (both on the command line and with
134 the GUI) allows quick hinting of a whole font with a few mouse clicks or a
135 single command on the prompt. As a result, you get better rendering results
136 with web browsers, for example.
138 Across Windows rendering environments today, fonts processed with
139 ttfautohint look best with ClearType enabled. This is the default for
140 Windows\ 7. Good visual results are also seen in recent MacOS\ X versions
141 and GNU/Linux systems (including Android, ChromeOS, and other mobile
142 operating systems) that use FreeType for rendering glyphs.
144 The goal of the project is to generate a 'first pass' of hinting that font
145 developers can refine further for ultimate quality.
149 `ttfautohint` and `ttfautohintGUI`
150 ==================================
152 On all supported platforms (GNU/Linux, Windows, and Mac OS\ X), the GUI
153 looks quite similar; the used toolkit is [Qt], which in turn uses the
154 platform's native widgets.
156 ![`ttfautohintGUI` on GNU/Linux running KDE](img/ttfautohintGUI.png)
158 Both the GUI and console version share the same features, to be discussed in
161 **Warning: ttfautohint cannot always process a font a second time.**
162 If the font contains composite glyphs, and [option `-c`](#hint-composites)
163 is used, reprocessing with ttfautohint will fail. For this reason it is
164 strongly recommended to *not* delete the original, unhinted font so that you
165 can always rerun ttfautohint.
168 Calling `ttfautohint`
169 ---------------------
172 ttfautohint [OPTION]... [IN-FILE [OUT-FILE]]
175 The TTY binary, `ttfautohint`, works like a Unix filter, this is, it reads
176 data from standard input if no input file name is given, and it sends its
177 output to standard output if no output file name is specified.
179 A typical call looks like the following.
182 ttfautohint -v -f latn foo.ttf foo-autohinted.ttf
185 For demonstration purposes, here the same using a pipe and redirection.
186 Note that Windows's default command line interpreter, `cmd.exe`, doesn't
187 support piping with binary files, unfortunately.
190 cat foo.ttf | ttfautohint -v -f latn > foo-autohinted.ttf
194 Calling `ttfautohintGUI`
195 ------------------------
198 ttfautohintGUI [OPTION]...
201 `ttfautohintGUI` doesn't send any output to a console; however, it accepts
202 the same command line options as `ttfautohint`, setting default values for
209 Long options can be given with one or two dashes, and with and without an
210 equal sign between option and argument. This means that the following forms
211 are acceptable: `-foo=`*bar*, `--foo=`*bar*, `-foo`\ *bar*, and
214 Below, the section title refers to the command's label in the GUI (if
215 applicable), then comes the name of the corresponding long command line
216 option and its short equivalent, followed by a description.
218 Background and technical details on the meaning of the various options are
219 given [afterwards](#background-and-technical-details).
221 ### Hint Set Range Minimum, Hint Set Range Maximum
223 See '[Hint Sets](#hint-sets)' for a definition and explanation.
225 `--hinting-range-min=`*n*, `-l`\ *n*
226 : The minimum PPEM value (in pixels) at which hint sets are created. The
227 default value for *n* is\ 8.
229 `--hinting-range-max=`*n*, `-r`\ *n*
230 : The maximum PPEM value (in pixels) at which hint sets are created. The
231 default value for *n* is 50.
233 Increasing the range given by `-l` and `-r` normally makes the font's
238 `--default-script=`*s*, `-D`\ *s*
239 : Set default script to tag *s*, which is a string consisting of four
240 lowercase characters like `latn` or `dflt`. It is needed to specify the
241 OpenType default script: After applying all features that are handled
242 specially (like small caps or superscript), ttfautohint uses this value
243 for the remaining features. The default value is `latn`. See
244 [below](#opentype-features) for more details.
248 `--fallback-script=`*s*, `-f`\ *s*
249 : Set fallback script to tag *s*, which is a string consisting of four
250 characters like `latn` or `dflt`. It gets used for for all glyphs that
251 can't be assigned to a script automatically. See [below](#scripts) for
256 `--hinting-limit=`*n*, `-G`\ *n*
257 : The *hinting limit* is the PPEM value (in pixels) where hinting gets
258 switched off (using the `INSTCTRL` bytecode instruction, not the `gasp`
259 table data); it does not influence the file size. The default value for
260 *n* is 200, which means that the font is not hinted for PPEM values
263 Note that hinting in the range 'hinting-range-max' up to 'hinting-limit'
264 uses the hinting configuration for 'hinting-range-max'.
266 To omit a hinting limit, use `--hinting-limit=0` (or check the 'No
267 Hinting Limit' box in the GUI). Since this causes internal math
268 overflow in the rasterizer for large pixel values (>\ 1500px approx.) it
269 is strongly recommended to not use this except for testing purposes.
271 ### x Height Increase Limit
273 `--increase-x-height=`*n*, `-x`\ *n*
274 : Normally, ttfautohint rounds the x\ height to the pixel grid, with a
275 slight preference for rounding up (to use the terminology of TrueType's
276 'Super Round' bytecode instruction, the threshold is 5/8px). If this
277 flag is set, values in the range 6\ PPEM to *n*\ PPEM are much more
278 often rounded up (setting the threshold to 13/16px). The default value
279 for *n* is 14. Use this flag to increase the legibility of small sizes
280 if necessary; you might get weird rendering results otherwise for glyphs
281 like 'a' or 'e', depending on the font design.
283 To switch off this feature, use `--increase-x-height=0` (or check the
284 'No x\ Height Increase' box in the GUI). To switch off rounding the
285 x\ height to the pixel grid in general, either partially or completely,
286 see '[x Height Snapping Exceptions](#x-height-snapping-exceptions)'.
288 The following images again use the font 'Mertz Bold'.
290 ![At 17px, without option `-x` and '`-w ""`', the hole in glyph 'e'
291 looks very grey in the FontForge snapshot, and the GDI ClearType
292 rendering (which is the default on older Windows versions) fills it
293 completely with black because it uses B/W rendering along the y\ axis.
294 FreeType's 'light' autohint mode (which corresponds to ttfautohint's
295 'smooth' stem width algorithm) intentionally aligns horizontal lines
296 to non-integer (but still discrete) values to avoid large glyph shape
297 distortions.](img/e-17px-x14.png)
299 ![The same, this time with option `-x 17` (and
300 '`-w ""`').](img/e-17px-x17.png)
302 ### x Height Snapping Exceptions
304 `--x-height-snapping-exceptions=`*string*, `-X`\ *string*
305 : A list of comma separated PPEM values or value ranges at which no
306 x\ height snapping shall be applied. A value range has the form
307 *value*~1~`-`*value*~2~, meaning *value*~1~\ <= PPEM <=\ *value*~2~.
308 *value*~1~ or *value*~2~ (or both) can be missing; a missing value is
309 replaced by the beginning or end of the whole interval of valid PPEM
310 values, respectively (6\ to 32767). Whitespace is not significant;
311 superfluous commas are ignored, and ranges must be specified in
312 increasing order. For example, the string `"7-9, 11, 13-"` means the
313 values 7, 8, 9, 11, 13, 14, 15, etc. Consequently, if the supplied
314 argument is `"-"`, no x\ height snapping takes place at all. The
315 default is the empty string (`""`), meaning no snapping exceptions.
317 Normally, x\ height snapping means a slight increase in the overall
318 vertical glyph size so that the height of lowercase glyphs gets aligned
319 to the pixel grid (this is a global feature, affecting *all* glyphs of a
320 font). However, having larger vertical glyph sizes is not always
321 desired, especially if it is not possible to adjust the `usWinAscent`
322 and `usWinDescent` values from the font's `OS/2` table so that they are
323 not too tight. See '[Windows Compatibility](#windows-compatibility)'
326 ### Fallback Stem Width
328 `--fallback-stem-width=`*n*, `-H`\ *n*
329 : Set the horizontal stem width (hinting) value for all scripts that lack
330 proper standard characters in the font. The value is given in font
331 units and must be a positive integer. If not set, ttfautohint uses a
332 hard-coded default (50\ units at 2048 units per EM, and linearly scaled
333 for other UPEM values, for example 24\ units at 1000 UPEM).
335 For symbol fonts, you need option `--fallback-script` too (to set up a
338 In the GUI, uncheck the 'Default Fallback Stem Width' box to activate
341 ### Windows Compatibility
343 `--windows-compatibility`, `-W`
344 : This option makes ttfautohint add two artificial blue zones, positioned
345 at the `usWinAscent` and `usWinDescent` values (from the font's `OS/2`
346 table). The idea is to help ttfautohint so that the hinted glyphs stay
347 within this horizontal stripe since Windows clips everything falling
350 There is a general problem with tight values for `usWinAscent` and
351 `usWinDescent`; a good description is given in the [Vertical Metrics
352 How-To](http://typophile.com/node/13081). Additionally, there is a
353 special problem with tight values if used in combination with
354 ttfautohint because the auto-hinter tends to slightly increase the
355 vertical glyph dimensions at smaller sizes to improve legibility. This
356 enlargement can make the heights and depths of glyphs exceed the range
357 given by `usWinAscent` and `usWinDescent`.
359 If ttfautohint is part of the font creation tool chain, and the font
360 designer can adjust those two values, a better solution instead of using
361 option `-W` is to reserve some vertical space for 'padding': For the
362 auto-hinter, the difference between a top or bottom outline point before
363 and after hinting is less than 1px, thus a vertical padding of 2px is
364 sufficient. Assuming a minimum hinting size of 6ppem, adding two pixels
365 gives an increase factor of 8÷6 = 1.33. This is near to the default
366 baseline-to-baseline distance used by TeX and other sophisticated text
367 processing applications, namely 1.2×designsize, which gives satisfying
368 results in most cases. It is also near to the factor 1.25 recommended
369 in the abovementioned how-to. For example, if the vertical extension of
370 the largest glyph is 2000 units (assuming that it approximately
371 represents the designsize), the sum of `usWinAscent` and `usWinDescent`
372 could be 1.25×2000 = 2500.
374 In case ttfautohint is used as an auto-hinting tool for fonts that can
375 be no longer modified to change the metrics, option `-W` in combination
376 with '`-X "-"`' to suppress any vertical enlargement should prevent
381 `--adjust-subglyphs`, `-p`
382 : *Adjusting subglyphs* makes a font's original bytecode be applied to all
383 glyphs before it is replaced with bytecode created by ttfautohint. This
384 makes only sense if your font already has some hints in it that modify
385 the shape even at EM size (normally 2048px); in particular, some CJK
386 fonts need this because the bytecode is used to scale and shift
387 subglyphs (hence the option's long name). For most fonts, however, this
393 : By default, the components of a composite glyph get hinted separately.
394 If this flag is set, the composite glyph itself gets hinted (and the
395 hints of the components are ignored). Using this flag increases the
396 bytecode size a lot, however, it might yield better hinting results.
398 If this option is used (and a font actually contains composite glyphs),
399 ttfautohint currently cannot reprocess its own output for technical
400 reasons, see [below](#the-.ttfautohint-glyph).
405 : Process a font that ttfautohint would refuse otherwise because it can't
406 find a single standard character for any of the supported scripts.
408 For all scripts that lack proper standard characters, ttfautohint uses a
409 default (hinting) value for the standard stem width instead of deriving
410 it from a script's set of standard characters (for the latin script, one
411 of them is character 'o').
413 Use this option (usually in combination with option `--fallback-script`)
414 to hint symbol or dingbat fonts or math glyphs, for example, at the
415 expense of possibly poor hinting results at small sizes.
420 : Strip off all hints without generating new hints. Consequently, all
421 other hinting options are ignored. This option is intended for testing
424 ### Add ttfautohint Info
427 : Don't add ttfautohint version and command line information to the
428 version string or strings (with name ID\ 5) in the font's `name` table.
429 In the GUI it is similar: If you uncheck the 'Add ttfautohint info' box,
430 information is not added to the `name` table. Except for testing and
431 development purposes it is strongly recommended to not use this option.
433 ### Add TTFA Info Table
436 : Add an SFNT table called `TTFA` to the output font that holds a dump of
437 all parameters; the data resembles the format of the `--debug` option's
438 parameter listing. In particular, it lists all ttfautohint control
439 instructions (which are *not* shown in the `name` table info). This
440 option is mainly for archival purposes so that all information used to
441 create a font is stored in the font itself. Note that such a `TTFA`
442 table gets ignored by all TrueType rendering engines.
444 Forthcoming versions of the ttfautohint front-ends will be able to use
445 this data so that a font can be processed another time with exactly the
446 same parameters, thus providing a means for round-tripping fonts.
448 ### Strong Stem Width and Positioning
450 `--strong-stem-width=`*string*, `-w`\ *string*
451 : ttfautohint offers two different routines to handle (horizontal) stem
452 widths and stem positions: 'smooth' and 'strong'. The former uses
453 discrete values that slightly increase the stem contrast with almost no
454 distortion of the outlines, while the latter snaps both stem widths and
455 stem positions to integer pixel values as much as possible, yielding a
456 crisper appearance at the cost of much more distortion.
458 These two routines are mapped onto three possible rendering targets:
460 - grayscale rendering, with or without optimization for subpixel
461 positioning (e.g. Android)
463 - 'GDI ClearType' rendering: the rasterizer version, as returned by the
464 GETINFO bytecode instruction, is in the range 36\ <= version <\ 38 and
465 ClearType is enabled (e.g. Windows XP)
467 - 'DirectWrite ClearType' rendering: the rasterizer version, as returned
468 by the GETINFO bytecode instruction, is >=\ 38, ClearType is enabled,
469 and subpixel positioning is enabled also (e.g. Internet Explorer\ 9
470 running on Windows\ 7)
472 GDI ClearType uses a mode similar to B/W rendering along the vertical
473 axis, while DW ClearType applies grayscale rendering. Additionally,
474 only DW ClearType provides subpixel positioning along the x\ axis. For
475 what it's worth, the rasterizers version\ 36 and version\ 38 in
476 Microsoft Windows are two completely different rendering engines.
478 The command line option expects *string* to contain up to three letters
479 with possible values '`g`' for grayscale, '`G`' for GDI ClearType, and
480 '`D`' for DW ClearType. If a letter is found in *string*, the strong
481 stem width routine is used for the corresponding rendering target (and
482 smooth stem width handling otherwise). The default value is '`G`', which
483 means that strong stem width handling is activated for GDI ClearType
484 only. To use smooth stem width handling for all three rendering
485 targets, use the empty string as an argument, usually connoted with
488 In the GUI, simply set the corresponding check box to select the strong
489 width routine for a given rendering target. If you unset the check box,
490 the smooth width routine gets used.
492 The following FontForge snapshot images use the font '[Mertz
493 Bold](http://code.newtypography.co.uk/mertz-sans/)' (still under
494 development) from [Vernon Adams].
496 ![The left part shows the glyph 'g' unhinted at 26px, the right part
497 with hints, using the 'smooth' stem algorithm.](img/ff-g-26px.png)
499 ![The same, but this time using the 'strong'
500 algorithm. Note how the stems are aligned to the pixel
501 grid.](img/ff-g-26px-wD.png)
503 ### Control Instructions File
504 `--control-file=`*file*, `-m`\ *file* (TTY only)
505 : Specify the name of a control instructions file to manually tweak the
506 hinting process. This feature can be used to correct glitches in
507 ttfautohint's hinting algorithm.
509 An entry in a control instructions file has one of the following syntax
510 forms (with brackets showing optional elements):
512 > *\[*\ font‑idx\ *\]*\ \ glyph‑id\ \ *`l`\[`eft`\]|`r`\[`ight`\]*\ points\ \ *\[*\ *`(`*\ left‑offset\ *`,`*\ right‑offset\ *`)`*\ *\]*\
513 > *\[*\ font‑idx\ *\]*\ \ glyph‑id\ \ *`n`\[`odir`\]*\ points\
514 > *\[*\ font‑idx\ *\]*\ \ glyph‑id\ \ *`p`\[`oint`\]*\ points\ \ *\[*\ *`x`\[`shift`\]*\ x‑shift\ *\]*\ \ *\[*\ *`y`\[`shift`\]*\ y‑shift\ *\]*\ \ *`@`*\ ppems
516 *font‑idx* gives the index of the font in a TrueType Collection. If
517 missing, it is set to zero. For normal TrueType fonts, only value zero
518 is valid. If starting with `0x` the number is interpreted as
519 hexadecimal. If starting with `0` it gets interpreted as an octal
520 value, and as a decimal value otherwise.
522 *glyph‑id* is a glyph's name as listed in the `post` SFNT table or a
523 glyph index. A glyph name consists of characters from the set
524 '`A-Za-z0-9._`' only and does not start with a digit or period, with the
525 exceptions of the names '`.notdef`' and '`.null`'. A glyph index can be
526 specified in decimal, octal, or hexadecimal format, the latter two
527 indicated by the prefixes `0` and `0x`, respectively.
529 The mutually exclusive parameters `left` and `right` (which can be
530 abbreviated as '`l`' and '`r`', respectively) indicate that the
531 following points have left or right 'out' direction, respectively,
532 overriding ttfautohint's algorithm for setting point directions. The
533 'out direction' of a point is the direction of the outline *leaving* the
534 point (or passing the control point). If the specified direction is
535 identical to what ttfautohint computes, nothing special happens.
536 Otherwise, a one-point segment with the specified direction gets
537 created. By default, its length is zero. Setting *left‑offset* and
538 *right‑offset*, you can change the segment's horizontal start and end
539 position relative to the point position. *left‑offset* and
540 *right‑offset* are integers measured in font units.
542 Parameter `nodir` (or '`n`') sets the 'out' direction of the following
543 points to 'no direction'. If the specified direction is identical to
544 what ttfautohint computes, nothing special happens. Otherwise,
545 ttfautohint no longer considers those points as part of horizontal
546 segments, thus treating them as 'weak' points.
548 Modifying or adding segments don't directly modify the outlines; it only
549 influences the hinting process.
551 Parameter `point` (or '`p`') makes ttfautohint apply delta exceptions
552 for the given points, shifting the points by the given values. Note
553 that those delta exceptions are applied *after* the final `IUP`
554 instructions in the bytecode; as a consequence, they are (partially)
555 ignored by rasterizers if in ClearType mode.
557 Both *points* and *ppems* are number ranges, see '[x Height Snapping
558 Exceptions](#x-height-snapping-exceptions)' for the syntax.
560 *x‑shift* and *y‑shift* represent real numbers that get rounded to
561 multiples of 1/8 pixels. The entries for `xshift` ('`x`') and `yshift`
562 ('`y`') are optional; if missing, the corresponding value is set to
565 Values for *x‑shift* and *y‑shift* must be in the range [−1.0;1.0].
566 Values for *ppems* must be in the range [6;53]. Values for *points* are
567 limited by the number of points in the glyph.
569 Similar to the Bourne shell (`sh` or `bash`), a comment starts with
570 character '`#`'; the rest of the line is ignored. An empty line is
571 ignored also. Both the newline character and '`;`' can be used as a
572 separator between exception entries. A trailing '`\`' at the end of a
573 line continues the current line on the next one.
575 In case there are multiple shift entries for the same (*font‑idx*,
576 *glyph‑id*, *point‑idx*, *ppem‑value*) quadruplet, the first entry in
577 the control instructions file wins.
579 Note that only character '`.`' is recognized as a decimal point, and a
580 thousands separator is not accepted.
582 As an example for delta instructions, let's assume that you want to
583 shift points 2, 3, and\ 4 in glyph `Aacute' at ppem sizes 12 and\ 13 by
584 a vertical amount of 0.25 pixels. This corresponds to the line
587 Aacute point 2-4 yshift 0.25 @ 12, 13
590 in a control instructions file.
592 The following images display glyphs from the font
593 [Halant-Regular](http://www.google.com/fonts/specimen/Halant).
595 ![The outlines of glyphs 'O' and 'Q', as displayed in
596 FontForge. They are sufficiently similar to expect that ttfautohint
597 hints them equally. However, this is not the
598 case.](img/Halant-Regular-O-Q.png)
600 ![The same glyphs, shown at 12px before hinting. [Please ignore the
601 outline distortion in the upper right of glyph 'O'; this is a bug in
602 FontForge while running the TrueType
603 debugger.]](img/Halant-Regular-O-Q-unhinted-12px.png)
605 ![Using only ttfautohint's '`-w gGD`' parameter to force strong stem
606 width and positioning, the hinting of glyph 'Q' is really bad, making
607 the glyph vertically two pixels larger! Reason is that this glyph
608 doesn't contain a horizontal segment at the baseline blue zone
609 (*y*\ =\ 1; this corresponds to the segment 13-14 in the 'O' glyph).
610 Normally, segment 1-2 would form a 'stem' with the baseline segment
611 (as segment 7-8 does in glyph 'O'). Instead, it forms a stem with
612 segment 19-20, which gets moved down (*y*\ =\ −1) because the whole
614 stretched.](img/Halant-Regular-O-good-Q-badly-hinted-12px.png)
616 ![To fix the problem, we change the direction of point\ 38 to 'left' by
617 writing a line '`Q left 38`' (without the quotes) to a control
618 description file `Halant-Regular.txt`. Adding option '`-m
619 Halant-Regular.txt`' to ttfautohint, we get the shown image as a
620 result, which is much better: Segment 1-2 now properly forms a stem
621 with our artificial one-point segment\ 38, and the 'O'-like shape is
622 properly positioned. However, there is still room for improvement:
623 Segment 19-20 is also positioned at the baseline, making the
624 connection between the 'O' shape and the tail too
625 thin.](img/Halant-Regular-O-good-Q-better-hinted-12px.png)
627 ![By giving the one-point segment\ 38 a horizontal width, we can prevent
628 that segment 19-20 gets positioned at the baseline: Replace the line
629 in the previous image description with '`Q left 38 (−70,20)`', making
630 the segment extend 70 font units to the left and 20 to the right of
631 point\ 38. The exact offset values don't matter; it's only important
632 to start left of point\ 19. Another solution to the problem is to
633 artificially change the direction of segment 19-20 by adding a second
634 line '`Q right 19-20`' to the control instructions file; for our 'Q'
635 glyph, this produces almost exactly the same hinting results. Note
636 that such direction changes only influence the hinting process; an
637 outline's direction won't be changed at
638 all.](img/Halant-Regular-O-good-Q-well-hinted-12px.png)
642 Watch input files (GUI only)
643 : If this checkbox is set, automatically regenerate the output file as
644 soon as an input file (either the font or the control instructions file)
647 Pressing the 'Run' button starts watching. If an error occurs, watching
648 stops and must be restarted with the 'Run' button.
650 `--ignore-restrictions`, `-i`
651 : By default, fonts that have bit\ 1 set in the 'fsType' field of the
652 `OS/2` table are rejected. If you have a permission of the font's legal
653 owner to modify the font, specify this command line option.
655 If this option is not set, `ttfautohintGUI` shows a dialogue to handle
656 such fonts if necessary.
659 : On the console, print a brief documentation on standard output and exit.
660 This doesn't work with `ttfautohintGUI` on MS Windows.
663 : On the console, print version information on standard output and exit.
664 This doesn't work with `ttfautohintGUI` on MS Windows.
667 : Print *a lot* of debugging information on standard error while
668 processing a font (you should redirect stderr to a file). This
669 doesn't work with `ttfautohintGUI` on MS Windows.
673 Background and Technical Details
674 ================================
676 [Real-Time Grid Fitting of Typographic
677 Outlines](http://www.tug.org/TUGboat/tb24-3/lemberg.pdf) is a scholarly
678 paper that describes FreeType's auto-hinter in some detail. Regarding the
679 described data structures it is slightly out of date, but the algorithm
680 itself hasn't changed in general.
682 The next few subsections are mainly based on this article, introducing some
683 important concepts. Note that ttfautohint only does hinting along the
684 vertical direction (modifying y\ coordinates only).
690 A glyph consists of one or more *contours* (this is, closed curves). For
691 example, glyph 'O' consists of two contours, while glyph 'I' has only one.
693 ![The letter 'O' has two contours, an inner and an outer one, while letter
694 'I' has only an outer contour.](img/o-and-i)
696 A *segment* is a series of consecutive points of a contour (including its
697 Bézier control points) that are approximately aligned along a coordinate
700 ![A serif. Contour and control points are represented by squares and
701 circles, respectively. The bottom 'line' DE is approximately aligned
702 along the horizontal axis, thus it forms a segment of 7\ points. Together
703 with the two other horizontal segments, BC and FG, they form two edges
704 (BC+FG, DE).](img/segment-edge)
706 An *edge* corresponds to a single coordinate value on the main dimension
707 that collects one or more segments (allowing for a small threshold). While
708 finding segments is done on the unscaled outline, finding edges is bound to
709 the device resolution. See [below](#hint-sets) for an example.
711 The analysis to find segments and edges is specific to a writing
712 system, see [below](#writing-systems).
718 The auto-hinter analyzes a font in two steps. Right now, everything
719 described here happens for the horizontal axis only, providing vertical
724 This affects the hinting of all glyphs, trying to give them a uniform
727 + Compute standard horizontal stem width of the font. The value
728 is normally taken from glyphs that resemble letter 'o'.
730 + Compute blue zones, see [below](#blue-zones).
732 If the stem widths of single glyphs differ by a large value, or if
733 ttfautohint fails to find proper blue zones, hinting becomes quite poor,
734 possibly leading even to severe shape distortions.
737 Table: script-specific standard characters of the 'latin' writing system
739 Script Standard characters
740 ---------- ---------------------
741 `cyrl` 'о', U+043E, CYRILLIC SMALL LETTER O
742 'О', U+041E, CYRILLIC CAPITAL LETTER O
743 `deva` 'ठ', U+0920, DEVANAGARI LETTER TTHA
744 'व', U+0935, DEVANAGARI LETTER VA
745 'ट', U+091F, DEVANAGARI LETTER TTA
746 `grek` 'ο', U+03BF, GREEK SMALL LETTER OMICRON
747 'Ο', U+039F, GREEK CAPITAL LETTER OMICRON
748 `hebr` 'ם', U+05DD, HEBREW LETTER FINAL MEM
749 `latn` 'o', U+006F, LATIN SMALL LETTER O
750 'O', U+004F, LATIN CAPITAL LETTER O
751 '0', U+0030, DIGIT ZERO
756 This is a per-glyph operation.
758 + Find segments and edges.
760 + Link edges together to find stems and serifs. The abovementioned
761 paper gives more details on what exactly constitutes a stem or a
762 serif and how the algorithm works.
768 ![Two blue zones relevant to the glyph 'a'. Vertical point coordinates of
769 *all* glyphs within these zones are aligned, provided the blue zone is
770 active (this is, its vertical size is smaller than
771 3/4\ pixels).](img/blue-zones)
773 Outlines of certain characters are used to determine *blue zones*. This
774 concept is the same as with Type\ 1 fonts: All glyph points that lie in
775 certain small horizontal zones get aligned vertically.
777 Here a series of tables that show the blue zone characters of the latin
778 writing system's available scripts; the values are hard-coded in the source
779 code. Since the auto-hinter takes mean values it is not necessary that all
780 characters of a zone are present.
783 Table: `latn` blue zones
785 ID Blue zone Characters
786 ---- ----------- ------------
787 1 top of capital letters THEZOCQS
788 2 bottom of capital letters HEZLOCUS
789 3 top of 'small f' like letters fijkdbh
790 4 top of small letters xzroesc
791 5 bottom of small letters xzroesc
792 6 bottom of descenders of small letters pqgjy
795 The 'round' characters (e.g. 'OCQS') from Zones 1, 2, and\ 5 are also used to
796 control the overshoot handling; to improve rendering at small sizes, zone\ 4
797 gets adjusted to be on the pixel grid; cf. the [`--increase-x-height`
798 option](#x-height-increase-limit).
801 Table: `grek` blue zones
803 ID Blue zone Characters
804 ---- ----------- ------------
805 1 top of capital letters ΓΒΕΖΘΟΩ
806 2 bottom of capital letters ΒΔΖΞΘΟ
807 3 top of 'small beta' like letters βθδζλξ
808 4 top of small letters αειοπστω
809 5 bottom of small letters αειοπστω
810 6 bottom of descenders of small letters βγημρφχψ
813 Table: `cyrl` blue zones
815 ID Blue zone Characters
816 ---- ----------- ------------
817 1 top of capital letters БВЕПЗОСЭ
818 2 bottom of capital letters БВЕШЗОСЭ
819 3 top of small letters хпншезос
820 4 bottom of small letters хпншезос
821 5 bottom of descenders of small letters руф
824 Table: `deva` blue zones
826 ID Blue zone Characters
827 ---- ----------- ------------
828 1 baseline (flat glyphs only) क न म उ छ ट ठ ड
829 2 top of ascenders ई ऐ ओ औ ि ी ो ौ
830 3 top of baseline क म अ आ थ ध भ श
831 4 bottom of descenders ु ृ
833 Contrary to scripts like latin, the baseline in Devanagari is on the top.
834 Note that some fonts have extreme variation in the height of the round
835 elements in Zone\ 3; for this reason we also define Zone\ 1, which must be
839 Table: `hebr` blue zones
841 ID Blue zone Characters
842 ---- ----------- ------------
843 1 top of letters בדהחךכםס
844 2 bottom of letters בטכםסצ
845 3 bottom of descenders of letters קךןףץ
848 ![This image shows the relevant glyph terms for vertical blue zone
849 positions.](img/glyph-terms)
855 Aligning outlines along the grid lines is called *grid fitting*. It doesn't
856 necessarily mean that the outlines are positioned *exactly* on the grid,
857 however, especially if you want a smooth appearance at different sizes.
858 This is the central routine of the auto-hinter; its actions are highly
859 dependent on the used writing system. Currently, only one writing system is
860 available (latin), providing support for scripts like Latin or Greek.
862 * Align edges linked to blue zones.
864 * Fit edges to the pixel grid.
868 * Handle remaining 'strong' points. Such points are not part of an edge
869 but are still important for defining the shape. This roughly
870 corresponds to the `IP` TrueType instruction.
872 * Everything else (the 'weak' points) is handled with an `IUP`
875 The following images illustrate the hinting process, using glyph 'a' from
876 the freely available font '[Ubuntu Book](http://font.ubuntu.com)'. The
877 manual hints were added by [Dalton Maag Ltd], the used application to create
878 the hinting debug snapshots was [FontForge].
880 ![Before hinting.](img/a-before-hinting.png)
882 ![After hinting, using manual hints.](img/a-after-hinting.png)
884 ![After hinting, using ttfautohint. Note that the hinting process
885 doesn't change horizontal positions.](img/a-after-autohinting.png)
891 In ttfautohint terminology, a *hint set* is the *optimal* configuration for
892 a given PPEM (pixel per EM) value.
894 In the range given by the `--hinting-range-min` and `--hinting-range-max`
895 options, ttfautohint creates hint sets for every PPEM value. For each
896 glyph, ttfautohint automatically determines whether a new set should be
897 emitted for a PPEM value if it finds that it differs from a previous one.
898 For some glyphs it is possible that one set covers, say, the range
899 8px-1000px, while other glyphs need 10 or more such sets.
901 In the PPEM range below `--hinting-range-min`, ttfautohint always uses just
902 one set, in the PPEM range between `--hinting-range-max` and
903 `--hinting-limit`, it also uses just one set.
905 One of the hinting configuration parameters is the decision which segments
906 form an edge. For example, let us assume that two segments get aligned on a
907 single horizontal edge at 11px, while two edges are used at 12px. This
908 change makes ttfautohint emit a new hint set to accomodate this situation.
909 The next images illustrate this, using a Cyrillic letter (glyph 'afii10108')
910 from the 'Ubuntu book' font, processed with ttfautohint.
912 ![Before hinting, size 11px.](img/afii10108-11px-before-hinting.png)
914 ![After hinting, size 11px. Segments 43-27-28 and 14-15 are aligned on a
915 single edge, as are segments 26-0-1 and
916 20-21.](img/afii10108-11px-after-hinting.png)
918 ![Before hinting, size 12px.](img/afii10108-12px-before-hinting.png)
920 ![After hinting, size 12px. The segments are not aligned. While
921 segments 43-27-28 and 20-21 now have almost the same horizontal position,
922 they don't form an edge because the outlines passing through the segments
923 point into different directions.](img/afii10108-12px-after-hinting.png)
925 Obviously, the more hint sets get emitted, the larger the bytecode
926 ttfautohint adds to the output font. To find a good value\ *n* for
927 `--hinting-range-max`, some experimentation is necessary since *n* depends
928 on the glyph shapes in the input font. If the value is too low, the hint
929 set created for the PPEM value\ *n* (this hint set gets used for all larger
930 PPEM values) might distort the outlines too much in the PPEM range given
931 by\ *n* and the value set by `--hinting-limit` (at which hinting gets
932 switched off). If the value is too high, the font size increases due to
933 more hint sets without any noticeable hinting effects.
935 Similar arguments hold for `--hinting-range-min` except that there is no
936 lower limit at which hinting is switched off.
938 An example. Let's assume that we have a hinting range 10\ <= ppem <=\ 100,
939 and the hinting limit is set to 250. For a given glyph, ttfautohint finds
940 out that four hint sets must be computed to exactly cover this hinting
941 range: 10-15, 16-40, 41-80, and 81-100. For ppem values below 10ppem, the
942 hint set covering 10-15ppem is used, for ppem values larger than 100 the
943 hint set covering 81-100ppem is used. For ppem values larger than 250, no
944 hinting gets applied.
950 The ttfautohint library (and programs) supports two solutions for handling
951 composite glyphs, to be controlled with [option
952 `--composites`](#hint-composites). This section contains some general
953 information, then covers the case where the option if off, while the next
954 section describes how ttfautohint behaves if this option is activated.
956 Regardless of the `--composites` option, ttfautohint performs a scan over
957 all composite glyphs to assure that components of a composite glyph inherit
958 its style, as described [later](#opentype-features). However, components
959 that are shifted vertically will be skipped. For example, if the glyph
960 'Agrave' uses a shifted 'grave' accent glyph, the accent is ignored. On the
961 other hand, if there is a glyph 'agrave' that uses the same 'grave' glyph
962 vertically unshifted, 'grave' does inherit the style.
964 If `--composites` is off, components are hinted separately, then put
965 together. Separate hinting implies that the current style's blue zones are
966 applied to all subglyphs in its original, unshifted positions.
969 The '\.ttfautohint' Glyph
970 -------------------------
972 If [option `--composites`](#hint-composites) is used, ttfautohint doesn't
973 hint subglyphs of composite glyphs separately. Instead, it hints the whole
974 glyph, this is, composites get recursively expanded internally so that they
975 form simple glyphs, then hints are applied -- this is the normal working
976 mode of FreeType's auto-hinter.
978 One problem, however, must be solved: Hinting for subglyphs (which usually
979 are used as normal glyphs also) must be deactivated so that nothing but the
980 final bytecode of the composite gets executed.
982 The trick used by ttfautohint is to prepend a composite element called
983 '\.ttfautohint', a dummy glyph with a single point, and which has a single
984 job: Its bytecode increases a variable (to be more precise, it is a CVT
985 register called `cvtl_is_subglyph` in the source code), indicating that we
986 are within a composite glyph. The final bytecode of the composite glyph
987 eventually decrements this variable again.
989 As an example, let's consider composite glyph 'Agrave' ('À'), which has the
990 subglyph 'A' as the base and 'grave' as its accent. After processing with
991 ttfautohint it consists of three components: '\.ttfautohint', 'A', and
992 'grave' (in this order).
995 ------------- --------
996 .ttfautohint increase `cvtl_is_subglyph` (now: 1)
997 A do nothing because `cvtl_is_subglyph` > 0
998 grave do nothing because `cvtl_is_subglyph` > 0
999 Agrave decrease `cvtl_is_subglyph` (now: 0)\
1000 apply hints because `cvtl_is_subglyph` == 0
1002 Some technical details (which you might skip): All glyph point indices get
1003 adjusted since each '\.ttfautohint' subglyph shifts all following indices by
1004 one. This must be done for both the bytecode and one subformat of
1005 OpenType's `GPOS` anchor tables.
1007 While this approach works fine on all tested platforms, there is one single
1008 drawback: Direct rendering of the '\.ttfautohint' subglyph (this is,
1009 rendering as a stand-alone glyph) disables proper hinting of all glyphs in
1010 the font! Under normal circumstances this never happens because
1011 '\.ttfautohint' doesn't have an entry in the font's `cmap` table. (However,
1012 some test and demo programs like FreeType's `ftview` application or other
1013 glyph viewers that are able to bypass the `cmap` table might be affected.)
1019 In FreeType terminology, a writing system is a set of functions that
1020 provides auto-hinting for certain scripts. Right now, only two writing
1021 systems from FreeType's auto-hinter are available in ttfautohint: 'dummy'
1022 and 'latin'. The former handles the 'no-script' case; details to 'latin'
1023 follow in the next section.
1029 ttfautohint needs to know which script should be used to hint a specific
1030 glyph. To do so, it checks a glyph's Unicode character code whether it
1031 belongs to a given script.
1033 Here is the hardcoded list of character ranges that are used for scripts in
1034 the 'latin' writing system. As you can see, this also covers some non-latin
1035 scripts (in the Unicode sense) that have similar typographical properties.
1037 In ttfautohint, scripts are identified by four-character tags. The value
1038 `none` indicates 'no script'.
1041 Table: `latn` character ranges
1043 Character range Description
1044 --------------------- -------------
1045 `0x0020` - `0x007F` Basic Latin (no control characters)
1046 `0x00A0` - `0x00FF` Latin-1 Supplement (no control characters)
1047 `0x0100` - `0x017F` Latin Extended-A
1048 `0x0180` - `0x024F` Latin Extended-B
1049 `0x0250` - `0x02AF` IPA Extensions
1050 `0x02B0` - `0x02FF` Spacing Modifier Letters
1051 `0x0300` - `0x036F` Combining Diacritical Marks
1052 `0x1D00` - `0x1D7F` Phonetic Extensions
1053 `0x1D80` - `0x1DBF` Phonetic Extensions Supplement
1054 `0x1DC0` - `0x1DFF` Combining Diacritical Marks Supplement
1055 `0x1E00` - `0x1EFF` Latin Extended Additional
1056 `0x2000` - `0x206F` General Punctuation
1057 `0x2070` - `0x209F` Superscripts and Subscripts
1058 `0x20A0` - `0x20CF` Currency Symbols
1059 `0x2150` - `0x218F` Number Forms
1060 `0x2460` - `0x24FF` Enclosed Alphanumerics
1061 `0x2C60` - `0x2C7F` Latin Extended-C
1062 `0x2E00` - `0x2E7F` Supplemental Punctuation
1063 `0xA720` - `0xA7FF` Latin Extended-D
1064 `0xFB00` - `0xFB06` Alphabetical Presentation Forms (Latin Ligatures)
1065 `0x1D400` - `0x1D7FF` Mathematical Alphanumeric Symbols
1066 `0x1F100` - `0x1F1FF` Enclosed Alphanumeric Supplement
1069 Table: `grek` character ranges
1071 Character range Description
1072 --------------------- -------------
1073 `0x0370` - `0x03FF` Greek and Coptic
1074 `0x1F00` - `0x1FFF` Greek Extended
1077 Table: `cyrl` character ranges
1079 Character range Description
1080 --------------------- -------------
1081 `0x0400` - `0x04FF` Cyrillic
1082 `0x0500` - `0x052F` Cyrillic Supplement
1083 `0x2DE0` - `0x2DFF` Cyrillic Extended-A
1084 `0xA640` - `0xA69F` Cyrillic Extended-B
1087 Table: `deva` character ranges
1089 Character range Description
1090 --------------------- -------------
1091 `0x0900` - `0x097F` Devanagari
1092 `0x20B9` (new) Rupee sign
1095 Table: `hebr` character ranges
1097 Character range Description
1098 --------------------- -------------
1099 `0x0590` - `0x05FF` Hebrew
1100 `0xFB1D` - `0xFB4F` Alphabetic Presentation Forms (Hebrew)
1103 If a glyph's character code is not covered by a script range, it is not
1104 hinted (or rather, it gets hinted by the 'dummy' auto-hinting module that
1105 essentially does nothing). This can be changed by specifying a *fallback
1106 script*; see [option `--fallback-script`](#fallback-script).
1112 (Please read the [OpenType specification] for details on *features*, `GSUB`,
1113 and `GPOS` tables, and how they relate to scripts.)
1115 For modern OpenType fonts, character ranges are not sufficient to handle
1118 * Due to glyph substitution in the font (as specified in a font's `GSUB`
1119 table), which handles ligatures and similar typographic features, there
1120 is no longer a one-to-one mapping from an input Unicode character to a
1121 glyph index. Some ligatures, like 'fi', actually do have Unicode values
1122 for historical reasons, but most of them don't. While it is possible to
1123 map ligature glyphs into Unicode's Private Use Area (PUA), code values
1124 from this area are arbitrary by definition and thus unusable for
1127 * Some features like `sups` (for handling superscript) completely change
1128 the appearance and even vertical position of the affected glyphs.
1129 Obviously, the blue zones for 'normal' glyphs no longer fit, thus the
1130 auto-hinter puts them into a separate group (called *style* in FreeType
1131 speak), having its own set of blue zones.
1134 Table: OpenType features handled specially by ttfautohint
1136 Feature tag Description
1137 --------------- -------------
1138 `c2cp` petite capitals from capitals
1139 `c2sc` small capitals from capitals
1141 `pcap` petite capitals
1142 `sinf` scientific inferiors
1143 `smcp` small capitals
1149 There are two conditions to get a valid style for a feature in a given
1152 1. One of the script's standard characters must be available in the
1155 2. The feature must provide characters to form at least one blue zone; see
1156 [above](#blue-zones).
1158 An additional complication is that features from the above table might use
1159 data not only from the `GSUB` but also from the `GPOS` table, containing
1160 information for glyph positioning. For example, the `sups` feature for
1161 superscripts might use the same glyphs as the `subs` feature for subscripts,
1162 simply moved up. ttfautohint skips such vertically shifted glyphs (except
1163 for accessing standard characters) because glyph positioning happens after
1164 hinting. Continuing our example, the `sups` feature wouldn't form a style,
1165 contrary to `subs`, which holds the unshifted glyphs.
1167 The remaining OpenType features of a script are not handled specially; the
1168 affected glyphs are simply hinted together with the 'normal' glyphs of the
1171 Note that a font might still contain some features not covered yet: OpenType
1172 has the concept of a *default script*; its data gets used for all scripts
1173 that aren't explicitly handled in a font. By default, ttfautohint unifies
1174 all affected glyphs from default script features with the `latn` script.
1175 This can be changed with [option `--default-script`](#default-script), if
1179 ttfautohint uses the [HarfBuzz] library for handling OpenType features.
1185 ttfautohint touches almost all SFNT tables within a TrueType or OpenType
1186 font. Note that only OpenType fonts with TrueType outlines are supported.
1187 OpenType fonts with a `CFF` table (this is, with PostScript outlines) won't
1190 * `glyf`: All hints in the table are replaced with new ones. If option
1191 [`--composites`](#hint-composites) is used, one glyph gets added (namely
1192 the '\.ttfautohint' glyph) and all composites get an additional
1195 * `cvt`, `prep`, and `fpgm`: These tables get replaced with data
1196 necessary for the new hinting bytecode.
1198 * `gasp`: Set up to always use grayscale rendering, for all sizes, with
1199 grid-fitting for standard hinting, and symmetric grid-fitting and
1200 symmetric smoothing for horizontal subpixel hinting (ClearType).
1202 * `DSIG`: If it exists, it gets replaced with a dummy version.
1203 ttfautohint can't digitally sign a font; you have to do that afterwards.
1205 * `name`: The 'version' entries are modified to add information about the
1206 parameters that have been used for calling ttfautohint. This can be
1207 controlled with the [`--no-info`](#add-ttfautohint-info) option.
1209 * `GPOS`, `hmtx`, `loca`, `head`, `maxp`, `post`: Updated to fit the
1210 additional '\.ttfautohint' glyph, the additional subglyphs in
1211 composites, and the new hinting bytecode.
1213 * `LTSH`, `hdmx`: Since ttfautohint doesn't do any horizontal hinting,
1214 those tables are superfluous and thus removed.
1216 * `VDMX`: Removed, since it depends on the original bytecode, which
1217 ttfautohint removes. A font editor might recompute the necessary data
1224 ### Interaction With FreeType
1226 Recent versions of FreeType have an experimental extension for handling
1227 subpixel hinting; it is off by default and can be activated by defining the
1228 macro `TT_CONFIG_OPTION_SUBPIXEL_HINTING` at compile time. This code has
1229 been contributed mainly by [Infinality], being a subset of his original
1230 patch. Many GNU/Linux distributions activate this code, or provide packages
1233 This extension changes the behaviour of many bytecode instructions to get
1234 better rendering results. However, not all changes are global; some of them
1235 are specific to certain fonts. For example, it contains font-specific
1236 improvements for the '[DejaVu] Sans' font family. The list of affected
1237 fonts is hard-coded; it can be found in FreeType's source code file
1240 If you are going to process such specially-handled fonts with ttfautohint,
1241 serious rendering problems might show up. Since ttfautohint (intentionally)
1242 doesn't change the font name in the `name` table, the Infinality extension
1243 has no chance to recognize that the hints are different. All such problems
1244 vanish if the font gets renamed in its `name` table (the name of the font
1245 file itself doesn't matter).
1247 ### Incorrect Unicode Character Map
1249 Fonts with an incorrect Unicode `cmap` table will not be properly hinted by
1250 ttfautohint. Especially older fonts do cheat; for example, there exist
1251 Hebrew fonts that map its glyphs to character codes 'A', 'B', etc., to make
1252 them work with non-localized versions of Windows\ 98, say.
1254 Since ttfautohint needs to find both standard and blue zone characters, it
1255 relies on correct Unicode values. If you want to handle such fonts, please
1256 fix their `cmap` tables accordingly.
1258 ### Irregular Glyph Heights
1260 The central concept of ttfautohint's hinting algorithm, as discussed
1261 [above](#segments-and-edges), is to identify horizontal segments at extremum
1262 positions, especially for blue zones. If such a segment is missing, it
1263 cannot be associated with a blue zone, possibly leading to irregular heights
1264 for the particular glyph.
1266 Normally, a segment has a horizontal length of at least 20\ font units
1267 (assuming 2048 units per EM)^[To be more precise, the sum of the height and
1268 length of a segment must be at least 20 font units, and the height multiplied
1269 by\ 14 must not exceed the length. Thus (19,1) is also a valid minimum
1270 (length,height) pair, while (18,2) isn't. The value\ 20 is heuristic and
1271 hard-coded, as is the value\ 14 (corresponding to a slope of approx.
1272 4.1°).]. Using a [Control Instructions File](#control-instructions-file),
1273 however, it is possible to define additional segments at arbitrary points
1274 that help overcome this restriction, making it possible to fix (most of)
1279 ttfautohint doesn't handle diagonal lines specially. For thin outlines,
1280 this might lead to strokes that look too thick at smaller sizes. A font
1281 designer might compensate this to a certain amount by slightly reducing the
1282 stroke width of diagonal lines. However, in many cases the sub-optimal
1283 appearance of a stroke with borders that don't exactly fit the pixel grid is
1284 not the outline itself but an incorrect gamma value of the monitor: People
1285 tend to not properly adjust it, and the default values of most operating
1286 systems are too low, causing too much darkening of such strokes. It is thus
1287 of vital importance to compare ttfautohint's results with similar fonts to
1288 exclude any systematic effect not related to the outlines themselves.