2 #line 1 "../../src/hb-ot-shape-complex-indic-machine.rl"
4 * Copyright © 2011,2012 Google, Inc.
6 * This is part of HarfBuzz, a text shaping library.
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.
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
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.
26 * Google Author(s): Behdad Esfahbod
29 #ifndef HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH
30 #define HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH
32 #include "hb-private.hh"
37 #line 38 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp"
38 static const unsigned char _indic_syllable_machine_trans_keys[] = {
39 5u, 5u, 1u, 2u, 1u, 2u, 5u, 5u, 1u, 5u, 1u, 2u, 5u, 5u, 1u, 13u,
40 4u, 11u, 4u, 11u, 5u, 11u, 1u, 10u, 1u, 10u, 10u, 10u, 10u, 10u, 4u, 10u,
41 5u, 10u, 8u, 10u, 5u, 10u, 6u, 10u, 9u, 10u, 4u, 11u, 1u, 13u, 4u, 10u,
42 4u, 10u, 5u, 10u, 4u, 10u, 5u, 10u, 8u, 10u, 10u, 10u, 10u, 10u, 4u, 10u,
43 4u, 10u, 5u, 10u, 4u, 10u, 5u, 10u, 8u, 10u, 10u, 10u, 10u, 10u, 0
46 static const char _indic_syllable_machine_key_spans[] = {
47 1, 2, 2, 1, 5, 2, 1, 13,
48 8, 8, 7, 10, 10, 1, 1, 7,
49 6, 3, 6, 5, 2, 8, 13, 7,
50 7, 6, 7, 6, 3, 1, 1, 7,
54 static const unsigned char _indic_syllable_machine_index_offsets[] = {
55 0, 2, 5, 8, 10, 16, 19, 21,
56 35, 44, 53, 61, 72, 83, 85, 87,
57 95, 102, 106, 113, 119, 122, 131, 145,
58 153, 161, 168, 176, 183, 187, 189, 191,
59 199, 207, 214, 222, 229, 233, 235
62 static const char _indic_syllable_machine_indicies[] = {
63 1, 0, 2, 2, 0, 4, 4, 3,
64 5, 3, 4, 4, 3, 3, 5, 3,
65 7, 7, 6, 8, 6, 2, 10, 11,
66 9, 9, 9, 9, 9, 9, 9, 9,
67 12, 12, 9, 14, 15, 16, 16, 17,
68 18, 19, 20, 13, 21, 15, 16, 16,
69 17, 18, 19, 20, 13, 15, 16, 16,
70 17, 18, 19, 20, 13, 2, 2, 13,
71 13, 13, 22, 22, 13, 18, 19, 13,
72 2, 2, 13, 13, 13, 13, 13, 13,
73 18, 19, 13, 19, 13, 23, 13, 24,
74 25, 13, 13, 17, 18, 19, 13, 25,
75 13, 13, 17, 18, 19, 13, 17, 18,
76 19, 13, 26, 13, 13, 17, 18, 19,
77 13, 27, 27, 13, 18, 19, 13, 18,
78 19, 13, 14, 28, 16, 16, 17, 18,
79 19, 20, 13, 2, 2, 11, 13, 13,
80 22, 22, 13, 18, 19, 13, 12, 12,
81 13, 30, 5, 31, 32, 33, 34, 35,
82 29, 4, 5, 31, 32, 33, 34, 35,
83 29, 5, 31, 32, 33, 34, 35, 29,
84 36, 37, 29, 29, 33, 34, 35, 29,
85 37, 29, 29, 33, 34, 35, 29, 33,
86 34, 35, 29, 35, 29, 38, 29, 40,
87 8, 41, 41, 42, 43, 44, 39, 7,
88 8, 41, 41, 42, 43, 44, 39, 8,
89 41, 41, 42, 43, 44, 39, 45, 46,
90 39, 39, 42, 43, 44, 39, 46, 39,
91 39, 42, 43, 44, 39, 42, 43, 44,
95 static const char _indic_syllable_machine_trans_targs[] = {
96 7, 1, 8, 7, 25, 2, 7, 33,
97 5, 7, 21, 23, 31, 7, 9, 11,
98 0, 15, 13, 14, 18, 10, 12, 7,
99 16, 17, 19, 20, 22, 7, 24, 3,
100 4, 26, 29, 30, 27, 28, 7, 7,
101 32, 6, 34, 37, 38, 35, 36, 7
104 static const char _indic_syllable_machine_trans_actions[] = {
105 1, 0, 2, 3, 2, 0, 4, 2,
106 0, 7, 2, 2, 2, 8, 2, 0,
107 0, 0, 0, 0, 0, 2, 0, 9,
108 0, 0, 0, 0, 0, 10, 2, 0,
109 0, 0, 0, 0, 0, 0, 11, 12,
110 2, 0, 0, 0, 0, 0, 0, 13
113 static const char _indic_syllable_machine_to_state_actions[] = {
114 0, 0, 0, 0, 0, 0, 0, 5,
115 0, 0, 0, 0, 0, 0, 0, 0,
116 0, 0, 0, 0, 0, 0, 0, 0,
117 0, 0, 0, 0, 0, 0, 0, 0,
121 static const char _indic_syllable_machine_from_state_actions[] = {
122 0, 0, 0, 0, 0, 0, 0, 6,
123 0, 0, 0, 0, 0, 0, 0, 0,
124 0, 0, 0, 0, 0, 0, 0, 0,
125 0, 0, 0, 0, 0, 0, 0, 0,
129 static const unsigned char _indic_syllable_machine_eof_trans[] = {
130 1, 1, 4, 4, 4, 7, 7, 0,
131 14, 14, 14, 14, 14, 14, 14, 14,
132 14, 14, 14, 14, 14, 14, 14, 30,
133 30, 30, 30, 30, 30, 30, 30, 40,
134 40, 40, 40, 40, 40, 40, 40
137 static const int indic_syllable_machine_start = 7;
138 static const int indic_syllable_machine_first_final = 7;
139 static const int indic_syllable_machine_error = -1;
141 static const int indic_syllable_machine_en_main = 7;
144 #line 38 "../../src/hb-ot-shape-complex-indic-machine.rl"
148 #line 79 "../../src/hb-ot-shape-complex-indic-machine.rl"
151 #define process_syllable(func) \
153 /* fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #func); */ \
154 for (unsigned int i = last; i < p+1; i++) \
155 info[i].syllable() = syllable_serial; \
156 PASTE (initial_reordering_, func) (map, buffer, mask_array, last, p+1); \
159 if (unlikely (!syllable_serial)) syllable_serial++; \
163 find_syllables (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t *mask_array)
165 unsigned int p, pe, eof, ts, te, act;
167 hb_glyph_info_t *info = buffer->info;
169 #line 170 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp"
171 cs = indic_syllable_machine_start;
177 #line 101 "../../src/hb-ot-shape-complex-indic-machine.rl"
181 pe = eof = buffer->len;
183 unsigned int last = 0;
184 uint8_t syllable_serial = 1;
186 #line 187 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp"
190 const unsigned char *_keys;
195 switch ( _indic_syllable_machine_from_state_actions[cs] ) {
197 #line 1 "../../src/hb-ot-shape-complex-indic-machine.rl"
200 #line 201 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp"
203 _keys = _indic_syllable_machine_trans_keys + (cs<<1);
204 _inds = _indic_syllable_machine_indicies + _indic_syllable_machine_index_offsets[cs];
206 _slen = _indic_syllable_machine_key_spans[cs];
207 _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].indic_category()) &&
208 ( info[p].indic_category()) <= _keys[1] ?
209 ( info[p].indic_category()) - _keys[0] : _slen ];
212 cs = _indic_syllable_machine_trans_targs[_trans];
214 if ( _indic_syllable_machine_trans_actions[_trans] == 0 )
217 switch ( _indic_syllable_machine_trans_actions[_trans] ) {
219 #line 1 "../../src/hb-ot-shape-complex-indic-machine.rl"
223 #line 72 "../../src/hb-ot-shape-complex-indic-machine.rl"
224 {te = p+1;{ process_syllable (consonant_syllable); }}
227 #line 73 "../../src/hb-ot-shape-complex-indic-machine.rl"
228 {te = p+1;{ process_syllable (vowel_syllable); }}
231 #line 74 "../../src/hb-ot-shape-complex-indic-machine.rl"
232 {te = p+1;{ process_syllable (standalone_cluster); }}
235 #line 75 "../../src/hb-ot-shape-complex-indic-machine.rl"
236 {te = p+1;{ process_syllable (non_indic); }}
239 #line 72 "../../src/hb-ot-shape-complex-indic-machine.rl"
240 {te = p;p--;{ process_syllable (consonant_syllable); }}
243 #line 73 "../../src/hb-ot-shape-complex-indic-machine.rl"
244 {te = p;p--;{ process_syllable (vowel_syllable); }}
247 #line 74 "../../src/hb-ot-shape-complex-indic-machine.rl"
248 {te = p;p--;{ process_syllable (standalone_cluster); }}
251 #line 72 "../../src/hb-ot-shape-complex-indic-machine.rl"
252 {{p = ((te))-1;}{ process_syllable (consonant_syllable); }}
255 #line 73 "../../src/hb-ot-shape-complex-indic-machine.rl"
256 {{p = ((te))-1;}{ process_syllable (vowel_syllable); }}
259 #line 74 "../../src/hb-ot-shape-complex-indic-machine.rl"
260 {{p = ((te))-1;}{ process_syllable (standalone_cluster); }}
262 #line 263 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp"
266 switch ( _indic_syllable_machine_to_state_actions[cs] ) {
268 #line 1 "../../src/hb-ot-shape-complex-indic-machine.rl"
271 #line 272 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp"
279 if ( _indic_syllable_machine_eof_trans[cs] > 0 ) {
280 _trans = _indic_syllable_machine_eof_trans[cs] - 1;
287 #line 110 "../../src/hb-ot-shape-complex-indic-machine.rl"
293 #endif /* HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH */