Synchronize with FreeType.
[ttfautohint.git] / lib / tablue.dat
blob9fc41b5eeaefe2ca52fd963a181cbb52e8c51072
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"
125 // we separate the letters with spaces to avoid ligatures;
126 // this is just for convenience to simplify reading
127 TA_BLUE_STRING_TELUGU_TOP
128 "ఇ ఌ ఙ ఞ ణ ఱ ౯"
130 TA_BLUE_STRING_TELUGU_BOTTOM
131 "అ క చ ర ఽ ౨ ౬"
133 // The blue zone stringsets, as used in the script styles, cf. `tastyles.h'.
135 // The TA_BLUE_PROPERTY_XXX flags are defined in `tablue.h'; here some
136 // explanations.
138 // A blue zone in general is defined by a reference and an overshoot line.
139 // During the hinting process, all coordinate values between those two lines
140 // are set equal to the reference value, provided that the blue zone is not
141 // wider than 0.75 pixels (otherwise the blue zone gets ignored). All
142 // entries must have `TA_BLUE_STRING_MAX' as the final line.
144 // During the glyph analysis, edges are sorted from bottom to top, and then
145 // sequentially checked, edge by edge, against the blue zones in the order
146 // given below.
149 // latin auto-hinter
150 // -----------------
152 // Characters in a blue string are automatically classified as having a flat
153 // (reference) or a round (overshoot) extremum. The blue zone is then set
154 // up by the mean values of all flat extrema and all round extrema,
155 // respectively. Only horizontal blue zones (i.e., adjusting vertical
156 // coordinate values) are supported.
158 // For the latin auto-hinter, the overshoot should be larger than the
159 // reference for top zones, and vice versa for bottom zones.
161 // LATIN_TOP
162 // Take the maximum flat and round coordinate values of the blue string
163 // characters for computing the blue zone's reference and overshoot
164 // values.
166 // If not set, take the minimum values.
168 // LATIN_NEUTRAL
169 // Ignore round extrema and define the blue zone with flat values only.
170 // Both top and bottom of contours can match. This is useful for
171 // scripts like Devanagari where vowel signs attach to the base
172 // character and are implemented as components of composite glyphs.
174 // If not set, both round and flat extrema are taken into account.
175 // Additionally, only the top or the bottom of a contour can match,
176 // depending on the LATIN_TOP flag.
178 // Neutral blue zones should always follow non-neutral blue zones.
180 // LATIN_X_HEIGHT
181 // Scale all glyphs vertically from the corresponding script to make the
182 // reference line of this blue zone align on the grid. The scaling
183 // takes place before all other blue zones get aligned to the grid.
184 // Only one blue character string of a script style can have this flag.
186 // LATIN_LONG
187 // Apply an additional constraint for blue zone values: Don't
188 // necessarily use the extremum as-is but a segment of the topmost (or
189 // bottommost) contour that is longer than a heuristic threshold, and
190 // which is not too far away vertically from the real extremum. This
191 // ensures that small bumps in the outline are ignored (for example, the
192 // `vertical serifs' found in many Hebrew glyph designs).
194 // The segment must be at least EM/25 font units long, and the distance
195 // to the extremum must be smaller than EM/4.
198 TA_BLUE_STRINGSET_ENUM TA_BLUE_STRINGSETS_ARRAY TA_BLUE_STRINGSET_MAX_LEN:
200 TA_BLUE_STRINGSET_CYRL
201 { TA_BLUE_STRING_CYRILLIC_CAPITAL_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
202 { TA_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM, 0 }
203 { TA_BLUE_STRING_CYRILLIC_SMALL, TA_BLUE_PROPERTY_LATIN_TOP |
204 TA_BLUE_PROPERTY_LATIN_X_HEIGHT }
205 { TA_BLUE_STRING_CYRILLIC_SMALL, 0 }
206 { TA_BLUE_STRING_CYRILLIC_SMALL_DESCENDER, 0 }
207 { TA_BLUE_STRING_MAX, 0 }
209 TA_BLUE_STRINGSET_DEVA
210 { TA_BLUE_STRING_DEVANAGARI_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
211 { TA_BLUE_STRING_DEVANAGARI_HEAD, TA_BLUE_PROPERTY_LATIN_TOP }
212 { TA_BLUE_STRING_DEVANAGARI_BASE, TA_BLUE_PROPERTY_LATIN_TOP |
213 TA_BLUE_PROPERTY_LATIN_NEUTRAL |
214 TA_BLUE_PROPERTY_LATIN_X_HEIGHT }
215 { TA_BLUE_STRING_DEVANAGARI_BASE, 0 }
216 { TA_BLUE_STRING_DEVANAGARI_BOTTOM, 0 }
217 { TA_BLUE_STRING_MAX, 0 }
219 TA_BLUE_STRINGSET_GREK
220 { TA_BLUE_STRING_GREEK_CAPITAL_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
221 { TA_BLUE_STRING_GREEK_CAPITAL_BOTTOM, 0 }
222 { TA_BLUE_STRING_GREEK_SMALL_BETA_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
223 { TA_BLUE_STRING_GREEK_SMALL, TA_BLUE_PROPERTY_LATIN_TOP |
224 TA_BLUE_PROPERTY_LATIN_X_HEIGHT }
225 { TA_BLUE_STRING_GREEK_SMALL, 0 }
226 { TA_BLUE_STRING_GREEK_SMALL_DESCENDER, 0 }
227 { TA_BLUE_STRING_MAX, 0 }
229 TA_BLUE_STRINGSET_HEBR
230 { TA_BLUE_STRING_HEBREW_TOP, TA_BLUE_PROPERTY_LATIN_TOP |
231 TA_BLUE_PROPERTY_LATIN_LONG }
232 { TA_BLUE_STRING_HEBREW_BOTTOM, 0 }
233 { TA_BLUE_STRING_HEBREW_DESCENDER, 0 }
234 { TA_BLUE_STRING_MAX, 0 }
236 TA_BLUE_STRINGSET_LATN
237 { TA_BLUE_STRING_LATIN_CAPITAL_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
238 { TA_BLUE_STRING_LATIN_CAPITAL_BOTTOM, 0 }
239 { TA_BLUE_STRING_LATIN_SMALL_F_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
240 { TA_BLUE_STRING_LATIN_SMALL, TA_BLUE_PROPERTY_LATIN_TOP |
241 TA_BLUE_PROPERTY_LATIN_X_HEIGHT }
242 { TA_BLUE_STRING_LATIN_SMALL, 0 }
243 { TA_BLUE_STRING_LATIN_SMALL_DESCENDER, 0 }
244 { TA_BLUE_STRING_MAX, 0 }
246 TA_BLUE_STRINGSET_TELU
247 { TA_BLUE_STRING_TELUGU_TOP, TA_BLUE_PROPERTY_LATIN_TOP }
248 { TA_BLUE_STRING_TELUGU_BOTTOM, 0 }
249 { TA_BLUE_STRING_MAX, 0 }
251 // END