Index: third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh |
diff --git a/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh b/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh |
index 5c4235547bb37365a69b3db570599e7493af59a2..0e9a53dd56135caff8a93f381af4935b310ed3ed 100644 |
--- a/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh |
+++ b/third_party/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh |
@@ -1,7 +1,7 @@ |
#line 1 "hb-ot-shape-complex-indic-machine.rl" |
/* |
- * Copyright © 2011 Google, Inc. |
+ * Copyright © 2011,2012 Google, Inc. |
* |
* This is part of HarfBuzz, a text shaping library. |
* |
@@ -36,174 +36,154 @@ HB_BEGIN_DECLS |
#line 38 "hb-ot-shape-complex-indic-machine.hh.tmp" |
static const unsigned char _indic_syllable_machine_trans_keys[] = { |
- 0u, 0u, 5u, 5u, 1u, 2u, 1u, 2u, 5u, 5u, 1u, 5u, 5u, 5u, 1u, 2u, |
- 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, |
- 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, |
- 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, |
- 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, 0u, 12u, |
- 0u, 12u, 0 |
+ 5u, 5u, 1u, 2u, 1u, 2u, 5u, 5u, 1u, 5u, 1u, 2u, 5u, 5u, 1u, 13u, |
+ 4u, 11u, 4u, 11u, 5u, 11u, 1u, 10u, 1u, 10u, 10u, 10u, 10u, 10u, 4u, 10u, |
+ 5u, 10u, 8u, 10u, 5u, 10u, 6u, 10u, 9u, 10u, 4u, 11u, 1u, 13u, 4u, 10u, |
+ 4u, 10u, 5u, 10u, 4u, 10u, 5u, 10u, 8u, 10u, 10u, 10u, 10u, 10u, 4u, 10u, |
+ 4u, 10u, 5u, 10u, 4u, 10u, 5u, 10u, 8u, 10u, 10u, 10u, 10u, 10u, 0 |
}; |
static const char _indic_syllable_machine_key_spans[] = { |
- 0, 1, 2, 2, 1, 5, 1, 2, |
- 13, 13, 13, 13, 13, 13, 13, 13, |
- 13, 13, 13, 13, 13, 13, 13, 13, |
- 13, 13, 13, 13, 13, 13, 13, 13, |
- 13, 13, 13, 13, 13, 13, 13, 13, |
- 13 |
+ 1, 2, 2, 1, 5, 2, 1, 13, |
+ 8, 8, 7, 10, 10, 1, 1, 7, |
+ 6, 3, 6, 5, 2, 8, 13, 7, |
+ 7, 6, 7, 6, 3, 1, 1, 7, |
+ 7, 6, 7, 6, 3, 1, 1 |
}; |
-static const short _indic_syllable_machine_index_offsets[] = { |
- 0, 0, 2, 5, 8, 10, 16, 18, |
- 21, 35, 49, 63, 77, 91, 105, 119, |
- 133, 147, 161, 175, 189, 203, 217, 231, |
- 245, 259, 273, 287, 301, 315, 329, 343, |
- 357, 371, 385, 399, 413, 427, 441, 455, |
- 469 |
+static const unsigned char _indic_syllable_machine_index_offsets[] = { |
+ 0, 2, 5, 8, 10, 16, 19, 21, |
+ 35, 44, 53, 61, 72, 83, 85, 87, |
+ 95, 102, 106, 113, 119, 122, 131, 145, |
+ 153, 161, 168, 176, 183, 187, 189, 191, |
+ 199, 207, 214, 222, 229, 233, 235 |
}; |
static const char _indic_syllable_machine_indicies[] = { |
- 0, 1, 2, 2, 1, 3, 3, |
- 1, 4, 1, 2, 2, 1, 1, 0, |
- 1, 5, 1, 6, 6, 1, 7, 6, |
- 8, 9, 1, 1, 1, 1, 1, 1, |
- 1, 1, 10, 1, 11, 12, 13, 14, |
- 1, 1, 1, 1, 1, 1, 1, 1, |
- 15, 1, 16, 17, 18, 19, 20, 21, |
- 22, 22, 23, 24, 25, 26, 27, 1, |
- 16, 17, 18, 19, 20, 28, 22, 22, |
- 23, 24, 25, 26, 27, 1, 29, 30, |
- 31, 32, 33, 1, 34, 35, 36, 37, |
- 38, 1, 39, 1, 29, 30, 31, 32, |
- 1, 1, 34, 35, 36, 37, 38, 1, |
- 39, 1, 29, 30, 31, 32, 1, 1, |
- 1, 1, 36, 37, 38, 1, 39, 1, |
- 29, 30, 31, 32, 40, 2, 1, 1, |
- 36, 37, 38, 1, 39, 1, 29, 30, |
- 31, 32, 1, 2, 1, 1, 36, 37, |
- 38, 1, 39, 1, 29, 30, 31, 32, |
- 1, 1, 1, 1, 1, 1, 38, 1, |
- 39, 1, 29, 30, 31, 32, 1, 1, |
- 1, 1, 1, 1, 41, 1, 39, 1, |
- 29, 30, 31, 32, 1, 1, 1, 1, |
- 1, 1, 1, 1, 39, 1, 42, 43, |
- 44, 45, 46, 4, 47, 47, 48, 49, |
- 50, 1, 51, 1, 42, 43, 44, 45, |
- 1, 4, 47, 47, 48, 49, 50, 1, |
- 51, 1, 42, 43, 44, 45, 1, 1, |
- 1, 1, 48, 49, 50, 1, 51, 1, |
- 42, 43, 44, 45, 52, 3, 1, 1, |
- 48, 49, 50, 1, 51, 1, 42, 43, |
- 44, 45, 1, 3, 1, 1, 48, 49, |
- 50, 1, 51, 1, 42, 43, 44, 45, |
- 1, 1, 1, 1, 1, 1, 50, 1, |
- 51, 1, 42, 43, 44, 45, 1, 1, |
- 1, 1, 1, 1, 53, 1, 51, 1, |
- 42, 43, 44, 45, 1, 1, 1, 1, |
- 1, 1, 1, 1, 51, 1, 16, 17, |
- 18, 19, 1, 21, 22, 22, 23, 24, |
- 25, 26, 27, 1, 16, 6, 6, 19, |
- 1, 1, 54, 54, 1, 24, 25, 1, |
- 27, 1, 16, 6, 6, 19, 1, 1, |
- 1, 1, 1, 24, 25, 1, 27, 1, |
- 16, 17, 18, 19, 1, 1, 1, 1, |
- 1, 1, 25, 1, 27, 1, 16, 17, |
- 18, 19, 1, 1, 1, 1, 1, 1, |
- 55, 1, 27, 1, 16, 17, 18, 19, |
- 1, 1, 1, 1, 1, 1, 1, 1, |
- 27, 1, 16, 17, 18, 19, 56, 57, |
- 1, 1, 23, 24, 25, 1, 27, 1, |
- 16, 17, 18, 19, 1, 57, 1, 1, |
- 23, 24, 25, 1, 27, 1, 16, 17, |
- 18, 19, 1, 1, 1, 1, 23, 24, |
- 25, 1, 27, 1, 16, 17, 18, 19, |
- 1, 58, 1, 1, 23, 24, 25, 1, |
- 27, 1, 16, 17, 18, 19, 1, 1, |
- 59, 59, 1, 24, 25, 1, 27, 1, |
- 16, 17, 18, 19, 1, 1, 1, 1, |
- 1, 24, 25, 1, 27, 1, 16, 6, |
- 6, 9, 1, 1, 54, 54, 1, 24, |
- 25, 1, 10, 1, 0 |
+ 1, 0, 2, 2, 0, 4, 4, 3, |
+ 5, 3, 4, 4, 3, 3, 5, 3, |
+ 7, 7, 6, 8, 6, 2, 10, 11, |
+ 9, 9, 9, 9, 9, 9, 9, 9, |
+ 12, 12, 9, 14, 15, 16, 16, 17, |
+ 18, 19, 20, 13, 21, 15, 16, 16, |
+ 17, 18, 19, 20, 13, 15, 16, 16, |
+ 17, 18, 19, 20, 13, 2, 2, 13, |
+ 13, 13, 22, 22, 13, 18, 19, 13, |
+ 2, 2, 13, 13, 13, 13, 13, 13, |
+ 18, 19, 13, 19, 13, 23, 13, 24, |
+ 25, 13, 13, 17, 18, 19, 13, 25, |
+ 13, 13, 17, 18, 19, 13, 17, 18, |
+ 19, 13, 26, 13, 13, 17, 18, 19, |
+ 13, 27, 27, 13, 18, 19, 13, 18, |
+ 19, 13, 14, 28, 16, 16, 17, 18, |
+ 19, 20, 13, 2, 2, 11, 13, 13, |
+ 22, 22, 13, 18, 19, 13, 12, 12, |
+ 13, 30, 5, 31, 32, 33, 34, 35, |
+ 29, 4, 5, 31, 32, 33, 34, 35, |
+ 29, 5, 31, 32, 33, 34, 35, 29, |
+ 36, 37, 29, 29, 33, 34, 35, 29, |
+ 37, 29, 29, 33, 34, 35, 29, 33, |
+ 34, 35, 29, 35, 29, 38, 29, 40, |
+ 8, 41, 41, 42, 43, 44, 39, 7, |
+ 8, 41, 41, 42, 43, 44, 39, 8, |
+ 41, 41, 42, 43, 44, 39, 45, 46, |
+ 39, 39, 42, 43, 44, 39, 46, 39, |
+ 39, 42, 43, 44, 39, 42, 43, 44, |
+ 39, 44, 39, 47, 39, 0 |
}; |
static const char _indic_syllable_machine_trans_targs[] = { |
- 2, 0, 14, 22, 3, 7, 10, 9, |
- 11, 12, 20, 9, 10, 11, 12, 20, |
- 9, 10, 11, 12, 28, 29, 6, 34, |
- 31, 32, 37, 20, 40, 9, 10, 11, |
- 12, 13, 1, 5, 15, 17, 18, 20, |
- 16, 19, 9, 10, 11, 12, 21, 4, |
- 23, 25, 26, 20, 24, 27, 30, 33, |
- 35, 36, 38, 39 |
+ 7, 1, 8, 7, 25, 2, 7, 33, |
+ 5, 7, 21, 23, 31, 7, 9, 11, |
+ 0, 15, 13, 14, 18, 10, 12, 7, |
+ 16, 17, 19, 20, 22, 7, 24, 3, |
+ 4, 26, 29, 30, 27, 28, 7, 7, |
+ 32, 6, 34, 37, 38, 35, 36, 7 |
}; |
static const char _indic_syllable_machine_trans_actions[] = { |
+ 1, 0, 2, 3, 2, 0, 4, 2, |
+ 0, 7, 2, 2, 2, 8, 2, 0, |
+ 0, 0, 0, 0, 0, 2, 0, 9, |
+ 0, 0, 0, 0, 0, 10, 2, 0, |
+ 0, 0, 0, 0, 0, 0, 11, 12, |
+ 2, 0, 0, 0, 0, 0, 0, 13 |
+}; |
+ |
+static const char _indic_syllable_machine_to_state_actions[] = { |
+ 0, 0, 0, 0, 0, 0, 0, 5, |
+ 0, 0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, 0, |
- 0, 0, 0, 1, 1, 1, 1, 1, |
- 2, 2, 2, 2, 0, 0, 0, 0, |
- 0, 0, 0, 2, 0, 3, 3, 3, |
- 3, 0, 0, 0, 0, 0, 0, 3, |
- 0, 0, 4, 4, 4, 4, 0, 0, |
- 0, 0, 0, 4, 0, 0, 0, 0, |
- 0, 0, 0, 0 |
+ 0, 0, 0, 0, 0, 0, 0, 0, |
+ 0, 0, 0, 0, 0, 0, 0 |
}; |
-static const char _indic_syllable_machine_eof_actions[] = { |
+static const char _indic_syllable_machine_from_state_actions[] = { |
+ 0, 0, 0, 0, 0, 0, 0, 6, |
+ 0, 0, 0, 0, 0, 0, 0, 0, |
+ 0, 0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, 0, |
- 0, 1, 2, 2, 3, 3, 3, 3, |
- 3, 3, 3, 3, 4, 4, 4, 4, |
- 4, 4, 4, 4, 2, 2, 2, 2, |
- 2, 2, 2, 2, 2, 2, 2, 2, |
- 2 |
+ 0, 0, 0, 0, 0, 0, 0 |
}; |
-static const int indic_syllable_machine_start = 8; |
-static const int indic_syllable_machine_first_final = 8; |
-static const int indic_syllable_machine_error = 0; |
+static const unsigned char _indic_syllable_machine_eof_trans[] = { |
+ 1, 1, 4, 4, 4, 7, 7, 0, |
+ 14, 14, 14, 14, 14, 14, 14, 14, |
+ 14, 14, 14, 14, 14, 14, 14, 30, |
+ 30, 30, 30, 30, 30, 30, 30, 40, |
+ 40, 40, 40, 40, 40, 40, 40 |
+}; |
+ |
+static const int indic_syllable_machine_start = 7; |
+static const int indic_syllable_machine_first_final = 7; |
+static const int indic_syllable_machine_error = -1; |
-static const int indic_syllable_machine_en_main = 8; |
+static const int indic_syllable_machine_en_main = 7; |
#line 38 "hb-ot-shape-complex-indic-machine.rl" |
-#line 83 "hb-ot-shape-complex-indic-machine.rl" |
+#line 79 "hb-ot-shape-complex-indic-machine.rl" |
- |
-static void |
-set_cluster (hb_buffer_t *buffer, |
- unsigned int start, unsigned int end) |
-{ |
- unsigned int cluster = buffer->info[start].cluster; |
- |
- for (unsigned int i = start + 1; i < end; i++) |
- cluster = MIN (cluster, buffer->info[i].cluster); |
- for (unsigned int i = start; i < end; i++) |
- buffer->info[i].cluster = cluster; |
-} |
+#define process_syllable(func) \ |
+ HB_STMT_START { \ |
+ /* fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #func); */ \ |
+ for (unsigned int i = last; i < p+1; i++) \ |
+ info[i].syllable() = syllable_serial; \ |
+ PASTE (initial_reordering_, func) (map, buffer, mask_array, last, p+1); \ |
+ last = p+1; \ |
+ syllable_serial++; \ |
+ if (unlikely (!syllable_serial)) syllable_serial++; \ |
+ } HB_STMT_END |
static void |
find_syllables (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t *mask_array) |
{ |
- unsigned int p, pe, eof; |
+ unsigned int p, pe, eof, ts, te, act; |
int cs; |
+ hb_glyph_info_t *info = buffer->info; |
-#line 194 "hb-ot-shape-complex-indic-machine.hh.tmp" |
+#line 170 "hb-ot-shape-complex-indic-machine.hh.tmp" |
{ |
cs = indic_syllable_machine_start; |
+ ts = 0; |
+ te = 0; |
+ act = 0; |
} |
-#line 106 "hb-ot-shape-complex-indic-machine.rl" |
+#line 101 "hb-ot-shape-complex-indic-machine.rl" |
p = 0; |
pe = eof = buffer->len; |
unsigned int last = 0; |
+ uint8_t syllable_serial = 1; |
-#line 207 "hb-ot-shape-complex-indic-machine.hh.tmp" |
+#line 187 "hb-ot-shape-complex-indic-machine.hh.tmp" |
{ |
int _slen; |
int _trans; |
@@ -211,17 +191,24 @@ find_syllables (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t *mask_arr |
const char *_inds; |
if ( p == pe ) |
goto _test_eof; |
- if ( cs == 0 ) |
- goto _out; |
_resume: |
+ switch ( _indic_syllable_machine_from_state_actions[cs] ) { |
+ case 6: |
+#line 1 "hb-ot-shape-complex-indic-machine.rl" |
+ {ts = p;} |
+ break; |
+#line 201 "hb-ot-shape-complex-indic-machine.hh.tmp" |
+ } |
+ |
_keys = _indic_syllable_machine_trans_keys + (cs<<1); |
_inds = _indic_syllable_machine_indicies + _indic_syllable_machine_index_offsets[cs]; |
_slen = _indic_syllable_machine_key_spans[cs]; |
- _trans = _inds[ _slen > 0 && _keys[0] <=( buffer->info[p].indic_category()) && |
- ( buffer->info[p].indic_category()) <= _keys[1] ? |
- ( buffer->info[p].indic_category()) - _keys[0] : _slen ]; |
+ _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].indic_category()) && |
+ ( info[p].indic_category()) <= _keys[1] ? |
+ ( info[p].indic_category()) - _keys[0] : _slen ]; |
+_eof_trans: |
cs = _indic_syllable_machine_trans_targs[_trans]; |
if ( _indic_syllable_machine_trans_actions[_trans] == 0 ) |
@@ -229,73 +216,75 @@ _resume: |
switch ( _indic_syllable_machine_trans_actions[_trans] ) { |
case 2: |
-#line 62 "hb-ot-shape-complex-indic-machine.rl" |
- { found_consonant_syllable (map, buffer, mask_array, last, p); } |
-#line 67 "hb-ot-shape-complex-indic-machine.rl" |
- { set_cluster (buffer, p, last); last = p; } |
+#line 1 "hb-ot-shape-complex-indic-machine.rl" |
+ {te = p+1;} |
break; |
- case 3: |
-#line 63 "hb-ot-shape-complex-indic-machine.rl" |
- { found_vowel_syllable (map, buffer, mask_array, last, p); } |
-#line 67 "hb-ot-shape-complex-indic-machine.rl" |
- { set_cluster (buffer, p, last); last = p; } |
+ case 9: |
+#line 72 "hb-ot-shape-complex-indic-machine.rl" |
+ {te = p+1;{ process_syllable (consonant_syllable); }} |
break; |
- case 4: |
-#line 64 "hb-ot-shape-complex-indic-machine.rl" |
- { found_standalone_cluster (map, buffer, mask_array, last, p); } |
-#line 67 "hb-ot-shape-complex-indic-machine.rl" |
- { set_cluster (buffer, p, last); last = p; } |
+ case 11: |
+#line 73 "hb-ot-shape-complex-indic-machine.rl" |
+ {te = p+1;{ process_syllable (vowel_syllable); }} |
+ break; |
+ case 13: |
+#line 74 "hb-ot-shape-complex-indic-machine.rl" |
+ {te = p+1;{ process_syllable (standalone_cluster); }} |
+ break; |
+ case 7: |
+#line 75 "hb-ot-shape-complex-indic-machine.rl" |
+ {te = p+1;{ process_syllable (non_indic); }} |
+ break; |
+ case 8: |
+#line 72 "hb-ot-shape-complex-indic-machine.rl" |
+ {te = p;p--;{ process_syllable (consonant_syllable); }} |
+ break; |
+ case 10: |
+#line 73 "hb-ot-shape-complex-indic-machine.rl" |
+ {te = p;p--;{ process_syllable (vowel_syllable); }} |
+ break; |
+ case 12: |
+#line 74 "hb-ot-shape-complex-indic-machine.rl" |
+ {te = p;p--;{ process_syllable (standalone_cluster); }} |
break; |
case 1: |
-#line 65 "hb-ot-shape-complex-indic-machine.rl" |
- { found_non_indic (map, buffer, mask_array, last, p); } |
-#line 67 "hb-ot-shape-complex-indic-machine.rl" |
- { set_cluster (buffer, p, last); last = p; } |
+#line 72 "hb-ot-shape-complex-indic-machine.rl" |
+ {{p = ((te))-1;}{ process_syllable (consonant_syllable); }} |
+ break; |
+ case 3: |
+#line 73 "hb-ot-shape-complex-indic-machine.rl" |
+ {{p = ((te))-1;}{ process_syllable (vowel_syllable); }} |
+ break; |
+ case 4: |
+#line 74 "hb-ot-shape-complex-indic-machine.rl" |
+ {{p = ((te))-1;}{ process_syllable (standalone_cluster); }} |
break; |
-#line 256 "hb-ot-shape-complex-indic-machine.hh.tmp" |
+#line 263 "hb-ot-shape-complex-indic-machine.hh.tmp" |
} |
_again: |
- if ( cs == 0 ) |
- goto _out; |
+ switch ( _indic_syllable_machine_to_state_actions[cs] ) { |
+ case 5: |
+#line 1 "hb-ot-shape-complex-indic-machine.rl" |
+ {ts = 0;} |
+ break; |
+#line 272 "hb-ot-shape-complex-indic-machine.hh.tmp" |
+ } |
+ |
if ( ++p != pe ) |
goto _resume; |
_test_eof: {} |
if ( p == eof ) |
{ |
- switch ( _indic_syllable_machine_eof_actions[cs] ) { |
- case 2: |
-#line 62 "hb-ot-shape-complex-indic-machine.rl" |
- { found_consonant_syllable (map, buffer, mask_array, last, p); } |
-#line 67 "hb-ot-shape-complex-indic-machine.rl" |
- { set_cluster (buffer, p, last); last = p; } |
- break; |
- case 3: |
-#line 63 "hb-ot-shape-complex-indic-machine.rl" |
- { found_vowel_syllable (map, buffer, mask_array, last, p); } |
-#line 67 "hb-ot-shape-complex-indic-machine.rl" |
- { set_cluster (buffer, p, last); last = p; } |
- break; |
- case 4: |
-#line 64 "hb-ot-shape-complex-indic-machine.rl" |
- { found_standalone_cluster (map, buffer, mask_array, last, p); } |
-#line 67 "hb-ot-shape-complex-indic-machine.rl" |
- { set_cluster (buffer, p, last); last = p; } |
- break; |
- case 1: |
-#line 65 "hb-ot-shape-complex-indic-machine.rl" |
- { found_non_indic (map, buffer, mask_array, last, p); } |
-#line 67 "hb-ot-shape-complex-indic-machine.rl" |
- { set_cluster (buffer, p, last); last = p; } |
- break; |
-#line 292 "hb-ot-shape-complex-indic-machine.hh.tmp" |
+ if ( _indic_syllable_machine_eof_trans[cs] > 0 ) { |
+ _trans = _indic_syllable_machine_eof_trans[cs] - 1; |
+ goto _eof_trans; |
} |
} |
- _out: {} |
} |
-#line 114 "hb-ot-shape-complex-indic-machine.rl" |
+#line 110 "hb-ot-shape-complex-indic-machine.rl" |
} |