1 /* This file has been generated by the Perl script `afblue.pl', */ 2 /* using data from file `afblue.dat'. */ 3 4 /***************************************************************************/ 5 /* */ 6 /* afblue.h */ 7 /* */ 8 /* Auto-fitter data for blue strings (specification). */ 9 /* */ 10 /* Copyright 2013-2017 by */ 11 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 12 /* */ 13 /* This file is part of the FreeType project, and may only be used, */ 14 /* modified, and distributed under the terms of the FreeType project */ 15 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 16 /* this file you indicate that you have read the license and */ 17 /* understand and accept it fully. */ 18 /* */ 19 /***************************************************************************/ 20 21 22 #ifndef AFBLUE_H_ 23 #define AFBLUE_H_ 24 25 26 FT_BEGIN_HEADER 27 28 29 /* an auxiliary macro to decode a UTF-8 character -- since we only use */ 30 /* hard-coded, self-converted data, no error checking is performed */ 31 #define GET_UTF8_CHAR( ch, p ) \ 32 do \ 33 { \ 34 ch = (unsigned char)*p++; \ 35 if ( ch >= 0x80 ) \ 36 { \ 37 FT_UInt len_; \ 38 \ 39 \ 40 if ( ch < 0xE0 ) \ 41 { \ 42 len_ = 1; \ 43 ch &= 0x1F; \ 44 } \ 45 else if ( ch < 0xF0 ) \ 46 { \ 47 len_ = 2; \ 48 ch &= 0x0F; \ 49 } \ 50 else \ 51 { \ 52 len_ = 3; \ 53 ch &= 0x07; \ 54 } \ 55 \ 56 for ( ; len_ > 0; len_-- ) \ 57 ch = ( ch << 6 ) | ( *p++ & 0x3F ); \ 58 } \ 59 } while ( 0 ) 60 61 62 /*************************************************************************/ 63 /*************************************************************************/ 64 /***** *****/ 65 /***** B L U E S T R I N G S *****/ 66 /***** *****/ 67 /*************************************************************************/ 68 /*************************************************************************/ 69 70 /* At the bottommost level, we define strings for finding blue zones. */ 71 72 73 #define AF_BLUE_STRING_MAX_LEN 51 74 75 /* The AF_Blue_String enumeration values are offsets into the */ 76 /* `af_blue_strings' array. */ 77 78 typedef enum AF_Blue_String_ 79 { 80 AF_BLUE_STRING_ARABIC_TOP = 0, 81 AF_BLUE_STRING_ARABIC_BOTTOM = 18, 82 AF_BLUE_STRING_ARABIC_JOIN = 33, 83 AF_BLUE_STRING_ARMENIAN_CAPITAL_TOP = 36, 84 AF_BLUE_STRING_ARMENIAN_CAPITAL_BOTTOM = 60, 85 AF_BLUE_STRING_ARMENIAN_SMALL_ASCENDER = 84, 86 AF_BLUE_STRING_ARMENIAN_SMALL_TOP = 105, 87 AF_BLUE_STRING_ARMENIAN_SMALL_BOTTOM = 129, 88 AF_BLUE_STRING_ARMENIAN_SMALL_DESCENDER = 153, 89 AF_BLUE_STRING_BENGALI_BASE = 177, 90 AF_BLUE_STRING_BENGALI_TOP = 209, 91 AF_BLUE_STRING_BENGALI_HEAD = 237, 92 AF_BLUE_STRING_CHEROKEE_CAPITAL = 269, 93 AF_BLUE_STRING_CHEROKEE_SMALL_ASCENDER = 301, 94 AF_BLUE_STRING_CHEROKEE_SMALL = 333, 95 AF_BLUE_STRING_CHEROKEE_SMALL_DESCENDER = 365, 96 AF_BLUE_STRING_CYRILLIC_CAPITAL_TOP = 381, 97 AF_BLUE_STRING_CYRILLIC_CAPITAL_BOTTOM = 405, 98 AF_BLUE_STRING_CYRILLIC_SMALL = 429, 99 AF_BLUE_STRING_CYRILLIC_SMALL_DESCENDER = 453, 100 AF_BLUE_STRING_DEVANAGARI_BASE = 462, 101 AF_BLUE_STRING_DEVANAGARI_TOP = 494, 102 AF_BLUE_STRING_DEVANAGARI_HEAD = 526, 103 AF_BLUE_STRING_DEVANAGARI_BOTTOM = 558, 104 AF_BLUE_STRING_ETHIOPIC_TOP = 566, 105 AF_BLUE_STRING_ETHIOPIC_BOTTOM = 598, 106 AF_BLUE_STRING_GEORGIAN_MKHEDRULI_TOP = 630, 107 AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM = 662, 108 AF_BLUE_STRING_GEORGIAN_MKHEDRULI_ASCENDER = 694, 109 AF_BLUE_STRING_GEORGIAN_MKHEDRULI_DESCENDER = 726, 110 AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_TOP = 758, 111 AF_BLUE_STRING_GEORGIAN_ASOMTAVRULI_BOTTOM = 790, 112 AF_BLUE_STRING_GEORGIAN_NUSKHURI_TOP = 822, 113 AF_BLUE_STRING_GEORGIAN_NUSKHURI_BOTTOM = 854, 114 AF_BLUE_STRING_GEORGIAN_NUSKHURI_ASCENDER = 886, 115 AF_BLUE_STRING_GEORGIAN_NUSKHURI_DESCENDER = 918, 116 AF_BLUE_STRING_GREEK_CAPITAL_TOP = 950, 117 AF_BLUE_STRING_GREEK_CAPITAL_BOTTOM = 971, 118 AF_BLUE_STRING_GREEK_SMALL_BETA_TOP = 989, 119 AF_BLUE_STRING_GREEK_SMALL = 1007, 120 AF_BLUE_STRING_GREEK_SMALL_DESCENDER = 1031, 121 AF_BLUE_STRING_GUJARATI_TOP = 1055, 122 AF_BLUE_STRING_GUJARATI_BOTTOM = 1087, 123 AF_BLUE_STRING_GUJARATI_ASCENDER = 1119, 124 AF_BLUE_STRING_GUJARATI_DESCENDER = 1169, 125 AF_BLUE_STRING_GUJARATI_DIGIT_TOP = 1202, 126 AF_BLUE_STRING_GURMUKHI_BASE = 1222, 127 AF_BLUE_STRING_GURMUKHI_HEAD = 1254, 128 AF_BLUE_STRING_GURMUKHI_TOP = 1286, 129 AF_BLUE_STRING_GURMUKHI_BOTTOM = 1318, 130 AF_BLUE_STRING_GURMUKHI_DIGIT_TOP = 1350, 131 AF_BLUE_STRING_HEBREW_TOP = 1370, 132 AF_BLUE_STRING_HEBREW_BOTTOM = 1394, 133 AF_BLUE_STRING_HEBREW_DESCENDER = 1412, 134 AF_BLUE_STRING_KANNADA_TOP = 1427, 135 AF_BLUE_STRING_KANNADA_BOTTOM = 1471, 136 AF_BLUE_STRING_KHMER_TOP = 1503, 137 AF_BLUE_STRING_KHMER_SUBSCRIPT_TOP = 1527, 138 AF_BLUE_STRING_KHMER_BOTTOM = 1567, 139 AF_BLUE_STRING_KHMER_DESCENDER = 1599, 140 AF_BLUE_STRING_KHMER_LARGE_DESCENDER = 1633, 141 AF_BLUE_STRING_KHMER_SYMBOLS_WAXING_TOP = 1720, 142 AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM = 1728, 143 AF_BLUE_STRING_LAO_TOP = 1736, 144 AF_BLUE_STRING_LAO_BOTTOM = 1768, 145 AF_BLUE_STRING_LAO_ASCENDER = 1800, 146 AF_BLUE_STRING_LAO_LARGE_ASCENDER = 1816, 147 AF_BLUE_STRING_LAO_DESCENDER = 1828, 148 AF_BLUE_STRING_LATIN_CAPITAL_TOP = 1852, 149 AF_BLUE_STRING_LATIN_CAPITAL_BOTTOM = 1868, 150 AF_BLUE_STRING_LATIN_SMALL_F_TOP = 1884, 151 AF_BLUE_STRING_LATIN_SMALL_TOP = 1898, 152 AF_BLUE_STRING_LATIN_SMALL_BOTTOM = 1914, 153 AF_BLUE_STRING_LATIN_SMALL_DESCENDER = 1930, 154 AF_BLUE_STRING_LATIN_SUBS_CAPITAL_TOP = 1940, 155 AF_BLUE_STRING_LATIN_SUBS_CAPITAL_BOTTOM = 1960, 156 AF_BLUE_STRING_LATIN_SUBS_SMALL_F_TOP = 1980, 157 AF_BLUE_STRING_LATIN_SUBS_SMALL = 2000, 158 AF_BLUE_STRING_LATIN_SUBS_SMALL_DESCENDER = 2036, 159 AF_BLUE_STRING_LATIN_SUPS_CAPITAL_TOP = 2056, 160 AF_BLUE_STRING_LATIN_SUPS_CAPITAL_BOTTOM = 2087, 161 AF_BLUE_STRING_LATIN_SUPS_SMALL_F_TOP = 2116, 162 AF_BLUE_STRING_LATIN_SUPS_SMALL = 2142, 163 AF_BLUE_STRING_LATIN_SUPS_SMALL_DESCENDER = 2167, 164 AF_BLUE_STRING_MALAYALAM_TOP = 2178, 165 AF_BLUE_STRING_MALAYALAM_BOTTOM = 2222, 166 AF_BLUE_STRING_MYANMAR_TOP = 2254, 167 AF_BLUE_STRING_MYANMAR_BOTTOM = 2286, 168 AF_BLUE_STRING_MYANMAR_ASCENDER = 2318, 169 AF_BLUE_STRING_MYANMAR_DESCENDER = 2346, 170 AF_BLUE_STRING_SINHALA_TOP = 2378, 171 AF_BLUE_STRING_SINHALA_BOTTOM = 2410, 172 AF_BLUE_STRING_SINHALA_DESCENDER = 2442, 173 AF_BLUE_STRING_TAMIL_TOP = 2486, 174 AF_BLUE_STRING_TAMIL_BOTTOM = 2518, 175 AF_BLUE_STRING_TELUGU_TOP = 2550, 176 AF_BLUE_STRING_TELUGU_BOTTOM = 2578, 177 AF_BLUE_STRING_THAI_TOP = 2606, 178 AF_BLUE_STRING_THAI_BOTTOM = 2630, 179 AF_BLUE_STRING_THAI_ASCENDER = 2658, 180 AF_BLUE_STRING_THAI_LARGE_ASCENDER = 2670, 181 AF_BLUE_STRING_THAI_DESCENDER = 2682, 182 AF_BLUE_STRING_THAI_LARGE_DESCENDER = 2698, 183 AF_BLUE_STRING_THAI_DIGIT_TOP = 2706, 184 af_blue_1_1 = 2717, 185 #ifdef AF_CONFIG_OPTION_CJK 186 AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, 187 AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, 188 af_blue_1_1_1 = af_blue_1_1 + 404, 189 #ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT 190 AF_BLUE_STRING_CJK_LEFT = af_blue_1_1_1 + 1, 191 AF_BLUE_STRING_CJK_RIGHT = af_blue_1_1_1 + 204, 192 af_blue_1_1_2 = af_blue_1_1_1 + 405, 193 #else 194 af_blue_1_1_2 = af_blue_1_1_1 + 0, 195 #endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */ 196 af_blue_1_2 = af_blue_1_1_2 + 0, 197 #else 198 af_blue_1_2 = af_blue_1_1 + 0, 199 #endif /* AF_CONFIG_OPTION_CJK */ 200 201 202 AF_BLUE_STRING_MAX /* do not remove */ 203 204 } AF_Blue_String; 205 206 207 FT_LOCAL_ARRAY( char ) 208 af_blue_strings[]; 209 210 211 /*************************************************************************/ 212 /*************************************************************************/ 213 /***** *****/ 214 /***** B L U E S T R I N G S E T S *****/ 215 /***** *****/ 216 /*************************************************************************/ 217 /*************************************************************************/ 218 219 /* The next level is to group blue strings into style-specific sets. */ 220 221 222 /* Properties are specific to a writing system. We assume that a given */ 223 /* blue string can't be used in more than a single writing system, which */ 224 /* is a safe bet. */ 225 #define AF_BLUE_PROPERTY_LATIN_TOP ( 1U << 0 ) /* must have value 1 */ 226 #define AF_BLUE_PROPERTY_LATIN_SUB_TOP ( 1U << 1 ) 227 #define AF_BLUE_PROPERTY_LATIN_NEUTRAL ( 1U << 2 ) 228 #define AF_BLUE_PROPERTY_LATIN_X_HEIGHT ( 1U << 3 ) 229 #define AF_BLUE_PROPERTY_LATIN_LONG ( 1U << 4 ) 230 231 #define AF_BLUE_PROPERTY_CJK_TOP ( 1U << 0 ) /* must have value 1 */ 232 #define AF_BLUE_PROPERTY_CJK_HORIZ ( 1U << 1 ) /* must have value 2 */ 233 #define AF_BLUE_PROPERTY_CJK_RIGHT AF_BLUE_PROPERTY_CJK_TOP 234 235 236 #define AF_BLUE_STRINGSET_MAX_LEN 8 237 238 /* The AF_Blue_Stringset enumeration values are offsets into the */ 239 /* `af_blue_stringsets' array. */ 240 241 typedef enum AF_Blue_Stringset_ 242 { 243 AF_BLUE_STRINGSET_ARAB = 0, 244 AF_BLUE_STRINGSET_ARMN = 4, 245 AF_BLUE_STRINGSET_BENG = 11, 246 AF_BLUE_STRINGSET_CHER = 16, 247 AF_BLUE_STRINGSET_CYRL = 23, 248 AF_BLUE_STRINGSET_DEVA = 29, 249 AF_BLUE_STRINGSET_ETHI = 35, 250 AF_BLUE_STRINGSET_GEOR = 38, 251 AF_BLUE_STRINGSET_GEOK = 43, 252 AF_BLUE_STRINGSET_GREK = 50, 253 AF_BLUE_STRINGSET_GUJR = 57, 254 AF_BLUE_STRINGSET_GURU = 63, 255 AF_BLUE_STRINGSET_HEBR = 69, 256 AF_BLUE_STRINGSET_KNDA = 73, 257 AF_BLUE_STRINGSET_KHMR = 76, 258 AF_BLUE_STRINGSET_KHMS = 82, 259 AF_BLUE_STRINGSET_LAO = 85, 260 AF_BLUE_STRINGSET_LATN = 91, 261 AF_BLUE_STRINGSET_LATB = 98, 262 AF_BLUE_STRINGSET_LATP = 105, 263 AF_BLUE_STRINGSET_MLYM = 112, 264 AF_BLUE_STRINGSET_MYMR = 115, 265 AF_BLUE_STRINGSET_NONE = 120, 266 AF_BLUE_STRINGSET_SINH = 121, 267 AF_BLUE_STRINGSET_TAML = 125, 268 AF_BLUE_STRINGSET_TELU = 128, 269 AF_BLUE_STRINGSET_THAI = 131, 270 af_blue_2_1 = 139, 271 #ifdef AF_CONFIG_OPTION_CJK 272 AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, 273 af_blue_2_1_1 = af_blue_2_1 + 2, 274 #ifdef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT 275 af_blue_2_1_2 = af_blue_2_1_1 + 2, 276 #else 277 af_blue_2_1_2 = af_blue_2_1_1 + 0, 278 #endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */ 279 af_blue_2_2 = af_blue_2_1_2 + 1, 280 #else 281 af_blue_2_2 = af_blue_2_1 + 0, 282 #endif /* AF_CONFIG_OPTION_CJK */ 283 284 285 AF_BLUE_STRINGSET_MAX /* do not remove */ 286 287 } AF_Blue_Stringset; 288 289 290 typedef struct AF_Blue_StringRec_ 291 { 292 AF_Blue_String string; 293 FT_UShort properties; 294 295 } AF_Blue_StringRec; 296 297 298 FT_LOCAL_ARRAY( AF_Blue_StringRec ) 299 af_blue_stringsets[]; 300 301 /* */ 302 303 FT_END_HEADER 304 305 306 #endif /* AFBLUE_H_ */ 307 308 309 /* END */ 310