Use `Control_Type' to handle different segment directions.
[ttfautohint.git] / lib / tablue.dat
blob92785dd32102588abb897c19815a46b32112ae74
1 // tablue.dat
2 //
3 // Auto-fitter data for blue strings.
4 //
5 // Copyright (C) 2013-2014 by Werner Lemberg.
6 //
7 // This file is part of the ttfautohint library, and may only be used,
8 // modified, and distributed under the terms given in `COPYING'. By
9 // continuing to use, modify, or distribute this file you indicate that you
10 // have read `COPYING' and understand and accept it fully.
12 // The file `COPYING' mentioned in the previous paragraph is distributed
13 // with the ttfautohint library.
15 // originally file `afblue.dat' (2013-Sep-22) from FreeType */
18 // This file contains data specific to blue zones. It gets processed by
19 // a script to simulate `jagged arrays', with enumeration values holding
20 // offsets into the arrays.
22 // The format of the file is rather simple: A section starts with three
23 // labels separated by whitespace and followed by a colon (everything in a
24 // single line); the first label gives the name of the enumeration template,
25 // the second the name of the array template, and the third the name of the
26 // `maximum' template, holding the size of the largest array element. The
27 // script then fills the corresponding templates (indicated by `@'
28 // characters around the name).
30 // A section contains one or more data records. Each data record consists
31 // of two or more lines. The first line holds the enumeration name, and the
32 // remaining lines the corresponding array data.
34 // There are two possible representations for array data.
36 // - A string of characters in UTF-8 encoding enclosed in double quotes,
37 // using C syntax. There can be only one string per line, thus the
38 // starting and ending double quote must be the first and last character
39 // in the line, respectively, ignoring whitespace before and after the
40 // string. Space characters within the string are ignored too. If there
41 // are multiple strings (in multiple lines), they are concatenated to a
42 // single string. In the output, a string gets represented as a series of
43 // singles bytes, followed by a zero byte. The enumeration values simply
44 // hold byte offsets to the start of the corresponding strings.
46 // - Data blocks enclosed in balanced braces, which get copied verbatim and
47 // which can span multiple lines. The opening brace of a block must be
48 // the first character of a line (ignoring whitespace), and the closing
49 // brace the last (ignoring whitespace also). The script appends a comma
50 // character after each block and counts the number of blocks to set the
51 // enumeration values.
53 // A section can contain either strings only or data blocks only.
55 // A comment line starts with `//'; it gets removed. A preprocessor
56 // directive line (using the standard syntax of `cpp') starts with `#' and
57 // gets copied verbatim to both the enumeration and the array. Whitespace
58 // outside of a string is insignificant.
60 // Preprocessor directives are ignored while the script computes maximum
61 // values; this essentially means that the maximum values can easily be too
62 // large. Given that the purpose of those values is to create local
63 // fixed-size arrays at compile time for further processing of the blue zone
64 // data, this isn't a problem. Note the the final zero byte of a string is
65 // not counted. Note also that the count holds the number of UTF-8 encoded
66 // characters, not bytes.
69 // The blue zone string data, to be used in the blue stringsets below.
71 TA_BLUE_STRING_ENUM TA_BLUE_STRINGS_ARRAY TA_BLUE_STRING_MAX_LEN:
73 TA_BLUE_STRING_CYRILLIC_CAPITAL_TOP
74 "БВЕПЗОСЭ"
75 TA_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM
76 "БВЕШЗОСЭ"
77 TA_BLUE_STRING_CYRILLIC_SMALL
78 "хпншезос"
79 TA_BLUE_STRING_CYRILLIC_SMALL_DESCENDER
80 "руф"
82 // we separate the letters with spaces to avoid ligatures;
83 // this is just for convenience to simplify reading
84 TA_BLUE_STRING_DEVANAGARI_BASE
85 "क न म उ छ ट ठ ड"
86 TA_BLUE_STRING_DEVANAGARI_TOP
87 "ई ऐ ओ औ ि ी ो ौ"
88 // note that some fonts have extreme variation in the height of the
89 // round head elements; for this reason we also define the `base'
90 // blue zone, which must be always present
91 TA_BLUE_STRING_DEVANAGARI_HEAD
92 "क म अ आ थ ध भ श"
93 TA_BLUE_STRING_DEVANAGARI_BOTTOM
94 "ु ृ"
96 TA_BLUE_STRING_GREEK_CAPITAL_TOP
97 "ΓΒΕΖΘΟΩ"
98 TA_BLUE_STRING_GREEK_CAPITAL_BOTTOM
99 "ΒΔΖΞΘΟ"
100 TA_BLUE_STRING_GREEK_SMALL_BETA_TOP
101 "βθδζλξ"
102 TA_BLUE_STRING_GREEK_SMALL
103 "αειοπστω"
104 TA_BLUE_STRING_GREEK_SMALL_DESCENDER
105 "βγημρφχψ"
107 TA_BLUE_STRING_HEBREW_TOP
108 "בדהחךכםס"
109 TA_BLUE_STRING_HEBREW_BOTTOM
110 "בטכםסצ"
111 TA_BLUE_STRING_HEBREW_DESCENDER
112 "קךןףץ"
114 TA_BLUE_STRING_LATIN_CAPITAL_TOP
115 "THEZOCQS"
116 TA_BLUE_STRING_LATIN_CAPITAL_BOTTOM
117 "HEZLOCUS"
118 TA_BLUE_STRING_LATIN_SMALL_F_TOP
119 "fijkdbh"
120 TA_BLUE_STRING_LATIN_SMALL
121 "xzroesc"
122 TA_BLUE_STRING_LATIN_SMALL_DESCENDER
123 "pqgjy"
126 // The blue zone stringsets, as used in the script styles, cf. `tastyles.h'.
128 // The TA_BLUE_PROPERTY_XXX flags are defined in `tablue.h'; here some
129 // explanations.
131 // A blue zone in general is defined by a reference and an overshoot line.
132 // During the hinting process, all coordinate values between those two lines
133 // are set equal to the reference value, provided that the blue zone is not
134 // wider than 0.75 pixels (otherwise the blue zone gets ignored). All
135 // entries must have `TA_BLUE_STRING_MAX' as the final line.
137 // During the glyph analysis, edges are sorted from bottom to top, and then
138 // sequentially checked, edge by edge, against the blue zones in the order
139 // given below.
142 // latin auto-hinter
143 // -----------------
145 // Characters in a blue string are automatically classified as having a flat
146 // (reference) or a round (overshoot) extremum. The blue zone is then set
147 // up by the mean values of all flat extrema and all round extrema,
148 // respectively. Only horizontal blue zones (i.e., adjusting vertical
149 // coordinate values) are supported.
151 // For the latin auto-hinter, the overshoot should be larger than the
152 // reference for top zones, and vice versa for bottom zones.
154 // LATIN_TOP
155 // Take the maximum flat and round coordinate values of the blue string
156 // characters for computing the blue zone's reference and overshoot
157 // values.
159 // If not set, take the minimum values.
161 // LATIN_NEUTRAL
162 // Ignore round extrema and define the blue zone with flat values only.
163 // Both top and bottom of contours can match. This is useful for
164 // scripts like Devanagari where vowel signs attach to the base
165 // character and are implemented as components of composite glyphs.
167 // If not set, both round and flat extrema are taken into account.
168 // Additionally, only the top or the bottom of a contour can match,
169 // depending on the LATIN_TOP flag.
171 // Neutral blue zones should always follow non-neutral blue zones.
173 // LATIN_X_HEIGHT
174 // Scale all glyphs vertically from the corresponding script to make the
175 // reference line of this blue zone align on the grid. The scaling
176 // takes place before all other blue zones get aligned to the grid.
177 // Only one blue character string of a script style can have this flag.
179 // LATIN_LONG
180 // Apply an additional constraint for blue zone values: Don't
181 // necessarily use the extremum as-is but a segment of the topmost (or
182 // bottommost) contour that is longer than a heuristic threshold, and
183 // which is not too far away vertically from the real extremum. This
184 // ensures that small bumps in the outline are ignored (for example, the
185 // `vertical serifs' found in many Hebrew glyph designs).
187 // The segment must be at least EM/25 font units long, and the distance
188 // to the extremum must be smaller than EM/4.
191 TA_BLUE_STRINGSET_ENUM TA_BLUE_STRINGSETS_ARRAY TA_BLUE_STRINGSET_MAX_LEN:
193 TA_BLUE_STRINGSET_CYRL
194 { TA_BLUE_STRING_CYRILLIC_CAPITAL_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
195 { TA_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 }
196 { TA_BLUE_STRING_CYRILLIC_SMALL, TA_BLUE_PROPERTY_LATIN_TOP |
197 TA_BLUE_PROPERTY_LATIN_X_HEIGHT }
198 { TA_BLUE_STRING_CYRILLIC_SMALL, 0 }
199 { TA_BLUE_STRING_CYRILLIC_SMALL_DESCENDER, 0 }
200 { TA_BLUE_STRING_MAX, 0 }
202 TA_BLUE_STRINGSET_DEVA
203 { TA_BLUE_STRING_DEVANAGARI_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
204 { TA_BLUE_STRING_DEVANAGARI_HEAD, TA_BLUE_PROPERTY_LATIN_TOP }
205 { TA_BLUE_STRING_DEVANAGARI_BASE, TA_BLUE_PROPERTY_LATIN_TOP |
206 TA_BLUE_PROPERTY_LATIN_NEUTRAL |
207 TA_BLUE_PROPERTY_LATIN_X_HEIGHT }
208 { TA_BLUE_STRING_DEVANAGARI_BASE, 0 }
209 { TA_BLUE_STRING_DEVANAGARI_BOTTOM, 0 }
210 { TA_BLUE_STRING_MAX, 0 }
212 TA_BLUE_STRINGSET_GREK
213 { TA_BLUE_STRING_GREEK_CAPITAL_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
214 { TA_BLUE_STRING_GREEK_CAPITAL_BOTTOM, 0 }
215 { TA_BLUE_STRING_GREEK_SMALL_BETA_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
216 { TA_BLUE_STRING_GREEK_SMALL, TA_BLUE_PROPERTY_LATIN_TOP |
217 TA_BLUE_PROPERTY_LATIN_X_HEIGHT }
218 { TA_BLUE_STRING_GREEK_SMALL, 0 }
219 { TA_BLUE_STRING_GREEK_SMALL_DESCENDER, 0 }
220 { TA_BLUE_STRING_MAX, 0 }
222 TA_BLUE_STRINGSET_HEBR
223 { TA_BLUE_STRING_HEBREW_TOP, TA_BLUE_PROPERTY_LATIN_TOP |
224 TA_BLUE_PROPERTY_LATIN_LONG }
225 { TA_BLUE_STRING_HEBREW_BOTTOM, 0 }
226 { TA_BLUE_STRING_HEBREW_DESCENDER, 0 }
227 { TA_BLUE_STRING_MAX, 0 }
229 TA_BLUE_STRINGSET_LATN
230 { TA_BLUE_STRING_LATIN_CAPITAL_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
231 { TA_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 }
232 { TA_BLUE_STRING_LATIN_SMALL_F_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
233 { TA_BLUE_STRING_LATIN_SMALL, TA_BLUE_PROPERTY_LATIN_TOP |
234 TA_BLUE_PROPERTY_LATIN_X_HEIGHT }
235 { TA_BLUE_STRING_LATIN_SMALL, 0 }
236 { TA_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 }
237 { TA_BLUE_STRING_MAX, 0 }
239 // END