2 #line 1 "hb-buffer-deserialize-text.rl"
4 * Copyright © 2013 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_BUFFER_DESERIALIZE_TEXT_HH
30 #define HB_BUFFER_DESERIALIZE_TEXT_HH
32 #include "hb-private.hh"
35 #line 36 "hb-buffer-deserialize-text.hh.tmp"
36 static const unsigned char _deserialize_text_trans_keys
[] = {
37 0u, 0u, 9u, 122u, 45u, 57u, 48u, 57u, 45u, 57u, 48u, 57u, 48u, 57u, 45u, 57u,
38 48u, 57u, 44u, 44u, 45u, 57u, 48u, 57u, 44u, 57u, 9u, 124u, 9u, 124u, 0u, 0u,
39 9u, 122u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u, 9u, 124u,
40 9u, 124u, 9u, 124u, 9u, 124u, 0
43 static const char _deserialize_text_key_spans
[] = {
44 0, 114, 13, 10, 13, 10, 10, 13,
45 10, 1, 13, 10, 14, 116, 116, 0,
46 114, 116, 116, 116, 116, 116, 116, 116,
50 static const short _deserialize_text_index_offsets
[] = {
51 0, 0, 115, 129, 140, 154, 165, 176,
52 190, 201, 203, 217, 228, 243, 360, 477,
53 478, 593, 710, 827, 944, 1061, 1178, 1295,
57 static const char _deserialize_text_indicies
[] = {
59 1, 1, 1, 1, 1, 1, 1, 1,
60 1, 1, 1, 1, 1, 1, 1, 1,
61 0, 1, 1, 1, 1, 1, 1, 1,
62 1, 1, 1, 1, 1, 1, 1, 1,
63 2, 3, 3, 3, 3, 3, 3, 3,
64 3, 3, 1, 1, 1, 1, 1, 1,
65 1, 4, 4, 4, 4, 4, 4, 4,
66 4, 4, 4, 4, 4, 4, 4, 4,
67 4, 4, 4, 4, 4, 4, 4, 4,
68 4, 4, 4, 1, 1, 1, 1, 1,
69 1, 4, 4, 4, 4, 4, 4, 4,
70 4, 4, 4, 4, 4, 4, 4, 4,
71 4, 4, 4, 4, 4, 4, 4, 4,
72 4, 4, 4, 1, 5, 1, 1, 6,
73 7, 7, 7, 7, 7, 7, 7, 7,
74 7, 1, 8, 9, 9, 9, 9, 9,
75 9, 9, 9, 9, 1, 10, 1, 1,
76 11, 12, 12, 12, 12, 12, 12, 12,
77 12, 12, 1, 13, 14, 14, 14, 14,
78 14, 14, 14, 14, 14, 1, 15, 16,
79 16, 16, 16, 16, 16, 16, 16, 16,
80 1, 17, 1, 1, 18, 19, 19, 19,
81 19, 19, 19, 19, 19, 19, 1, 20,
82 21, 21, 21, 21, 21, 21, 21, 21,
83 21, 1, 22, 1, 23, 1, 1, 24,
84 25, 25, 25, 25, 25, 25, 25, 25,
85 25, 1, 26, 27, 27, 27, 27, 27,
86 27, 27, 27, 27, 1, 22, 1, 1,
87 1, 21, 21, 21, 21, 21, 21, 21,
88 21, 21, 21, 1, 28, 28, 28, 28,
89 28, 1, 1, 1, 1, 1, 1, 1,
90 1, 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, 4, 4, 4,
130 4, 4, 4, 4, 4, 4, 4, 4,
131 4, 4, 4, 4, 4, 4, 4, 4,
132 4, 1, 28, 28, 28, 28, 28, 1,
133 1, 1, 1, 1, 1, 1, 1, 1,
134 1, 1, 1, 1, 1, 1, 1, 1,
135 1, 28, 1, 1, 1, 1, 1, 1,
136 1, 1, 1, 1, 29, 1, 1, 1,
137 1, 37, 37, 37, 37, 37, 37, 37,
138 37, 37, 37, 1, 1, 1, 30, 1,
139 1, 31, 1, 1, 1, 1, 1, 1,
140 1, 1, 1, 1, 1, 1, 1, 1,
141 1, 1, 1, 1, 1, 1, 1, 1,
142 1, 1, 1, 1, 1, 1, 32, 1,
143 1, 1, 1, 1, 1, 1, 1, 1,
144 1, 1, 1, 1, 1, 1, 1, 1,
145 1, 1, 1, 1, 1, 1, 1, 1,
146 1, 1, 1, 1, 1, 33, 1, 38,
147 38, 38, 38, 38, 1, 1, 1, 1,
148 1, 1, 1, 1, 1, 1, 1, 1,
149 1, 1, 1, 1, 1, 1, 38, 1,
150 1, 1, 1, 1, 1, 1, 1, 1,
151 1, 1, 39, 1, 1, 1, 1, 1,
152 1, 1, 1, 1, 1, 1, 1, 1,
153 1, 1, 1, 1, 1, 1, 1, 1,
154 1, 1, 1, 1, 1, 1, 1, 1,
155 1, 1, 1, 1, 1, 1, 1, 1,
156 1, 1, 1, 1, 1, 1, 1, 1,
157 1, 1, 1, 40, 1, 1, 1, 1,
158 1, 1, 1, 1, 1, 1, 1, 1,
159 1, 1, 1, 1, 1, 1, 1, 1,
160 1, 1, 1, 1, 1, 1, 1, 1,
161 1, 1, 41, 1, 42, 42, 42, 42,
162 42, 1, 1, 1, 1, 1, 1, 1,
163 1, 1, 1, 1, 1, 1, 1, 1,
164 1, 1, 1, 42, 1, 1, 1, 1,
165 1, 1, 1, 1, 1, 1, 1, 1,
166 1, 1, 1, 1, 1, 1, 1, 1,
167 1, 1, 1, 1, 1, 1, 1, 1,
168 1, 1, 1, 1, 1, 1, 1, 1,
169 1, 1, 1, 1, 1, 1, 1, 1,
170 1, 1, 1, 1, 1, 1, 1, 1,
171 1, 1, 1, 1, 1, 1, 1, 1,
172 43, 1, 1, 1, 1, 1, 1, 1,
173 1, 1, 1, 1, 1, 1, 1, 1,
174 1, 1, 1, 1, 1, 1, 1, 1,
175 1, 1, 1, 1, 1, 1, 1, 44,
176 1, 42, 42, 42, 42, 42, 1, 1,
177 1, 1, 1, 1, 1, 1, 1, 1,
178 1, 1, 1, 1, 1, 1, 1, 1,
179 42, 1, 1, 1, 1, 1, 1, 1,
180 1, 1, 1, 1, 1, 1, 1, 1,
181 14, 14, 14, 14, 14, 14, 14, 14,
182 14, 14, 1, 1, 1, 1, 1, 1,
183 1, 1, 1, 1, 1, 1, 1, 1,
184 1, 1, 1, 1, 1, 1, 1, 1,
185 1, 1, 1, 1, 1, 1, 1, 1,
186 1, 1, 1, 1, 1, 43, 1, 1,
187 1, 1, 1, 1, 1, 1, 1, 1,
188 1, 1, 1, 1, 1, 1, 1, 1,
189 1, 1, 1, 1, 1, 1, 1, 1,
190 1, 1, 1, 1, 44, 1, 38, 38,
191 38, 38, 38, 1, 1, 1, 1, 1,
192 1, 1, 1, 1, 1, 1, 1, 1,
193 1, 1, 1, 1, 1, 38, 1, 1,
194 1, 1, 1, 1, 1, 1, 1, 1,
195 1, 39, 1, 1, 1, 9, 9, 9,
196 9, 9, 9, 9, 9, 9, 9, 1,
197 1, 1, 1, 1, 1, 1, 1, 1,
198 1, 1, 1, 1, 1, 1, 1, 1,
199 1, 1, 1, 1, 1, 1, 1, 1,
200 1, 1, 1, 1, 1, 1, 1, 1,
201 1, 1, 40, 1, 1, 1, 1, 1,
202 1, 1, 1, 1, 1, 1, 1, 1,
203 1, 1, 1, 1, 1, 1, 1, 1,
204 1, 1, 1, 1, 1, 1, 1, 1,
205 1, 41, 1, 45, 45, 45, 45, 45,
206 1, 1, 1, 1, 1, 1, 1, 1,
207 1, 1, 1, 1, 1, 1, 1, 1,
208 1, 1, 45, 1, 1, 1, 1, 1,
209 1, 1, 1, 1, 1, 46, 1, 1,
210 1, 1, 1, 1, 1, 1, 1, 1,
211 1, 1, 1, 1, 1, 1, 1, 1,
212 1, 1, 47, 1, 1, 1, 1, 1,
213 1, 1, 1, 1, 1, 1, 1, 1,
214 1, 1, 1, 1, 1, 1, 1, 1,
215 1, 1, 1, 1, 1, 1, 1, 48,
216 1, 1, 1, 1, 1, 1, 1, 1,
217 1, 1, 1, 1, 1, 1, 1, 1,
218 1, 1, 1, 1, 1, 1, 1, 1,
219 1, 1, 1, 1, 1, 1, 49, 1,
220 50, 50, 50, 50, 50, 1, 1, 1,
221 1, 1, 1, 1, 1, 1, 1, 1,
222 1, 1, 1, 1, 1, 1, 1, 50,
223 1, 1, 1, 1, 1, 1, 1, 1,
224 1, 1, 51, 1, 1, 1, 1, 1,
225 1, 1, 1, 1, 1, 1, 1, 1,
226 1, 1, 1, 1, 1, 1, 1, 1,
227 1, 1, 1, 1, 1, 1, 1, 1,
228 1, 1, 1, 1, 1, 1, 1, 1,
229 1, 1, 1, 1, 1, 1, 1, 1,
230 1, 1, 1, 1, 52, 1, 1, 1,
231 1, 1, 1, 1, 1, 1, 1, 1,
232 1, 1, 1, 1, 1, 1, 1, 1,
233 1, 1, 1, 1, 1, 1, 1, 1,
234 1, 1, 1, 53, 1, 50, 50, 50,
235 50, 50, 1, 1, 1, 1, 1, 1,
236 1, 1, 1, 1, 1, 1, 1, 1,
237 1, 1, 1, 1, 50, 1, 1, 1,
238 1, 1, 1, 1, 1, 1, 1, 51,
239 1, 1, 1, 1, 27, 27, 27, 27,
240 27, 27, 27, 27, 27, 27, 1, 1,
241 1, 1, 1, 1, 1, 1, 1, 1,
242 1, 1, 1, 1, 1, 1, 1, 1,
243 1, 1, 1, 1, 1, 1, 1, 1,
244 1, 1, 1, 1, 1, 1, 1, 1,
245 1, 52, 1, 1, 1, 1, 1, 1,
246 1, 1, 1, 1, 1, 1, 1, 1,
247 1, 1, 1, 1, 1, 1, 1, 1,
248 1, 1, 1, 1, 1, 1, 1, 1,
249 53, 1, 45, 45, 45, 45, 45, 1,
250 1, 1, 1, 1, 1, 1, 1, 1,
251 1, 1, 1, 1, 1, 1, 1, 1,
252 1, 45, 1, 1, 1, 1, 1, 1,
253 1, 1, 1, 1, 46, 1, 1, 1,
254 1, 54, 54, 54, 54, 54, 54, 54,
255 54, 54, 54, 1, 1, 1, 1, 1,
256 1, 47, 1, 1, 1, 1, 1, 1,
257 1, 1, 1, 1, 1, 1, 1, 1,
258 1, 1, 1, 1, 1, 1, 1, 1,
259 1, 1, 1, 1, 1, 1, 48, 1,
260 1, 1, 1, 1, 1, 1, 1, 1,
261 1, 1, 1, 1, 1, 1, 1, 1,
262 1, 1, 1, 1, 1, 1, 1, 1,
263 1, 1, 1, 1, 1, 49, 1, 28,
264 28, 28, 28, 28, 1, 1, 1, 1,
265 1, 1, 1, 1, 1, 1, 1, 1,
266 1, 1, 1, 1, 1, 1, 28, 1,
267 1, 1, 1, 1, 1, 1, 1, 1,
268 1, 29, 1, 55, 55, 1, 55, 55,
269 55, 55, 55, 55, 55, 55, 55, 55,
270 1, 1, 1, 30, 1, 1, 31, 55,
271 55, 55, 55, 55, 55, 55, 55, 55,
272 55, 55, 55, 55, 55, 55, 55, 55,
273 55, 55, 55, 55, 55, 55, 55, 55,
274 55, 1, 1, 32, 1, 55, 1, 55,
275 55, 55, 55, 55, 55, 55, 55, 55,
276 55, 55, 55, 55, 55, 55, 55, 55,
277 55, 55, 55, 55, 55, 55, 55, 55,
281 static const char _deserialize_text_trans_targs
[] = {
282 1, 0, 13, 17, 26, 3, 18, 21,
283 18, 21, 5, 19, 20, 19, 20, 22,
284 25, 8, 9, 12, 9, 12, 10, 11,
285 23, 24, 23, 24, 14, 2, 6, 7,
286 15, 16, 14, 15, 16, 17, 14, 4,
287 15, 16, 14, 15, 16, 14, 2, 7,
288 15, 16, 14, 2, 15, 16, 25, 26
291 static const char _deserialize_text_trans_actions
[] = {
292 0, 0, 1, 1, 1, 2, 2, 2,
293 0, 0, 2, 2, 2, 0, 0, 2,
294 2, 2, 2, 2, 0, 0, 3, 2,
295 2, 2, 0, 0, 4, 5, 5, 5,
296 4, 4, 0, 0, 0, 0, 6, 7,
297 6, 6, 8, 8, 8, 9, 10, 10,
298 9, 9, 11, 12, 11, 11, 0, 0
301 static const char _deserialize_text_eof_actions
[] = {
302 0, 0, 0, 0, 0, 0, 0, 0,
303 0, 0, 0, 0, 0, 4, 0, 0,
304 0, 4, 6, 8, 8, 6, 9, 11,
308 static const int deserialize_text_start
= 1;
309 static const int deserialize_text_first_final
= 13;
310 static const int deserialize_text_error
= 0;
312 static const int deserialize_text_en_main
= 1;
315 #line 91 "hb-buffer-deserialize-text.rl"
319 _hb_buffer_deserialize_glyphs_text (hb_buffer_t
*buffer
,
321 unsigned int buf_len
,
322 const char **end_ptr
,
325 const char *p
= buf
, *pe
= buf
+ buf_len
;
327 /* Ensure we have positions. */
328 (void) hb_buffer_get_glyph_positions (buffer
, NULL
);
330 while (p
< pe
&& ISSPACE (*p
))
332 if (p
< pe
&& *p
== (buffer
->len
? '|' : '['))
337 const char *eof
= pe
, *tok
= NULL
;
339 hb_glyph_info_t info
;
340 hb_glyph_position_t pos
;
342 #line 343 "hb-buffer-deserialize-text.hh.tmp"
344 cs
= deserialize_text_start
;
347 #line 348 "hb-buffer-deserialize-text.hh.tmp"
351 const unsigned char *_keys
;
358 _keys
= _deserialize_text_trans_keys
+ (cs
<<1);
359 _inds
= _deserialize_text_indicies
+ _deserialize_text_index_offsets
[cs
];
361 _slen
= _deserialize_text_key_spans
[cs
];
362 _trans
= _inds
[ _slen
> 0 && _keys
[0] <=(*p
) &&
364 (*p
) - _keys
[0] : _slen
];
366 cs
= _deserialize_text_trans_targs
[_trans
];
368 if ( _deserialize_text_trans_actions
[_trans
] == 0 )
371 switch ( _deserialize_text_trans_actions
[_trans
] ) {
373 #line 51 "hb-buffer-deserialize-text.rl"
379 #line 55 "hb-buffer-deserialize-text.rl"
381 if (!hb_font_glyph_from_string (font
,
388 #line 62 "hb-buffer-deserialize-text.rl"
389 { if (!parse_uint (tok
, p
, &info
.cluster
)) return false; }
392 #line 63 "hb-buffer-deserialize-text.rl"
393 { if (!parse_int (tok
, p
, &pos
.x_offset
)) return false; }
396 #line 64 "hb-buffer-deserialize-text.rl"
397 { if (!parse_int (tok
, p
, &pos
.y_offset
)) return false; }
400 #line 65 "hb-buffer-deserialize-text.rl"
401 { if (!parse_int (tok
, p
, &pos
.x_advance
)) return false; }
404 #line 38 "hb-buffer-deserialize-text.rl"
406 memset (&info
, 0, sizeof (info
));
407 memset (&pos
, 0, sizeof (pos
));
409 #line 51 "hb-buffer-deserialize-text.rl"
415 #line 55 "hb-buffer-deserialize-text.rl"
417 if (!hb_font_glyph_from_string (font
,
422 #line 43 "hb-buffer-deserialize-text.rl"
424 buffer
->add_info (info
);
425 if (buffer
->in_error
)
427 buffer
->pos
[buffer
->len
- 1] = pos
;
432 #line 62 "hb-buffer-deserialize-text.rl"
433 { if (!parse_uint (tok
, p
, &info
.cluster
)) return false; }
434 #line 43 "hb-buffer-deserialize-text.rl"
436 buffer
->add_info (info
);
437 if (buffer
->in_error
)
439 buffer
->pos
[buffer
->len
- 1] = pos
;
444 #line 64 "hb-buffer-deserialize-text.rl"
445 { if (!parse_int (tok
, p
, &pos
.y_offset
)) return false; }
446 #line 43 "hb-buffer-deserialize-text.rl"
448 buffer
->add_info (info
);
449 if (buffer
->in_error
)
451 buffer
->pos
[buffer
->len
- 1] = pos
;
456 #line 65 "hb-buffer-deserialize-text.rl"
457 { if (!parse_int (tok
, p
, &pos
.x_advance
)) return false; }
458 #line 43 "hb-buffer-deserialize-text.rl"
460 buffer
->add_info (info
);
461 if (buffer
->in_error
)
463 buffer
->pos
[buffer
->len
- 1] = pos
;
468 #line 66 "hb-buffer-deserialize-text.rl"
469 { if (!parse_int (tok
, p
, &pos
.y_advance
)) return false; }
470 #line 43 "hb-buffer-deserialize-text.rl"
472 buffer
->add_info (info
);
473 if (buffer
->in_error
)
475 buffer
->pos
[buffer
->len
- 1] = pos
;
479 #line 480 "hb-buffer-deserialize-text.hh.tmp"
490 switch ( _deserialize_text_eof_actions
[cs
] ) {
492 #line 55 "hb-buffer-deserialize-text.rl"
494 if (!hb_font_glyph_from_string (font
,
499 #line 43 "hb-buffer-deserialize-text.rl"
501 buffer
->add_info (info
);
502 if (buffer
->in_error
)
504 buffer
->pos
[buffer
->len
- 1] = pos
;
509 #line 62 "hb-buffer-deserialize-text.rl"
510 { if (!parse_uint (tok
, p
, &info
.cluster
)) return false; }
511 #line 43 "hb-buffer-deserialize-text.rl"
513 buffer
->add_info (info
);
514 if (buffer
->in_error
)
516 buffer
->pos
[buffer
->len
- 1] = pos
;
521 #line 64 "hb-buffer-deserialize-text.rl"
522 { if (!parse_int (tok
, p
, &pos
.y_offset
)) return false; }
523 #line 43 "hb-buffer-deserialize-text.rl"
525 buffer
->add_info (info
);
526 if (buffer
->in_error
)
528 buffer
->pos
[buffer
->len
- 1] = pos
;
533 #line 65 "hb-buffer-deserialize-text.rl"
534 { if (!parse_int (tok
, p
, &pos
.x_advance
)) return false; }
535 #line 43 "hb-buffer-deserialize-text.rl"
537 buffer
->add_info (info
);
538 if (buffer
->in_error
)
540 buffer
->pos
[buffer
->len
- 1] = pos
;
545 #line 66 "hb-buffer-deserialize-text.rl"
546 { if (!parse_int (tok
, p
, &pos
.y_advance
)) return false; }
547 #line 43 "hb-buffer-deserialize-text.rl"
549 buffer
->add_info (info
);
550 if (buffer
->in_error
)
552 buffer
->pos
[buffer
->len
- 1] = pos
;
556 #line 557 "hb-buffer-deserialize-text.hh.tmp"
563 #line 119 "hb-buffer-deserialize-text.rl"
568 return p
== pe
&& *(p
-1) != ']';
571 #endif /* HB_BUFFER_DESERIALIZE_TEXT_HH */