1
2#line 1 "hb-ot-shape-complex-use-machine.rl"
3/*
4 * Copyright © 2015 Mozilla Foundation.
5 * Copyright © 2015 Google, Inc.
6 *
7 * This is part of HarfBuzz, a text shaping library.
8 *
9 * Permission is hereby granted, without written agreement and without
10 * license or royalty fees, to use, copy, modify, and distribute this
11 * software and its documentation for any purpose, provided that the
12 * above copyright notice and the following two paragraphs appear in
13 * all copies of this software.
14 *
15 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
16 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
17 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
18 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
19 * DAMAGE.
20 *
21 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
22 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
23 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
24 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
25 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
26 *
27 * Mozilla Author(s): Jonathan Kew
28 * Google Author(s): Behdad Esfahbod
29 */
30
31#ifndef HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH
32#define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH
33
34#include "hb-private.hh"
35
36
37#line 38 "hb-ot-shape-complex-use-machine.hh"
38static const unsigned char _use_syllable_machine_trans_keys[] = {
39 1u, 1u, 0u, 43u, 21u, 21u, 8u, 39u, 8u, 39u, 1u, 1u, 8u, 39u, 8u, 39u,
40 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
41 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
42 13u, 21u, 4u, 4u, 13u, 13u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u,
43 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
44 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 1u, 1u, 1u, 39u, 8u, 39u,
45 21u, 42u, 41u, 42u, 42u, 42u, 1u, 5u, 0
46};
47
48static const char _use_syllable_machine_key_spans[] = {
49 1, 44, 1, 32, 32, 1, 32, 32,
50 32, 19, 19, 19, 32, 32, 32, 32,
51 32, 32, 32, 32, 32, 32, 32, 32,
52 9, 1, 1, 32, 32, 32, 32, 19,
53 19, 19, 32, 32, 32, 32, 32, 32,
54 32, 32, 32, 32, 32, 1, 39, 32,
55 22, 2, 1, 5
56};
57
58static const short _use_syllable_machine_index_offsets[] = {
59 0, 2, 47, 49, 82, 115, 117, 150,
60 183, 216, 236, 256, 276, 309, 342, 375,
61 408, 441, 474, 507, 540, 573, 606, 639,
62 672, 682, 684, 686, 719, 752, 785, 818,
63 838, 858, 878, 911, 944, 977, 1010, 1043,
64 1076, 1109, 1142, 1175, 1208, 1241, 1243, 1283,
65 1316, 1339, 1342, 1344
66};
67
68static const char _use_syllable_machine_indicies[] = {
69 1, 0, 2, 3, 4, 2, 5, 3,
70 4, 4, 6, 4, 4, 1, 7, 4,
71 4, 4, 2, 2, 8, 9, 4, 4,
72 10, 11, 12, 13, 14, 15, 16, 10,
73 17, 18, 19, 20, 21, 22, 4, 23,
74 24, 25, 4, 4, 4, 26, 4, 28,
75 27, 30, 29, 29, 31, 32, 29, 29,
76 29, 29, 29, 29, 29, 29, 33, 34,
77 35, 36, 37, 38, 39, 40, 34, 41,
78 33, 42, 43, 44, 45, 29, 46, 47,
79 48, 29, 30, 29, 29, 31, 32, 29,
80 29, 29, 29, 29, 29, 29, 29, 49,
81 34, 35, 36, 37, 38, 39, 40, 34,
82 41, 42, 42, 43, 44, 45, 29, 46,
83 47, 48, 29, 31, 50, 30, 29, 29,
84 31, 32, 29, 29, 29, 29, 29, 29,
85 29, 29, 29, 34, 35, 36, 37, 38,
86 39, 40, 34, 41, 42, 42, 43, 44,
87 45, 29, 46, 47, 48, 29, 30, 29,
88 29, 29, 29, 29, 29, 29, 29, 29,
89 29, 29, 29, 29, 34, 35, 36, 37,
90 38, 29, 29, 29, 29, 29, 29, 43,
91 44, 45, 29, 46, 47, 48, 29, 30,
92 29, 29, 29, 29, 29, 29, 29, 29,
93 29, 29, 29, 29, 29, 29, 35, 36,
94 37, 38, 29, 29, 29, 29, 29, 29,
95 29, 29, 29, 29, 46, 47, 48, 29,
96 30, 29, 29, 29, 29, 29, 29, 29,
97 29, 29, 29, 29, 29, 29, 29, 29,
98 36, 37, 38, 29, 30, 29, 29, 29,
99 29, 29, 29, 29, 29, 29, 29, 29,
100 29, 29, 29, 29, 29, 37, 38, 29,
101 30, 29, 29, 29, 29, 29, 29, 29,
102 29, 29, 29, 29, 29, 29, 29, 29,
103 29, 29, 38, 29, 30, 29, 29, 29,
104 29, 29, 29, 29, 29, 29, 29, 29,
105 29, 29, 29, 29, 36, 37, 38, 29,
106 29, 29, 29, 29, 29, 29, 29, 29,
107 29, 46, 47, 48, 29, 30, 29, 29,
108 29, 29, 29, 29, 29, 29, 29, 29,
109 29, 29, 29, 29, 29, 36, 37, 38,
110 29, 29, 29, 29, 29, 29, 29, 29,
111 29, 29, 29, 47, 48, 29, 30, 29,
112 29, 29, 29, 29, 29, 29, 29, 29,
113 29, 29, 29, 29, 29, 29, 36, 37,
114 38, 29, 29, 29, 29, 29, 29, 29,
115 29, 29, 29, 29, 29, 48, 29, 30,
116 29, 29, 29, 29, 29, 29, 29, 29,
117 29, 29, 29, 29, 29, 29, 35, 36,
118 37, 38, 29, 29, 29, 29, 29, 29,
119 43, 44, 45, 29, 46, 47, 48, 29,
120 30, 29, 29, 29, 29, 29, 29, 29,
121 29, 29, 29, 29, 29, 29, 29, 35,
122 36, 37, 38, 29, 29, 29, 29, 29,
123 29, 29, 44, 45, 29, 46, 47, 48,
124 29, 30, 29, 29, 29, 29, 29, 29,
125 29, 29, 29, 29, 29, 29, 29, 29,
126 35, 36, 37, 38, 29, 29, 29, 29,
127 29, 29, 29, 29, 45, 29, 46, 47,
128 48, 29, 30, 29, 29, 29, 29, 29,
129 29, 29, 29, 29, 29, 29, 29, 29,
130 34, 35, 36, 37, 38, 29, 40, 34,
131 29, 29, 29, 43, 44, 45, 29, 46,
132 47, 48, 29, 30, 29, 29, 29, 29,
133 29, 29, 29, 29, 29, 29, 29, 29,
134 29, 34, 35, 36, 37, 38, 29, 51,
135 34, 29, 29, 29, 43, 44, 45, 29,
136 46, 47, 48, 29, 30, 29, 29, 29,
137 29, 29, 29, 29, 29, 29, 29, 29,
138 29, 29, 34, 35, 36, 37, 38, 29,
139 29, 34, 29, 29, 29, 43, 44, 45,
140 29, 46, 47, 48, 29, 30, 29, 29,
141 29, 29, 29, 29, 29, 29, 29, 29,
142 29, 29, 29, 34, 35, 36, 37, 38,
143 39, 40, 34, 29, 29, 29, 43, 44,
144 45, 29, 46, 47, 48, 29, 30, 29,
145 29, 31, 32, 29, 29, 29, 29, 29,
146 29, 29, 29, 29, 34, 35, 36, 37,
147 38, 39, 40, 34, 41, 29, 42, 43,
148 44, 45, 29, 46, 47, 48, 29, 30,
149 29, 29, 31, 32, 29, 29, 29, 29,
150 29, 29, 29, 29, 29, 34, 35, 36,
151 37, 38, 39, 40, 34, 41, 33, 42,
152 43, 44, 45, 29, 46, 47, 48, 29,
153 53, 52, 52, 52, 52, 52, 52, 52,
154 54, 52, 5, 55, 53, 52, 6, 56,
155 56, 1, 57, 56, 56, 56, 56, 56,
156 56, 56, 56, 58, 10, 11, 12, 13,
157 14, 15, 16, 10, 17, 19, 19, 20,
158 21, 22, 56, 23, 24, 25, 56, 6,
159 56, 56, 1, 57, 56, 56, 56, 56,
160 56, 56, 56, 56, 56, 10, 11, 12,
161 13, 14, 15, 16, 10, 17, 19, 19,
162 20, 21, 22, 56, 23, 24, 25, 56,
163 6, 56, 56, 56, 56, 56, 56, 56,
164 56, 56, 56, 56, 56, 56, 10, 11,
165 12, 13, 14, 56, 56, 56, 56, 56,
166 56, 20, 21, 22, 56, 23, 24, 25,
167 56, 6, 56, 56, 56, 56, 56, 56,
168 56, 56, 56, 56, 56, 56, 56, 56,
169 11, 12, 13, 14, 56, 56, 56, 56,
170 56, 56, 56, 56, 56, 56, 23, 24,
171 25, 56, 6, 56, 56, 56, 56, 56,
172 56, 56, 56, 56, 56, 56, 56, 56,
173 56, 56, 12, 13, 14, 56, 6, 56,
174 56, 56, 56, 56, 56, 56, 56, 56,
175 56, 56, 56, 56, 56, 56, 56, 13,
176 14, 56, 6, 56, 56, 56, 56, 56,
177 56, 56, 56, 56, 56, 56, 56, 56,
178 56, 56, 56, 56, 14, 56, 6, 56,
179 56, 56, 56, 56, 56, 56, 56, 56,
180 56, 56, 56, 56, 56, 56, 12, 13,
181 14, 56, 56, 56, 56, 56, 56, 56,
182 56, 56, 56, 23, 24, 25, 56, 6,
183 56, 56, 56, 56, 56, 56, 56, 56,
184 56, 56, 56, 56, 56, 56, 56, 12,
185 13, 14, 56, 56, 56, 56, 56, 56,
186 56, 56, 56, 56, 56, 24, 25, 56,
187 6, 56, 56, 56, 56, 56, 56, 56,
188 56, 56, 56, 56, 56, 56, 56, 56,
189 12, 13, 14, 56, 56, 56, 56, 56,
190 56, 56, 56, 56, 56, 56, 56, 25,
191 56, 6, 56, 56, 56, 56, 56, 56,
192 56, 56, 56, 56, 56, 56, 56, 56,
193 11, 12, 13, 14, 56, 56, 56, 56,
194 56, 56, 20, 21, 22, 56, 23, 24,
195 25, 56, 6, 56, 56, 56, 56, 56,
196 56, 56, 56, 56, 56, 56, 56, 56,
197 56, 11, 12, 13, 14, 56, 56, 56,
198 56, 56, 56, 56, 21, 22, 56, 23,
199 24, 25, 56, 6, 56, 56, 56, 56,
200 56, 56, 56, 56, 56, 56, 56, 56,
201 56, 56, 11, 12, 13, 14, 56, 56,
202 56, 56, 56, 56, 56, 56, 22, 56,
203 23, 24, 25, 56, 6, 56, 56, 56,
204 56, 56, 56, 56, 56, 56, 56, 56,
205 56, 56, 10, 11, 12, 13, 14, 56,
206 16, 10, 56, 56, 56, 20, 21, 22,
207 56, 23, 24, 25, 56, 6, 56, 56,
208 56, 56, 56, 56, 56, 56, 56, 56,
209 56, 56, 56, 10, 11, 12, 13, 14,
210 56, 59, 10, 56, 56, 56, 20, 21,
211 22, 56, 23, 24, 25, 56, 6, 56,
212 56, 56, 56, 56, 56, 56, 56, 56,
213 56, 56, 56, 56, 10, 11, 12, 13,
214 14, 56, 56, 10, 56, 56, 56, 20,
215 21, 22, 56, 23, 24, 25, 56, 6,
216 56, 56, 56, 56, 56, 56, 56, 56,
217 56, 56, 56, 56, 56, 10, 11, 12,
218 13, 14, 15, 16, 10, 56, 56, 56,
219 20, 21, 22, 56, 23, 24, 25, 56,
220 6, 56, 56, 1, 57, 56, 56, 56,
221 56, 56, 56, 56, 56, 56, 10, 11,
222 12, 13, 14, 15, 16, 10, 17, 56,
223 19, 20, 21, 22, 56, 23, 24, 25,
224 56, 1, 60, 3, 56, 56, 56, 3,
225 56, 56, 6, 56, 56, 1, 57, 56,
226 56, 56, 56, 56, 56, 56, 56, 56,
227 10, 11, 12, 13, 14, 15, 16, 10,
228 17, 18, 19, 20, 21, 22, 56, 23,
229 24, 25, 56, 6, 56, 56, 1, 57,
230 56, 56, 56, 56, 56, 56, 56, 56,
231 56, 10, 11, 12, 13, 14, 15, 16,
232 10, 17, 18, 19, 20, 21, 22, 56,
233 23, 24, 25, 56, 62, 61, 61, 61,
234 61, 61, 61, 61, 61, 61, 61, 61,
235 61, 61, 61, 61, 61, 61, 61, 61,
236 62, 63, 61, 62, 63, 61, 63, 61,
237 3, 60, 60, 60, 3, 60, 0
238};
239
240static const char _use_syllable_machine_trans_targs[] = {
241 1, 27, 2, 3, 1, 24, 1, 45,
242 46, 48, 29, 30, 31, 32, 33, 40,
243 41, 43, 47, 44, 37, 38, 39, 34,
244 35, 36, 51, 1, 1, 1, 1, 4,
245 5, 23, 7, 8, 9, 10, 11, 18,
246 19, 21, 22, 15, 16, 17, 12, 13,
247 14, 6, 1, 20, 1, 25, 26, 1,
248 1, 0, 28, 42, 1, 1, 49, 50
249};
250
251static const char _use_syllable_machine_trans_actions[] = {
252 1, 2, 0, 0, 5, 0, 6, 0,
253 2, 0, 0, 0, 0, 0, 0, 0,
254 0, 0, 2, 2, 0, 0, 0, 0,
255 0, 0, 0, 7, 8, 9, 10, 0,
256 0, 0, 0, 0, 0, 0, 0, 0,
257 0, 0, 0, 0, 0, 0, 0, 0,
258 0, 0, 11, 0, 12, 0, 0, 13,
259 14, 0, 2, 0, 15, 16, 0, 0
260};
261
262static const char _use_syllable_machine_to_state_actions[] = {
263 0, 3, 0, 0, 0, 0, 0, 0,
264 0, 0, 0, 0, 0, 0, 0, 0,
265 0, 0, 0, 0, 0, 0, 0, 0,
266 0, 0, 0, 0, 0, 0, 0, 0,
267 0, 0, 0, 0, 0, 0, 0, 0,
268 0, 0, 0, 0, 0, 0, 0, 0,
269 0, 0, 0, 0
270};
271
272static const char _use_syllable_machine_from_state_actions[] = {
273 0, 4, 0, 0, 0, 0, 0, 0,
274 0, 0, 0, 0, 0, 0, 0, 0,
275 0, 0, 0, 0, 0, 0, 0, 0,
276 0, 0, 0, 0, 0, 0, 0, 0,
277 0, 0, 0, 0, 0, 0, 0, 0,
278 0, 0, 0, 0, 0, 0, 0, 0,
279 0, 0, 0, 0
280};
281
282static const short _use_syllable_machine_eof_trans[] = {
283 1, 0, 28, 30, 30, 51, 30, 30,
284 30, 30, 30, 30, 30, 30, 30, 30,
285 30, 30, 30, 30, 30, 30, 30, 30,
286 53, 56, 53, 57, 57, 57, 57, 57,
287 57, 57, 57, 57, 57, 57, 57, 57,
288 57, 57, 57, 57, 57, 61, 57, 57,
289 62, 62, 62, 61
290};
291
292static const int use_syllable_machine_start = 1;
293static const int use_syllable_machine_first_final = 1;
294static const int use_syllable_machine_error = -1;
295
296static const int use_syllable_machine_en_main = 1;
297
298
299#line 38 "hb-ot-shape-complex-use-machine.rl"
300
301
302
303#line 140 "hb-ot-shape-complex-use-machine.rl"
304
305
306#define found_syllable(syllable_type) \
307 HB_STMT_START { \
308 if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \
309 for (unsigned int i = last; i < p+1; i++) \
310 info[i].syllable() = (syllable_serial << 4) | syllable_type; \
311 last = p+1; \
312 syllable_serial++; \
313 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \
314 } HB_STMT_END
315
316static void
317find_syllables (hb_buffer_t *buffer)
318{
319 unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED;
320 int cs;
321 hb_glyph_info_t *info = buffer->info;
322
323#line 324 "hb-ot-shape-complex-use-machine.hh"
324 {
325 cs = use_syllable_machine_start;
326 ts = 0;
327 te = 0;
328 act = 0;
329 }
330
331#line 161 "hb-ot-shape-complex-use-machine.rl"
332
333
334 p = 0;
335 pe = eof = buffer->len;
336
337 unsigned int last = 0;
338 unsigned int syllable_serial = 1;
339
340#line 341 "hb-ot-shape-complex-use-machine.hh"
341 {
342 int _slen;
343 int _trans;
344 const unsigned char *_keys;
345 const char *_inds;
346 if ( p == pe )
347 goto _test_eof;
348_resume:
349 switch ( _use_syllable_machine_from_state_actions[cs] ) {
350 case 4:
351#line 1 "NONE"
352 {ts = p;}
353 break;
354#line 355 "hb-ot-shape-complex-use-machine.hh"
355 }
356
357 _keys = _use_syllable_machine_trans_keys + (cs<<1);
358 _inds = _use_syllable_machine_indicies + _use_syllable_machine_index_offsets[cs];
359
360 _slen = _use_syllable_machine_key_spans[cs];
361 _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].use_category()) &&
362 ( info[p].use_category()) <= _keys[1] ?
363 ( info[p].use_category()) - _keys[0] : _slen ];
364
365_eof_trans:
366 cs = _use_syllable_machine_trans_targs[_trans];
367
368 if ( _use_syllable_machine_trans_actions[_trans] == 0 )
369 goto _again;
370
371 switch ( _use_syllable_machine_trans_actions[_trans] ) {
372 case 2:
373#line 1 "NONE"
374 {te = p+1;}
375 break;
376 case 8:
377#line 129 "hb-ot-shape-complex-use-machine.rl"
378 {te = p+1;{ found_syllable (independent_cluster); }}
379 break;
380 case 10:
381#line 131 "hb-ot-shape-complex-use-machine.rl"
382 {te = p+1;{ found_syllable (standard_cluster); }}
383 break;
384 case 6:
385#line 135 "hb-ot-shape-complex-use-machine.rl"
386 {te = p+1;{ found_syllable (broken_cluster); }}
387 break;
388 case 5:
389#line 136 "hb-ot-shape-complex-use-machine.rl"
390 {te = p+1;{ found_syllable (non_cluster); }}
391 break;
392 case 7:
393#line 129 "hb-ot-shape-complex-use-machine.rl"
394 {te = p;p--;{ found_syllable (independent_cluster); }}
395 break;
396 case 11:
397#line 130 "hb-ot-shape-complex-use-machine.rl"
398 {te = p;p--;{ found_syllable (virama_terminated_cluster); }}
399 break;
400 case 9:
401#line 131 "hb-ot-shape-complex-use-machine.rl"
402 {te = p;p--;{ found_syllable (standard_cluster); }}
403 break;
404 case 13:
405#line 132 "hb-ot-shape-complex-use-machine.rl"
406 {te = p;p--;{ found_syllable (number_joiner_terminated_cluster); }}
407 break;
408 case 12:
409#line 133 "hb-ot-shape-complex-use-machine.rl"
410 {te = p;p--;{ found_syllable (numeral_cluster); }}
411 break;
412 case 16:
413#line 134 "hb-ot-shape-complex-use-machine.rl"
414 {te = p;p--;{ found_syllable (symbol_cluster); }}
415 break;
416 case 14:
417#line 135 "hb-ot-shape-complex-use-machine.rl"
418 {te = p;p--;{ found_syllable (broken_cluster); }}
419 break;
420 case 15:
421#line 136 "hb-ot-shape-complex-use-machine.rl"
422 {te = p;p--;{ found_syllable (non_cluster); }}
423 break;
424 case 1:
425#line 135 "hb-ot-shape-complex-use-machine.rl"
426 {{p = ((te))-1;}{ found_syllable (broken_cluster); }}
427 break;
428#line 429 "hb-ot-shape-complex-use-machine.hh"
429 }
430
431_again:
432 switch ( _use_syllable_machine_to_state_actions[cs] ) {
433 case 3:
434#line 1 "NONE"
435 {ts = 0;}
436 break;
437#line 438 "hb-ot-shape-complex-use-machine.hh"
438 }
439
440 if ( ++p != pe )
441 goto _resume;
442 _test_eof: {}
443 if ( p == eof )
444 {
445 if ( _use_syllable_machine_eof_trans[cs] > 0 ) {
446 _trans = _use_syllable_machine_eof_trans[cs] - 1;
447 goto _eof_trans;
448 }
449 }
450
451 }
452
453#line 170 "hb-ot-shape-complex-use-machine.rl"
454
455}
456
457#undef found_syllable
458
459#endif /* HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH */
460

source code of qtbase/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh