OLD | NEW |
(Empty) | |
| 1 |
| 2 #line 1 "hb-ot-shape-complex-indic-machine.rl" |
| 3 /* |
| 4 * Copyright © 2011 Google, Inc. |
| 5 * |
| 6 * This is part of HarfBuzz, a text shaping library. |
| 7 * |
| 8 * Permission is hereby granted, without written agreement and without |
| 9 * license or royalty fees, to use, copy, modify, and distribute this |
| 10 * software and its documentation for any purpose, provided that the |
| 11 * above copyright notice and the following two paragraphs appear in |
| 12 * all copies of this software. |
| 13 * |
| 14 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
| 15 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
| 16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
| 17 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 18 * DAMAGE. |
| 19 * |
| 20 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
| 21 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 22 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
| 23 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
| 24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 25 * |
| 26 * Google Author(s): Behdad Esfahbod |
| 27 */ |
| 28 |
| 29 #ifndef HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH |
| 30 #define HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH |
| 31 |
| 32 #include "hb-private.hh" |
| 33 |
| 34 HB_BEGIN_DECLS |
| 35 |
| 36 |
| 37 #line 38 "hb-ot-shape-complex-indic-machine.hh.tmp" |
| 38 static const unsigned char _indic_syllable_machine_trans_keys[] = { |
| 39 0u, 0u, 5u, 5u, 1u, 2u, 1u, 2u, 5u, 5u, 1u, 5u, 5u, 5u, 1u, 2u, |
| 40 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, |
| 41 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, |
| 42 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, |
| 43 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, |
| 44 0u, 12u, 0 |
| 45 }; |
| 46 |
| 47 static const char _indic_syllable_machine_key_spans[] = { |
| 48 0, 1, 2, 2, 1, 5, 1, 2, |
| 49 13, 13, 13, 13, 13, 13, 13, 13, |
| 50 13, 13, 13, 13, 13, 13, 13, 13, |
| 51 13, 13, 13, 13, 13, 13, 13, 13, |
| 52 13, 13, 13, 13, 13, 13, 13, 13, |
| 53 13 |
| 54 }; |
| 55 |
| 56 static const short _indic_syllable_machine_index_offsets[] = { |
| 57 0, 0, 2, 5, 8, 10, 16, 18, |
| 58 21, 35, 49, 63, 77, 91, 105, 119, |
| 59 133, 147, 161, 175, 189, 203, 217, 231, |
| 60 245, 259, 273, 287, 301, 315, 329, 343, |
| 61 357, 371, 385, 399, 413, 427, 441, 455, |
| 62 469 |
| 63 }; |
| 64 |
| 65 static const char _indic_syllable_machine_indicies[] = { |
| 66 0, 1, 2, 2, 1, 3, 3, |
| 67 1, 4, 1, 2, 2, 1, 1, 0, |
| 68 1, 5, 1, 6, 6, 1, 7, 6, |
| 69 8, 9, 1, 1, 1, 1, 1, 1, |
| 70 1, 1, 10, 1, 11, 12, 13, 14, |
| 71 1, 1, 1, 1, 1, 1, 1, 1, |
| 72 15, 1, 16, 17, 18, 19, 20, 21, |
| 73 22, 22, 23, 24, 25, 26, 27, 1, |
| 74 16, 17, 18, 19, 20, 28, 22, 22, |
| 75 23, 24, 25, 26, 27, 1, 29, 30, |
| 76 31, 32, 33, 1, 34, 35, 36, 37, |
| 77 38, 1, 39, 1, 29, 30, 31, 32, |
| 78 1, 1, 34, 35, 36, 37, 38, 1, |
| 79 39, 1, 29, 30, 31, 32, 1, 1, |
| 80 1, 1, 36, 37, 38, 1, 39, 1, |
| 81 29, 30, 31, 32, 40, 2, 1, 1, |
| 82 36, 37, 38, 1, 39, 1, 29, 30, |
| 83 31, 32, 1, 2, 1, 1, 36, 37, |
| 84 38, 1, 39, 1, 29, 30, 31, 32, |
| 85 1, 1, 1, 1, 1, 1, 38, 1, |
| 86 39, 1, 29, 30, 31, 32, 1, 1, |
| 87 1, 1, 1, 1, 41, 1, 39, 1, |
| 88 29, 30, 31, 32, 1, 1, 1, 1, |
| 89 1, 1, 1, 1, 39, 1, 42, 43, |
| 90 44, 45, 46, 4, 47, 47, 48, 49, |
| 91 50, 1, 51, 1, 42, 43, 44, 45, |
| 92 1, 4, 47, 47, 48, 49, 50, 1, |
| 93 51, 1, 42, 43, 44, 45, 1, 1, |
| 94 1, 1, 48, 49, 50, 1, 51, 1, |
| 95 42, 43, 44, 45, 52, 3, 1, 1, |
| 96 48, 49, 50, 1, 51, 1, 42, 43, |
| 97 44, 45, 1, 3, 1, 1, 48, 49, |
| 98 50, 1, 51, 1, 42, 43, 44, 45, |
| 99 1, 1, 1, 1, 1, 1, 50, 1, |
| 100 51, 1, 42, 43, 44, 45, 1, 1, |
| 101 1, 1, 1, 1, 53, 1, 51, 1, |
| 102 42, 43, 44, 45, 1, 1, 1, 1, |
| 103 1, 1, 1, 1, 51, 1, 16, 17, |
| 104 18, 19, 1, 21, 22, 22, 23, 24, |
| 105 25, 26, 27, 1, 16, 6, 6, 19, |
| 106 1, 1, 54, 54, 1, 24, 25, 1, |
| 107 27, 1, 16, 6, 6, 19, 1, 1, |
| 108 1, 1, 1, 24, 25, 1, 27, 1, |
| 109 16, 17, 18, 19, 1, 1, 1, 1, |
| 110 1, 1, 25, 1, 27, 1, 16, 17, |
| 111 18, 19, 1, 1, 1, 1, 1, 1, |
| 112 55, 1, 27, 1, 16, 17, 18, 19, |
| 113 1, 1, 1, 1, 1, 1, 1, 1, |
| 114 27, 1, 16, 17, 18, 19, 56, 57, |
| 115 1, 1, 23, 24, 25, 1, 27, 1, |
| 116 16, 17, 18, 19, 1, 57, 1, 1, |
| 117 23, 24, 25, 1, 27, 1, 16, 17, |
| 118 18, 19, 1, 1, 1, 1, 23, 24, |
| 119 25, 1, 27, 1, 16, 17, 18, 19, |
| 120 1, 58, 1, 1, 23, 24, 25, 1, |
| 121 27, 1, 16, 17, 18, 19, 1, 1, |
| 122 59, 59, 1, 24, 25, 1, 27, 1, |
| 123 16, 17, 18, 19, 1, 1, 1, 1, |
| 124 1, 24, 25, 1, 27, 1, 16, 6, |
| 125 6, 9, 1, 1, 54, 54, 1, 24, |
| 126 25, 1, 10, 1, 0 |
| 127 }; |
| 128 |
| 129 static const char _indic_syllable_machine_trans_targs[] = { |
| 130 2, 0, 14, 22, 3, 7, 10, 9, |
| 131 11, 12, 20, 9, 10, 11, 12, 20, |
| 132 9, 10, 11, 12, 28, 29, 6, 34, |
| 133 31, 32, 37, 20, 40, 9, 10, 11, |
| 134 12, 13, 1, 5, 15, 17, 18, 20, |
| 135 16, 19, 9, 10, 11, 12, 21, 4, |
| 136 23, 25, 26, 20, 24, 27, 30, 33, |
| 137 35, 36, 38, 39 |
| 138 }; |
| 139 |
| 140 static const char _indic_syllable_machine_trans_actions[] = { |
| 141 0, 0, 0, 0, 0, 0, 0, 0, |
| 142 0, 0, 0, 1, 1, 1, 1, 1, |
| 143 2, 2, 2, 2, 0, 0, 0, 0, |
| 144 0, 0, 0, 2, 0, 3, 3, 3, |
| 145 3, 0, 0, 0, 0, 0, 0, 3, |
| 146 0, 0, 4, 4, 4, 4, 0, 0, |
| 147 0, 0, 0, 4, 0, 0, 0, 0, |
| 148 0, 0, 0, 0 |
| 149 }; |
| 150 |
| 151 static const char _indic_syllable_machine_eof_actions[] = { |
| 152 0, 0, 0, 0, 0, 0, 0, 0, |
| 153 0, 1, 2, 2, 3, 3, 3, 3, |
| 154 3, 3, 3, 3, 4, 4, 4, 4, |
| 155 4, 4, 4, 4, 2, 2, 2, 2, |
| 156 2, 2, 2, 2, 2, 2, 2, 2, |
| 157 2 |
| 158 }; |
| 159 |
| 160 static const int indic_syllable_machine_start = 8; |
| 161 static const int indic_syllable_machine_first_final = 8; |
| 162 static const int indic_syllable_machine_error = 0; |
| 163 |
| 164 static const int indic_syllable_machine_en_main = 8; |
| 165 |
| 166 |
| 167 #line 38 "hb-ot-shape-complex-indic-machine.rl" |
| 168 |
| 169 |
| 170 |
| 171 #line 83 "hb-ot-shape-complex-indic-machine.rl" |
| 172 |
| 173 |
| 174 |
| 175 static void |
| 176 set_cluster (hb_buffer_t *buffer, |
| 177 unsigned int start, unsigned int end) |
| 178 { |
| 179 unsigned int cluster = buffer->info[start].cluster; |
| 180 |
| 181 for (unsigned int i = start + 1; i < end; i++) |
| 182 cluster = MIN (cluster, buffer->info[i].cluster); |
| 183 for (unsigned int i = start; i < end; i++) |
| 184 buffer->info[i].cluster = cluster; |
| 185 } |
| 186 |
| 187 static void |
| 188 find_syllables (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t *mask_arr
ay) |
| 189 { |
| 190 unsigned int p, pe, eof; |
| 191 int cs; |
| 192 |
| 193 #line 194 "hb-ot-shape-complex-indic-machine.hh.tmp" |
| 194 { |
| 195 cs = indic_syllable_machine_start; |
| 196 } |
| 197 |
| 198 #line 106 "hb-ot-shape-complex-indic-machine.rl" |
| 199 |
| 200 |
| 201 p = 0; |
| 202 pe = eof = buffer->len; |
| 203 |
| 204 unsigned int last = 0; |
| 205 |
| 206 #line 207 "hb-ot-shape-complex-indic-machine.hh.tmp" |
| 207 { |
| 208 int _slen; |
| 209 int _trans; |
| 210 const unsigned char *_keys; |
| 211 const char *_inds; |
| 212 if ( p == pe ) |
| 213 goto _test_eof; |
| 214 if ( cs == 0 ) |
| 215 goto _out; |
| 216 _resume: |
| 217 _keys = _indic_syllable_machine_trans_keys + (cs<<1); |
| 218 _inds = _indic_syllable_machine_indicies + _indic_syllable_machine_index
_offsets[cs]; |
| 219 |
| 220 _slen = _indic_syllable_machine_key_spans[cs]; |
| 221 _trans = _inds[ _slen > 0 && _keys[0] <=( buffer->info[p].indic_category
()) && |
| 222 ( buffer->info[p].indic_category()) <= _keys[1] ? |
| 223 ( buffer->info[p].indic_category()) - _keys[0] : _slen ]; |
| 224 |
| 225 cs = _indic_syllable_machine_trans_targs[_trans]; |
| 226 |
| 227 if ( _indic_syllable_machine_trans_actions[_trans] == 0 ) |
| 228 goto _again; |
| 229 |
| 230 switch ( _indic_syllable_machine_trans_actions[_trans] ) { |
| 231 case 2: |
| 232 #line 62 "hb-ot-shape-complex-indic-machine.rl" |
| 233 { found_consonant_syllable (map, buffer, mask_array, last, p); } |
| 234 #line 67 "hb-ot-shape-complex-indic-machine.rl" |
| 235 { set_cluster (buffer, p, last); last = p; } |
| 236 break; |
| 237 case 3: |
| 238 #line 63 "hb-ot-shape-complex-indic-machine.rl" |
| 239 { found_vowel_syllable (map, buffer, mask_array, last, p); } |
| 240 #line 67 "hb-ot-shape-complex-indic-machine.rl" |
| 241 { set_cluster (buffer, p, last); last = p; } |
| 242 break; |
| 243 case 4: |
| 244 #line 64 "hb-ot-shape-complex-indic-machine.rl" |
| 245 { found_standalone_cluster (map, buffer, mask_array, last, p); } |
| 246 #line 67 "hb-ot-shape-complex-indic-machine.rl" |
| 247 { set_cluster (buffer, p, last); last = p; } |
| 248 break; |
| 249 case 1: |
| 250 #line 65 "hb-ot-shape-complex-indic-machine.rl" |
| 251 { found_non_indic (map, buffer, mask_array, last, p); } |
| 252 #line 67 "hb-ot-shape-complex-indic-machine.rl" |
| 253 { set_cluster (buffer, p, last); last = p; } |
| 254 break; |
| 255 #line 256 "hb-ot-shape-complex-indic-machine.hh.tmp" |
| 256 } |
| 257 |
| 258 _again: |
| 259 if ( cs == 0 ) |
| 260 goto _out; |
| 261 if ( ++p != pe ) |
| 262 goto _resume; |
| 263 _test_eof: {} |
| 264 if ( p == eof ) |
| 265 { |
| 266 switch ( _indic_syllable_machine_eof_actions[cs] ) { |
| 267 case 2: |
| 268 #line 62 "hb-ot-shape-complex-indic-machine.rl" |
| 269 { found_consonant_syllable (map, buffer, mask_array, last, p); } |
| 270 #line 67 "hb-ot-shape-complex-indic-machine.rl" |
| 271 { set_cluster (buffer, p, last); last = p; } |
| 272 break; |
| 273 case 3: |
| 274 #line 63 "hb-ot-shape-complex-indic-machine.rl" |
| 275 { found_vowel_syllable (map, buffer, mask_array, last, p); } |
| 276 #line 67 "hb-ot-shape-complex-indic-machine.rl" |
| 277 { set_cluster (buffer, p, last); last = p; } |
| 278 break; |
| 279 case 4: |
| 280 #line 64 "hb-ot-shape-complex-indic-machine.rl" |
| 281 { found_standalone_cluster (map, buffer, mask_array, last, p); } |
| 282 #line 67 "hb-ot-shape-complex-indic-machine.rl" |
| 283 { set_cluster (buffer, p, last); last = p; } |
| 284 break; |
| 285 case 1: |
| 286 #line 65 "hb-ot-shape-complex-indic-machine.rl" |
| 287 { found_non_indic (map, buffer, mask_array, last, p); } |
| 288 #line 67 "hb-ot-shape-complex-indic-machine.rl" |
| 289 { set_cluster (buffer, p, last); last = p; } |
| 290 break; |
| 291 #line 292 "hb-ot-shape-complex-indic-machine.hh.tmp" |
| 292 } |
| 293 } |
| 294 |
| 295 _out: {} |
| 296 } |
| 297 |
| 298 #line 114 "hb-ot-shape-complex-indic-machine.rl" |
| 299 |
| 300 } |
| 301 |
| 302 HB_END_DECLS |
| 303 |
| 304 #endif /* HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH */ |
OLD | NEW |