OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2010,2012 Google, Inc. | 2 * Copyright © 2010,2012 Google, Inc. |
3 * | 3 * |
4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
5 * | 5 * |
6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 10 * all copies of this software. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 {0x0E4Du, 0xF711u, 0xF899u}, /* NIKHAHIT */ | 132 {0x0E4Du, 0xF711u, 0xF899u}, /* NIKHAHIT */ |
133 {0x0000u, 0x0000u, 0x0000u} | 133 {0x0000u, 0x0000u, 0x0000u} |
134 }; | 134 }; |
135 static const thai_pua_mapping_t RD_mappings[] = { | 135 static const thai_pua_mapping_t RD_mappings[] = { |
136 {0x0E0Du, 0xF70Fu, 0xF89Au}, /* YO YING */ | 136 {0x0E0Du, 0xF70Fu, 0xF89Au}, /* YO YING */ |
137 {0x0E10u, 0xF700u, 0xF89Eu}, /* THO THAN */ | 137 {0x0E10u, 0xF700u, 0xF89Eu}, /* THO THAN */ |
138 {0x0000u, 0x0000u, 0x0000u} | 138 {0x0000u, 0x0000u, 0x0000u} |
139 }; | 139 }; |
140 | 140 |
141 switch (action) { | 141 switch (action) { |
142 default: assert (false); /* Fallthrough */ | 142 default: assert (false); HB_FALLTHROUGH; |
143 case NOP: return u; | 143 case NOP: return u; |
144 case SD: pua_mappings = SD_mappings; break; | 144 case SD: pua_mappings = SD_mappings; break; |
145 case SDL: pua_mappings = SDL_mappings; break; | 145 case SDL: pua_mappings = SDL_mappings; break; |
146 case SL: pua_mappings = SL_mappings; break; | 146 case SL: pua_mappings = SL_mappings; break; |
147 case RD: pua_mappings = RD_mappings; break; | 147 case RD: pua_mappings = RD_mappings; break; |
148 } | 148 } |
149 for (; pua_mappings->u; pua_mappings++) | 149 for (; pua_mappings->u; pua_mappings++) |
150 if (pua_mappings->u == u) | 150 if (pua_mappings->u == u) |
151 { | 151 { |
152 hb_codepoint_t glyph; | 152 hb_codepoint_t glyph; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 308 |
309 /* We only get one script at a time, so a script-agnostic implementation | 309 /* We only get one script at a time, so a script-agnostic implementation |
310 * is adequate here. */ | 310 * is adequate here. */ |
311 #define IS_SARA_AM(x) (((x) & ~0x0080u) == 0x0E33u) | 311 #define IS_SARA_AM(x) (((x) & ~0x0080u) == 0x0E33u) |
312 #define NIKHAHIT_FROM_SARA_AM(x) ((x) - 0x0E33u + 0x0E4Du) | 312 #define NIKHAHIT_FROM_SARA_AM(x) ((x) - 0x0E33u + 0x0E4Du) |
313 #define SARA_AA_FROM_SARA_AM(x) ((x) - 1) | 313 #define SARA_AA_FROM_SARA_AM(x) ((x) - 1) |
314 #define IS_TONE_MARK(x) (hb_in_ranges ((x) & ~0x0080u, 0x0E34u, 0x0E37u, 0x0E47u
, 0x0E4Eu, 0x0E31u, 0x0E31u)) | 314 #define IS_TONE_MARK(x) (hb_in_ranges ((x) & ~0x0080u, 0x0E34u, 0x0E37u, 0x0E47u
, 0x0E4Eu, 0x0E31u, 0x0E31u)) |
315 | 315 |
316 buffer->clear_output (); | 316 buffer->clear_output (); |
317 unsigned int count = buffer->len; | 317 unsigned int count = buffer->len; |
318 for (buffer->idx = 0; buffer->idx < count;) | 318 for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;) |
319 { | 319 { |
320 hb_codepoint_t u = buffer->cur().codepoint; | 320 hb_codepoint_t u = buffer->cur().codepoint; |
321 if (likely (!IS_SARA_AM (u))) { | 321 if (likely (!IS_SARA_AM (u))) { |
322 buffer->next_glyph (); | 322 buffer->next_glyph (); |
323 continue; | 323 continue; |
324 } | 324 } |
325 | 325 |
326 /* Is SARA AM. Decompose and reorder. */ | 326 /* Is SARA AM. Decompose and reorder. */ |
327 hb_codepoint_t decomposed[2] = {hb_codepoint_t (NIKHAHIT_FROM_SARA_AM (u)), | 327 hb_codepoint_t decomposed[2] = {hb_codepoint_t (NIKHAHIT_FROM_SARA_AM (u)), |
328 hb_codepoint_t (SARA_AA_FROM_SARA_AM (u))}; | 328 hb_codepoint_t (SARA_AA_FROM_SARA_AM (u))}; |
329 buffer->replace_glyphs (1, 2, decomposed); | 329 buffer->replace_glyphs (1, 2, decomposed); |
330 if (unlikely (buffer->in_error)) | 330 if (unlikely (buffer->in_error)) |
331 return; | 331 return; |
332 | 332 |
333 /* Make Nikhahit be recognized as a mark when zeroing widths. */ | 333 /* Make Nikhahit be recognized as a ccc=0 mark when zeroing widths. */ |
334 unsigned int end = buffer->out_len; | 334 unsigned int end = buffer->out_len; |
335 _hb_glyph_info_set_general_category (&buffer->out_info[end - 2], HB_UNICODE_
GENERAL_CATEGORY_NON_SPACING_MARK); | 335 _hb_glyph_info_set_general_category (&buffer->out_info[end - 2], HB_UNICODE_
GENERAL_CATEGORY_NON_SPACING_MARK); |
336 | 336 |
337 /* Ok, let's see... */ | 337 /* Ok, let's see... */ |
338 unsigned int start = end - 2; | 338 unsigned int start = end - 2; |
339 while (start > 0 && IS_TONE_MARK (buffer->out_info[start - 1].codepoint)) | 339 while (start > 0 && IS_TONE_MARK (buffer->out_info[start - 1].codepoint)) |
340 start--; | 340 start--; |
341 | 341 |
342 if (start + 2 < end) | 342 if (start + 2 < end) |
343 { | 343 { |
(...skipping 21 matching lines...) Expand all Loading... |
365 } | 365 } |
366 | 366 |
367 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai = | 367 const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai = |
368 { | 368 { |
369 "thai", | 369 "thai", |
370 NULL, /* collect_features */ | 370 NULL, /* collect_features */ |
371 NULL, /* override_features */ | 371 NULL, /* override_features */ |
372 NULL, /* data_create */ | 372 NULL, /* data_create */ |
373 NULL, /* data_destroy */ | 373 NULL, /* data_destroy */ |
374 preprocess_text_thai, | 374 preprocess_text_thai, |
| 375 NULL, /* postprocess_glyphs */ |
375 HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, | 376 HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, |
376 NULL, /* decompose */ | 377 NULL, /* decompose */ |
377 NULL, /* compose */ | 378 NULL, /* compose */ |
378 NULL, /* setup_masks */ | 379 NULL, /* setup_masks */ |
379 HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT, | 380 HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT, |
380 false,/* fallback_position */ | 381 false,/* fallback_position */ |
381 }; | 382 }; |
OLD | NEW |