1//  afblue.dat
2//
3//    Auto-fitter data for blue strings.
4//
5//  Copyright 2013-2015 by
6//  David Turner, Robert Wilhelm, and Werner Lemberg.
7//
8//  This file is part of the FreeType project, and may only be used,
9//  modified, and distributed under the terms of the FreeType project
10//  license, LICENSE.TXT.  By continuing to use, modify, or distribute
11//  this file you indicate that you have read the license and
12//  understand and accept it fully.
13
14
15// This file contains data specific to blue zones.  It gets processed by
16// a script to simulate `jagged arrays', with enumeration values holding
17// offsets into the arrays.
18//
19// The format of the file is rather simple:  A section starts with three
20// labels separated by whitespace and followed by a colon (everything in a
21// single line); the first label gives the name of the enumeration template,
22// the second the name of the array template, and the third the name of the
23// `maximum' template, holding the size of the largest array element.  The
24// script then fills the corresponding templates (indicated by `@'
25// characters around the name).
26//
27// A section contains one or more data records.  Each data record consists
28// of two or more lines.  The first line holds the enumeration name, and the
29// remaining lines the corresponding array data.
30//
31// There are two possible representations for array data.
32//
33// - A string of characters in UTF-8 encoding enclosed in double quotes,
34//   using C syntax.  There can be only one string per line, thus the
35//   starting and ending double quote must be the first and last character
36//   in the line, respectively, ignoring whitespace before and after the
37//   string.  Space characters within the string are ignored too.  If there
38//   are multiple strings (in multiple lines), they are concatenated to a
39//   single string.  In the output, a string gets represented as a series of
40//   singles bytes, followed by a zero byte.  The enumeration values simply
41//   hold byte offsets to the start of the corresponding strings.
42//
43// - Data blocks enclosed in balanced braces, which get copied verbatim and
44//   which can span multiple lines.  The opening brace of a block must be
45//   the first character of a line (ignoring whitespace), and the closing
46//   brace the last (ignoring whitespace also).  The script appends a comma
47//   character after each block and counts the number of blocks to set the
48//   enumeration values.
49//
50// A section can contain either strings only or data blocks only.
51//
52// A comment line starts with `//'; it gets removed.  A preprocessor
53// directive line (using the standard syntax of `cpp') starts with `#' and
54// gets copied verbatim to both the enumeration and the array.  Whitespace
55// outside of a string is insignificant.
56//
57// Preprocessor directives are ignored while the script computes maximum
58// values; this essentially means that the maximum values can easily be too
59// large.  Given that the purpose of those values is to create local
60// fixed-size arrays at compile time for further processing of the blue zone
61// data, this isn't a problem.  Note the the final zero byte of a string is
62// not counted.  Note also that the count holds the number of UTF-8 encoded
63// characters, not bytes.
64
65
66// The blue zone string data, to be used in the blue stringsets below.
67
68AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
69
70  AF_BLUE_STRING_ARABIC_TOP
71    "ا إ ل ك ط ظ"
72  AF_BLUE_STRING_ARABIC_JOIN
73    "ت ث ط ظ ك"
74
75  AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP
76    "БВЕПЗОСЭ"
77  AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM
78    "БВЕШЗОСЭ"
79  AF_BLUE_STRING_CYRILLIC_SMALL
80    "хпншезос"
81  AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER
82    "руф"
83
84  // we separate the letters with spaces to avoid ligatures;
85  // this is just for convenience to simplify reading
86  AF_BLUE_STRING_DEVANAGARI_BASE
87    "क म अ आ थ ध भ श"
88  AF_BLUE_STRING_DEVANAGARI_TOP
89    "ई ऐ ओ औ ि ी ो ौ"
90  // note that some fonts have extreme variation in the height of the
91  // round head elements; for this reason we also define the `base'
92  // blue zone, which must be always present
93  AF_BLUE_STRING_DEVANAGARI_HEAD
94    "क म अ आ थ ध भ श"
95  AF_BLUE_STRING_DEVANAGARI_BOTTOM
96    "ु ृ"
97
98  AF_BLUE_STRING_GREEK_CAPITAL_TOP
99    "ΓΒΕΖΘΟΩ"
100  AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM
101    "ΒΔΖΞΘΟ"
102  AF_BLUE_STRING_GREEK_SMALL_BETA_TOP
103    "βθδζλξ"
104  AF_BLUE_STRING_GREEK_SMALL
105    "αειοπστω"
106  AF_BLUE_STRING_GREEK_SMALL_DESCENDER
107    "βγημρφχψ"
108
109  AF_BLUE_STRING_HEBREW_TOP
110    "בדהחךכםס"
111  AF_BLUE_STRING_HEBREW_BOTTOM
112    "בטכםסצ"
113  AF_BLUE_STRING_HEBREW_DESCENDER
114    "קךןףץ"
115
116  AF_BLUE_STRING_LATIN_CAPITAL_TOP
117    "THEZOCQS"
118  AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM
119    "HEZLOCUS"
120  AF_BLUE_STRING_LATIN_SMALL_F_TOP
121    "fijkdbh"
122  AF_BLUE_STRING_LATIN_SMALL
123    "xzroesc"
124  AF_BLUE_STRING_LATIN_SMALL_DESCENDER
125    "pqgjy"
126
127  // we separate the letters with spaces to avoid ligatures;
128  // this is just for convenience to simplify reading
129  AF_BLUE_STRING_TELUGU_TOP
130    "ఇ ఌ ఙ ఞ ణ ఱ ౯"
131  AF_BLUE_STRING_TELUGU_BOTTOM
132    "అ క చ ర ఽ ౨ ౬"
133
134  AF_BLUE_STRING_THAI_TOP
135    "บ เ แ อ ก า"
136  AF_BLUE_STRING_THAI_BOTTOM
137    "บ ป ษ ฯ อ ย ฮ"
138  AF_BLUE_STRING_THAI_ASCENDER
139    "ป ฝ ฟ"
140  AF_BLUE_STRING_THAI_LARGE_ASCENDER
141    "โ ใ ไ"
142  AF_BLUE_STRING_THAI_DESCENDER
143    "ฎ ฏ ฤ ฦ"
144  AF_BLUE_STRING_THAI_LARGE_DESCENDER
145    "ญ ฐ"
146  AF_BLUE_STRING_THAI_DIGIT_TOP
147    "๐ ๑ ๓"
148
149
150#ifdef AF_CONFIG_OPTION_CJK
151
152  AF_BLUE_STRING_CJK_TOP
153    "他们你來們到和地"
154    "对對就席我时時會"
155    "来為能舰說说这這"
156    "齊 |"
157    "军同已愿既星是景"
158    "民照现現理用置要"
159    "軍那配里開雷露面"
160    "顾"
161  AF_BLUE_STRING_CJK_BOTTOM
162    "个为人他以们你來"
163    "個們到和大对對就"
164    "我时時有来為要說"
165    "说 |"
166    "主些因它想意理生"
167    "當看着置者自著裡"
168    "过还进進過道還里"
169    "面"
170
171#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
172
173  AF_BLUE_STRING_CJK_LEFT
174    "些们你來們到和地"
175    "她将將就年得情最"
176    "样樣理能說说这這"
177    "通 |"
178    "即吗吧听呢品响嗎"
179    "师師收断斷明眼間"
180    "间际陈限除陳随際"
181    "隨"
182  AF_BLUE_STRING_CJK_RIGHT
183    "事前學将將情想或"
184    "政斯新样樣民沒没"
185    "然特现現球第經谁"
186    "起 |"
187    "例別别制动動吗嗎"
188    "增指明朝期构物确"
189    "种調调費费那都間"
190    "间"
191
192#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
193
194#endif /* AF_CONFIG_OPTION_CJK                */
195
196
197// The blue zone stringsets, as used in the script styles, cf. `afstyles.h'.
198//
199// The AF_BLUE_PROPERTY_XXX flags are defined in `afblue.h'; here some
200// explanations.
201//
202// A blue zone in general is defined by a reference and an overshoot line.
203// During the hinting process, all coordinate values between those two lines
204// are set equal to the reference value, provided that the blue zone is not
205// wider than 0.75 pixels (otherwise the blue zone gets ignored).  All
206// entries must have `AF_BLUE_STRING_MAX' as the final line.
207//
208// During the glyph analysis, edges are sorted from bottom to top, and then
209// sequentially checked, edge by edge, against the blue zones in the order
210// given below.
211//
212//
213// latin auto-hinter
214// -----------------
215//
216// Characters in a blue string are automatically classified as having a flat
217// (reference) or a round (overshoot) extremum.  The blue zone is then set
218// up by the mean values of all flat extrema and all round extrema,
219// respectively.  Only horizontal blue zones (i.e., adjusting vertical
220// coordinate values) are supported.
221//
222// For the latin auto-hinter, the overshoot should be larger than the
223// reference for top zones, and vice versa for bottom zones.
224//
225//   LATIN_TOP
226//     Take the maximum flat and round coordinate values of the blue string
227//     characters for computing the blue zone's reference and overshoot
228//     values.
229//
230//     If not set, take the minimum values.
231//
232//   LATIN_NEUTRAL
233//     Ignore round extrema and define the blue zone with flat values only.
234//     Both top and bottom of contours can match.  This is useful for
235//     scripts like Devanagari where vowel signs attach to the base
236//     character and are implemented as components of composite glyphs.
237//
238//     If not set, both round and flat extrema are taken into account.
239//     Additionally, only the top or the bottom of a contour can match,
240//     depending on the LATIN_TOP flag.
241//
242//     Neutral blue zones should always follow non-neutral blue zones.
243//
244//   LATIN_X_HEIGHT
245//     Scale all glyphs vertically from the corresponding script to make the
246//     reference line of this blue zone align on the grid.  The scaling
247//     takes place before all other blue zones get aligned to the grid.
248//     Only one blue character string of a script style can have this flag.
249//
250//   LATIN_LONG
251//     Apply an additional constraint for blue zone values: Don't
252//     necessarily use the extremum as-is but a segment of the topmost (or
253//     bottommost) contour that is longer than a heuristic threshold, and
254//     which is not too far away vertically from the real extremum.  This
255//     ensures that small bumps in the outline are ignored (for example, the
256//     `vertical serifs' found in many Hebrew glyph designs).
257//
258//     The segment must be at least EM/25 font units long, and the distance
259//     to the extremum must be smaller than EM/4.
260//
261//
262// cjk auto-hinter
263// ---------------
264//
265// Characters in a blue string are *not* automatically classified.  Instead,
266// first come the characters used for the overshoot value, then the
267// character `|', then the characters used for the reference value.  The
268// blue zone is then set up by the mean values of all reference values and
269// all overshoot values, respectively.  Both horizontal and vertical blue
270// zones (i.e., adjusting vertical and horizontal coordinate values,
271// respectively) are supported.
272//
273// For the cjk auto-hinter, the overshoot should be smaller than the
274// reference for top zones, and vice versa for bottom zones.
275//
276//   CJK_TOP
277//     Take the maximum flat and round coordinate values of the blue string
278//     characters.  If not set, take the minimum values.
279//
280//   CJK_RIGHT
281//     A synonym for CJK_TOP.  If CJK_HORIZ is set, this flag indicates the
282//     right blue zone, taking horizontal maximum values.
283//
284//   CJK_HORIZ
285//     Define a blue zone for horizontal hinting (i.e., vertical blue
286//     zones).  If not set, this is a blue zone for vertical hinting.
287
288
289AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
290
291  AF_BLUE_STRINGSET_ARAB
292    { AF_BLUE_STRING_ARABIC_TOP,   AF_BLUE_PROPERTY_LATIN_TOP }
293    { AF_BLUE_STRING_ARABIC_JOIN,  0                          }
294    { AF_BLUE_STRING_MAX,          0                          }
295
296  AF_BLUE_STRINGSET_CYRL
297    { AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP,     AF_BLUE_PROPERTY_LATIN_TOP        }
298    { AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM,  0                                 }
299    { AF_BLUE_STRING_CYRILLIC_SMALL,           AF_BLUE_PROPERTY_LATIN_TOP      |
300                                               AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
301    { AF_BLUE_STRING_CYRILLIC_SMALL,           0                                 }
302    { AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER, 0                                 }
303    { AF_BLUE_STRING_MAX,                      0                                 }
304
305  AF_BLUE_STRINGSET_DEVA
306    { AF_BLUE_STRING_DEVANAGARI_TOP,    AF_BLUE_PROPERTY_LATIN_TOP        }
307    { AF_BLUE_STRING_DEVANAGARI_HEAD,   AF_BLUE_PROPERTY_LATIN_TOP        }
308    { AF_BLUE_STRING_DEVANAGARI_BASE,   AF_BLUE_PROPERTY_LATIN_TOP      |
309                                        AF_BLUE_PROPERTY_LATIN_NEUTRAL  |
310                                        AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
311    { AF_BLUE_STRING_DEVANAGARI_BASE,   0                                 }
312    { AF_BLUE_STRING_DEVANAGARI_BOTTOM, 0                                 }
313    { AF_BLUE_STRING_MAX,               0                                 }
314
315  AF_BLUE_STRINGSET_GREK
316    { AF_BLUE_STRING_GREEK_CAPITAL_TOP,     AF_BLUE_PROPERTY_LATIN_TOP        }
317    { AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM,  0                                 }
318    { AF_BLUE_STRING_GREEK_SMALL_BETA_TOP,  AF_BLUE_PROPERTY_LATIN_TOP        }
319    { AF_BLUE_STRING_GREEK_SMALL,           AF_BLUE_PROPERTY_LATIN_TOP      |
320                                            AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
321    { AF_BLUE_STRING_GREEK_SMALL,           0                                 }
322    { AF_BLUE_STRING_GREEK_SMALL_DESCENDER, 0                                 }
323    { AF_BLUE_STRING_MAX,                   0                                 }
324
325  AF_BLUE_STRINGSET_HEBR
326    { AF_BLUE_STRING_HEBREW_TOP,       AF_BLUE_PROPERTY_LATIN_TOP  |
327                                       AF_BLUE_PROPERTY_LATIN_LONG   }
328    { AF_BLUE_STRING_HEBREW_BOTTOM,    0                             }
329    { AF_BLUE_STRING_HEBREW_DESCENDER, 0                             }
330    { AF_BLUE_STRING_MAX,              0                             }
331
332  AF_BLUE_STRINGSET_LATN
333    { AF_BLUE_STRING_LATIN_CAPITAL_TOP,     AF_BLUE_PROPERTY_LATIN_TOP        }
334    { AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM,  0                                 }
335    { AF_BLUE_STRING_LATIN_SMALL_F_TOP,     AF_BLUE_PROPERTY_LATIN_TOP        }
336    { AF_BLUE_STRING_LATIN_SMALL,           AF_BLUE_PROPERTY_LATIN_TOP      |
337                                            AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
338    { AF_BLUE_STRING_LATIN_SMALL,           0                                 }
339    { AF_BLUE_STRING_LATIN_SMALL_DESCENDER, 0                                 }
340    { AF_BLUE_STRING_MAX,                   0                                 }
341
342  AF_BLUE_STRINGSET_TELU
343    { AF_BLUE_STRING_TELUGU_TOP,    AF_BLUE_PROPERTY_LATIN_TOP }
344    { AF_BLUE_STRING_TELUGU_BOTTOM, 0                          }
345    { AF_BLUE_STRING_MAX,           0                          }
346
347  AF_BLUE_STRINGSET_THAI
348    { AF_BLUE_STRING_THAI_TOP,             AF_BLUE_PROPERTY_LATIN_TOP      |
349                                           AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
350    { AF_BLUE_STRING_THAI_BOTTOM,          0                                 }
351    { AF_BLUE_STRING_THAI_ASCENDER,        AF_BLUE_PROPERTY_LATIN_TOP        }
352    { AF_BLUE_STRING_THAI_LARGE_ASCENDER,  AF_BLUE_PROPERTY_LATIN_TOP        }
353    { AF_BLUE_STRING_THAI_DESCENDER,       0                                 }
354    { AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0                                 }
355    { AF_BLUE_STRING_THAI_DIGIT_TOP,       0                                 }
356    { AF_BLUE_STRING_MAX,                  0                                 }
357
358
359#ifdef AF_CONFIG_OPTION_CJK
360
361  AF_BLUE_STRINGSET_HANI
362    { AF_BLUE_STRING_CJK_TOP,    AF_BLUE_PROPERTY_CJK_TOP     }
363    { AF_BLUE_STRING_CJK_BOTTOM, 0                            }
364#ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT
365    { AF_BLUE_STRING_CJK_LEFT,   AF_BLUE_PROPERTY_CJK_HORIZ   }
366    { AF_BLUE_STRING_CJK_RIGHT,  AF_BLUE_PROPERTY_CJK_HORIZ |
367                                 AF_BLUE_PROPERTY_CJK_RIGHT   }
368#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */
369    { AF_BLUE_STRING_MAX,        0                            }
370
371#endif /* AF_CONFIG_OPTION_CJK                */
372
373
374// END
375