3 // Auto
-fitter
data for blue strings.
5 // Copyright
(C
) 2013-2015 by Werner Lemberg.
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_ARABIC_TOP
75 TA_BLUE_STRING_ARABIC_JOIN
78 TA_BLUE_STRING_CYRILLIC_CAPITAL_TOP
80 TA_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM
82 TA_BLUE_STRING_CYRILLIC_SMALL
84 TA_BLUE_STRING_CYRILLIC_SMALL_DESCENDER
87 // we separate the letters with spaces to avoid ligatures;
88 // this is just for convenience to simplify reading
89 TA_BLUE_STRING_DEVANAGARI_BASE
91 TA_BLUE_STRING_DEVANAGARI_TOP
93 // note that some fonts have extreme variation in the height of the
94 // round head elements; for this reason we also define the `base'
95 // blue zone
, which must be always present
96 TA_BLUE_STRING_DEVANAGARI_HEAD
98 TA_BLUE_STRING_DEVANAGARI_BOTTOM
101 TA_BLUE_STRING_GREEK_CAPITAL_TOP
103 TA_BLUE_STRING_GREEK_CAPITAL_BOTTOM
105 TA_BLUE_STRING_GREEK_SMALL_BETA_TOP
107 TA_BLUE_STRING_GREEK_SMALL
109 TA_BLUE_STRING_GREEK_SMALL_DESCENDER
112 TA_BLUE_STRING_HEBREW_TOP
114 TA_BLUE_STRING_HEBREW_BOTTOM
116 TA_BLUE_STRING_HEBREW_DESCENDER
119 TA_BLUE_STRING_LATIN_CAPITAL_TOP
121 TA_BLUE_STRING_LATIN_CAPITAL_BOTTOM
123 TA_BLUE_STRING_LATIN_SMALL_F_TOP
125 TA_BLUE_STRING_LATIN_SMALL
127 TA_BLUE_STRING_LATIN_SMALL_DESCENDER
130 // we separate the letters with spaces
to avoid ligatures
;
131 // this is just for convenience
to simplify reading
132 TA_BLUE_STRING_TELUGU_TOP
134 TA_BLUE_STRING_TELUGU_BOTTOM
137 TA_BLUE_STRING_THAI_TOP
139 TA_BLUE_STRING_THAI_BOTTOM
141 TA_BLUE_STRING_THAI_ASCENDER
143 TA_BLUE_STRING_THAI_LARGE_ASCENDER
145 TA_BLUE_STRING_THAI_DESCENDER
147 TA_BLUE_STRING_THAI_LARGE_DESCENDER
149 TA_BLUE_STRING_THAI_DIGIT_TOP
152 // The blue zone stringsets
, as used
in the script styles
, cf. `tastyles.h
'.
154 // The TA_BLUE_PROPERTY_XXX flags are defined in `tablue.h'; here some
157 // A blue zone
in general is defined
by a reference
and an overshoot line.
158 // During the hinting process
, all coordinate values between those two lines
159 // are
set equal
to the reference value
, provided that the blue zone is
not
160 // wider than
0.75 pixels
(otherwise the blue zone gets ignored
). All
161 // entries must have `TA_BLUE_STRING_MAX
' as the final line.
163 // During the glyph analysis, edges are sorted from bottom to top, and then
164 // sequentially checked, edge by edge, against the blue zones in the order
171 // Characters in a blue string are automatically classified as having a flat
172 // (reference) or a round (overshoot) extremum. The blue zone is then set
173 // up by the mean values of all flat extrema and all round extrema,
174 // respectively. Only horizontal blue zones (i.e., adjusting vertical
175 // coordinate values) are supported.
177 // For the latin auto-hinter, the overshoot should be larger than the
178 // reference for top zones, and vice versa for bottom zones.
181 // Take the maximum flat and round coordinate values of the blue string
182 // characters for computing the blue zone's reference
and overshoot
185 // If
not set, take the minimum values.
188 // Ignore
round extrema
and define the blue zone with flat values only.
189 // Both top
and bottom of contours can match. This is useful for
190 // scripts like Devanagari where vowel signs attach
to the base
191 // character
and are implemented as components of composite glyphs.
193 // If
not set, both
round and flat extrema are taken into account.
194 // Additionally
, only the top
or the bottom of a contour can match
,
195 // depending on the LATIN_TOP flag.
197 // Neutral blue zones should always follow non
-neutral blue zones.
200 // Scale all glyphs vertically
from the corresponding script
to make the
201 // reference line of this blue zone align on the grid. The scaling
202 // takes place before all other blue zones get aligned
to the grid.
203 // Only one blue character string of a script style can have this flag.
206 // Apply an additional constraint for blue zone values
: Don
't
207 // necessarily use the extremum as-is but a segment of the topmost (or
208 // bottommost) contour that is longer than a heuristic threshold, and
209 // which is not too far away vertically from the real extremum. This
210 // ensures that small bumps in the outline are ignored (for example, the
211 // `vertical serifs' found
in many Hebrew glyph designs
).
213 // The segment must be at least EM
/25 font units long
, and the distance
214 // to the extremum must be smaller than EM
/4.
217 TA_BLUE_STRINGSET_ENUM TA_BLUE_STRINGSETS_ARRAY TA_BLUE_STRINGSET_MAX_LEN
:
219 TA_BLUE_STRINGSET_ARAB
220 { TA_BLUE_STRING_ARABIC_TOP
, TA_BLUE_PROPERTY_LATIN_TOP
}
221 { TA_BLUE_STRING_ARABIC_JOIN
, 0 }
222 { TA_BLUE_STRING_MAX
, 0 }
224 TA_BLUE_STRINGSET_CYRL
225 { TA_BLUE_STRING_CYRILLIC_CAPITAL_TOP
, TA_BLUE_PROPERTY_LATIN_TOP
}
226 { TA_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM
, 0 }
227 { TA_BLUE_STRING_CYRILLIC_SMALL
, TA_BLUE_PROPERTY_LATIN_TOP |
228 TA_BLUE_PROPERTY_LATIN_X_HEIGHT
}
229 { TA_BLUE_STRING_CYRILLIC_SMALL
, 0 }
230 { TA_BLUE_STRING_CYRILLIC_SMALL_DESCENDER
, 0 }
231 { TA_BLUE_STRING_MAX
, 0 }
233 TA_BLUE_STRINGSET_DEVA
234 { TA_BLUE_STRING_DEVANAGARI_TOP
, TA_BLUE_PROPERTY_LATIN_TOP
}
235 { TA_BLUE_STRING_DEVANAGARI_HEAD
, TA_BLUE_PROPERTY_LATIN_TOP
}
236 { TA_BLUE_STRING_DEVANAGARI_BASE
, TA_BLUE_PROPERTY_LATIN_TOP |
237 TA_BLUE_PROPERTY_LATIN_NEUTRAL |
238 TA_BLUE_PROPERTY_LATIN_X_HEIGHT
}
239 { TA_BLUE_STRING_DEVANAGARI_BASE
, 0 }
240 { TA_BLUE_STRING_DEVANAGARI_BOTTOM
, 0 }
241 { TA_BLUE_STRING_MAX
, 0 }
243 TA_BLUE_STRINGSET_GREK
244 { TA_BLUE_STRING_GREEK_CAPITAL_TOP
, TA_BLUE_PROPERTY_LATIN_TOP
}
245 { TA_BLUE_STRING_GREEK_CAPITAL_BOTTOM
, 0 }
246 { TA_BLUE_STRING_GREEK_SMALL_BETA_TOP
, TA_BLUE_PROPERTY_LATIN_TOP
}
247 { TA_BLUE_STRING_GREEK_SMALL
, TA_BLUE_PROPERTY_LATIN_TOP |
248 TA_BLUE_PROPERTY_LATIN_X_HEIGHT
}
249 { TA_BLUE_STRING_GREEK_SMALL
, 0 }
250 { TA_BLUE_STRING_GREEK_SMALL_DESCENDER
, 0 }
251 { TA_BLUE_STRING_MAX
, 0 }
253 TA_BLUE_STRINGSET_HEBR
254 { TA_BLUE_STRING_HEBREW_TOP
, TA_BLUE_PROPERTY_LATIN_TOP |
255 TA_BLUE_PROPERTY_LATIN_LONG
}
256 { TA_BLUE_STRING_HEBREW_BOTTOM
, 0 }
257 { TA_BLUE_STRING_HEBREW_DESCENDER
, 0 }
258 { TA_BLUE_STRING_MAX
, 0 }
260 TA_BLUE_STRINGSET_LATN
261 { TA_BLUE_STRING_LATIN_CAPITAL_TOP
, TA_BLUE_PROPERTY_LATIN_TOP
}
262 { TA_BLUE_STRING_LATIN_CAPITAL_BOTTOM
, 0 }
263 { TA_BLUE_STRING_LATIN_SMALL_F_TOP
, TA_BLUE_PROPERTY_LATIN_TOP
}
264 { TA_BLUE_STRING_LATIN_SMALL
, TA_BLUE_PROPERTY_LATIN_TOP |
265 TA_BLUE_PROPERTY_LATIN_X_HEIGHT
}
266 { TA_BLUE_STRING_LATIN_SMALL
, 0 }
267 { TA_BLUE_STRING_LATIN_SMALL_DESCENDER
, 0 }
268 { TA_BLUE_STRING_MAX
, 0 }
270 TA_BLUE_STRINGSET_TELU
271 { TA_BLUE_STRING_TELUGU_TOP
, TA_BLUE_PROPERTY_LATIN_TOP
}
272 { TA_BLUE_STRING_TELUGU_BOTTOM
, 0 }
273 { TA_BLUE_STRING_MAX
, 0 }
275 TA_BLUE_STRINGSET_THAI
276 { TA_BLUE_STRING_THAI_TOP
, TA_BLUE_PROPERTY_LATIN_TOP |
277 TA_BLUE_PROPERTY_LATIN_X_HEIGHT
}
278 { TA_BLUE_STRING_THAI_BOTTOM
, 0 }
279 { TA_BLUE_STRING_THAI_ASCENDER
, TA_BLUE_PROPERTY_LATIN_TOP
}
280 { TA_BLUE_STRING_THAI_LARGE_ASCENDER
, TA_BLUE_PROPERTY_LATIN_TOP
}
281 { TA_BLUE_STRING_THAI_DESCENDER
, 0 }
282 { TA_BLUE_STRING_THAI_LARGE_DESCENDER
, 0 }
283 { TA_BLUE_STRING_THAI_DIGIT_TOP
, 0 }
284 { TA_BLUE_STRING_MAX
, 0 }