From aaaa65baa7fcfb65ae814528bdd93cc5c4ea540d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Oct 2018 16:59:48 +0200 Subject: [PATCH 01/30] [khmer] Remove unused code --- src/hb-ot-shape-complex-khmer.hh | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/hb-ot-shape-complex-khmer.hh b/src/hb-ot-shape-complex-khmer.hh index 3371c1302..c86e7aad6 100644 --- a/src/hb-ot-shape-complex-khmer.hh +++ b/src/hb-ot-shape-complex-khmer.hh @@ -59,18 +59,6 @@ matra_position_khmer (khmer_position_t side) }; } -static inline bool -is_consonant_or_vowel (const hb_glyph_info_t &info) -{ - return is_one_of (info, CONSONANT_FLAGS | FLAG (OT_V)); -} - -static inline bool -is_coeng (const hb_glyph_info_t &info) -{ - return is_one_of (info, FLAG (OT_Coeng)); -} - static inline void set_khmer_properties (hb_glyph_info_t &info) { From 51436547162a18e88144e7125ad6ce4a69a08d4b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Oct 2018 19:09:58 +0200 Subject: [PATCH 02/30] [khmer] Rewrite grammar completely Based on experimenting with Uniscribe to extract grammar and categories. Failures down from 44 to 35: KHMER: 299089 out of 299124 tests passed. 35 failed (0.0117008%) We still don't enforce the one-matra rule pre-decomposition, but enforce an order and one-matra-per-position post-decomposition. https://github.com/harfbuzz/harfbuzz/issues/667 --- src/hb-ot-shape-complex-indic.hh | 2 +- src/hb-ot-shape-complex-khmer-machine.hh | 300 +++++++++++++++-------- src/hb-ot-shape-complex-khmer-machine.rl | 34 +-- src/hb-ot-shape-complex-khmer.cc | 4 +- src/hb-ot-shape-complex-khmer.hh | 99 ++++---- 5 files changed, 266 insertions(+), 173 deletions(-) diff --git a/src/hb-ot-shape-complex-indic.hh b/src/hb-ot-shape-complex-indic.hh index 9e597797c..fe5595f89 100644 --- a/src/hb-ot-shape-complex-indic.hh +++ b/src/hb-ot-shape-complex-indic.hh @@ -125,7 +125,7 @@ enum indic_syllabic_category_t { INDIC_SYLLABIC_CATEGORY_CONSONANT_PRECEDING_REPHA = OT_Repha, INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED = OT_X, /* Don't care. */ INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED = OT_CM, - INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA = OT_N, + INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA = OT_CM, INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER = OT_CS, INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK = OT_SM, /* https://github.com/harfbuzz/harfbuzz/issues/552 */ INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER = OT_Coeng, diff --git a/src/hb-ot-shape-complex-khmer-machine.hh b/src/hb-ot-shape-complex-khmer-machine.hh index a7e1711eb..d013456bc 100644 --- a/src/hb-ot-shape-complex-khmer-machine.hh +++ b/src/hb-ot-shape-complex-khmer-machine.hh @@ -34,130 +34,200 @@ #line 36 "hb-ot-shape-complex-khmer-machine.hh" static const unsigned char _khmer_syllable_machine_trans_keys[] = { - 7u, 7u, 1u, 16u, 13u, 13u, 1u, 16u, 7u, 13u, 7u, 7u, 1u, 16u, 13u, 13u, - 1u, 16u, 7u, 13u, 1u, 16u, 3u, 14u, 3u, 14u, 5u, 14u, 3u, 14u, 5u, 14u, - 8u, 8u, 3u, 13u, 3u, 8u, 8u, 8u, 3u, 8u, 3u, 14u, 3u, 14u, 5u, 14u, - 3u, 14u, 5u, 14u, 8u, 8u, 3u, 13u, 3u, 8u, 8u, 8u, 3u, 8u, 3u, 14u, - 3u, 14u, 7u, 13u, 7u, 7u, 1u, 16u, 0 + 5u, 26u, 5u, 21u, 5u, 26u, 5u, 21u, 1u, 16u, 5u, 21u, 5u, 26u, 5u, 21u, + 5u, 26u, 5u, 21u, 1u, 16u, 5u, 21u, 5u, 26u, 5u, 21u, 1u, 16u, 5u, 21u, + 5u, 26u, 5u, 21u, 5u, 26u, 5u, 21u, 5u, 26u, 1u, 16u, 1u, 29u, 5u, 29u, + 5u, 29u, 5u, 29u, 22u, 22u, 5u, 22u, 5u, 29u, 5u, 29u, 5u, 29u, 5u, 26u, + 5u, 29u, 5u, 29u, 22u, 22u, 5u, 22u, 5u, 29u, 5u, 29u, 1u, 16u, 5u, 29u, + 5u, 29u, 0 }; static const char _khmer_syllable_machine_key_spans[] = { - 1, 16, 1, 16, 7, 1, 16, 1, - 16, 7, 16, 12, 12, 10, 12, 10, - 1, 11, 6, 1, 6, 12, 12, 10, - 12, 10, 1, 11, 6, 1, 6, 12, - 12, 7, 1, 16 + 22, 17, 22, 17, 16, 17, 22, 17, + 22, 17, 16, 17, 22, 17, 16, 17, + 22, 17, 22, 17, 22, 16, 29, 25, + 25, 25, 1, 18, 25, 25, 25, 22, + 25, 25, 1, 18, 25, 25, 16, 25, + 25 }; static const short _khmer_syllable_machine_index_offsets[] = { - 0, 2, 19, 21, 38, 46, 48, 65, - 67, 84, 92, 109, 122, 135, 146, 159, - 170, 172, 184, 191, 193, 200, 213, 226, - 237, 250, 261, 263, 275, 282, 284, 291, - 304, 317, 325, 327 + 0, 23, 41, 64, 82, 99, 117, 140, + 158, 181, 199, 216, 234, 257, 275, 292, + 310, 333, 351, 374, 392, 415, 432, 462, + 488, 514, 540, 542, 561, 587, 613, 639, + 662, 688, 714, 716, 735, 761, 787, 804, + 830 }; static const char _khmer_syllable_machine_indicies[] = { - 1, 0, 2, 2, 0, 0, 0, 0, + 1, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 2, + 3, 0, 0, 0, 0, 4, 0, 1, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 3, + 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 0, 3, 0, 4, 4, 0, + 0, 3, 0, 0, 0, 0, 4, 0, + 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 0, 1, 0, - 0, 0, 0, 0, 5, 0, 7, 6, - 8, 8, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 8, - 6, 9, 6, 10, 10, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 10, 6, 7, 6, 6, 6, - 6, 6, 11, 6, 4, 4, 13, 12, - 14, 15, 7, 16, 12, 12, 4, 4, - 11, 17, 12, 4, 12, 19, 18, 20, - 21, 1, 22, 18, 18, 18, 18, 5, - 23, 18, 24, 18, 21, 21, 1, 22, - 18, 18, 18, 18, 18, 23, 18, 21, - 21, 1, 22, 18, 18, 18, 18, 18, - 23, 18, 25, 18, 21, 21, 1, 22, - 18, 18, 18, 18, 18, 26, 18, 21, - 21, 1, 22, 18, 18, 18, 18, 18, - 26, 18, 27, 18, 28, 18, 29, 18, - 18, 22, 18, 18, 18, 18, 3, 18, - 30, 18, 18, 18, 18, 22, 18, 22, - 18, 28, 18, 18, 18, 18, 22, 18, - 19, 18, 21, 21, 1, 22, 18, 18, - 18, 18, 18, 23, 18, 32, 31, 33, - 33, 7, 16, 31, 31, 31, 31, 31, - 34, 31, 33, 33, 7, 16, 31, 31, - 31, 31, 31, 34, 31, 35, 31, 33, - 33, 7, 16, 31, 31, 31, 31, 31, - 36, 31, 33, 33, 7, 16, 31, 31, - 31, 31, 31, 36, 31, 37, 31, 38, - 31, 39, 31, 31, 16, 31, 31, 31, - 31, 9, 31, 40, 31, 31, 31, 31, - 16, 31, 16, 31, 38, 31, 31, 31, - 31, 16, 31, 13, 31, 41, 33, 7, - 16, 31, 31, 31, 31, 11, 34, 31, - 13, 31, 33, 33, 7, 16, 31, 31, - 31, 31, 31, 34, 31, 7, 42, 42, - 42, 42, 42, 11, 42, 7, 42, 10, - 10, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 10, 42, + 4, 0, 6, 6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 6, 0, 7, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 8, 0, 9, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 10, 0, 0, + 0, 0, 4, 0, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 10, 0, 11, 11, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 12, 0, + 0, 0, 0, 4, 0, 11, 11, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 12, 0, 13, + 13, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 13, 0, + 15, 15, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, + 16, 14, 15, 15, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 16, 17, 17, 17, 17, 18, + 17, 19, 19, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 18, 17, 20, 20, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 20, 17, 21, 21, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 22, 17, 23, 23, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 24, 17, + 17, 17, 17, 18, 17, 23, 23, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 24, 17, 25, + 25, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 26, + 17, 17, 17, 17, 18, 17, 25, 25, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 26, 17, + 15, 15, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 27, + 16, 17, 17, 17, 17, 18, 17, 28, + 28, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 28, 17, + 13, 13, 29, 29, 30, 30, 29, 29, + 29, 29, 2, 2, 29, 31, 29, 13, + 29, 29, 29, 29, 16, 20, 29, 29, + 29, 18, 24, 26, 22, 29, 33, 33, + 32, 32, 32, 32, 32, 32, 32, 34, + 32, 32, 32, 32, 32, 2, 3, 6, + 32, 32, 32, 4, 10, 12, 8, 32, + 35, 35, 32, 32, 32, 32, 32, 32, + 32, 36, 32, 32, 32, 32, 32, 32, + 3, 6, 32, 32, 32, 4, 10, 12, + 8, 32, 5, 5, 32, 32, 32, 32, + 32, 32, 32, 36, 32, 32, 32, 32, + 32, 32, 4, 6, 32, 32, 32, 32, + 32, 32, 8, 32, 6, 32, 7, 7, + 32, 32, 32, 32, 32, 32, 32, 36, + 32, 32, 32, 32, 32, 32, 8, 6, + 32, 37, 37, 32, 32, 32, 32, 32, + 32, 32, 36, 32, 32, 32, 32, 32, + 32, 10, 6, 32, 32, 32, 4, 32, + 32, 8, 32, 38, 38, 32, 32, 32, + 32, 32, 32, 32, 36, 32, 32, 32, + 32, 32, 32, 12, 6, 32, 32, 32, + 4, 10, 32, 8, 32, 35, 35, 32, + 32, 32, 32, 32, 32, 32, 34, 32, + 32, 32, 32, 32, 32, 3, 6, 32, + 32, 32, 4, 10, 12, 8, 32, 15, + 15, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 16, + 39, 39, 39, 39, 18, 39, 41, 41, + 40, 40, 40, 40, 40, 40, 40, 42, + 40, 40, 40, 40, 40, 40, 16, 20, + 40, 40, 40, 18, 24, 26, 22, 40, + 19, 19, 40, 40, 40, 40, 40, 40, + 40, 42, 40, 40, 40, 40, 40, 40, + 18, 20, 40, 40, 40, 40, 40, 40, + 22, 40, 20, 40, 21, 21, 40, 40, + 40, 40, 40, 40, 40, 42, 40, 40, + 40, 40, 40, 40, 22, 20, 40, 43, + 43, 40, 40, 40, 40, 40, 40, 40, + 42, 40, 40, 40, 40, 40, 40, 24, + 20, 40, 40, 40, 18, 40, 40, 22, + 40, 44, 44, 40, 40, 40, 40, 40, + 40, 40, 42, 40, 40, 40, 40, 40, + 40, 26, 20, 40, 40, 40, 18, 24, + 40, 22, 40, 28, 28, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 28, 39, 45, 45, 40, 40, + 40, 40, 40, 40, 40, 46, 40, 40, + 40, 40, 40, 27, 16, 20, 40, 40, + 40, 18, 24, 26, 22, 40, 41, 41, + 40, 40, 40, 40, 40, 40, 40, 46, + 40, 40, 40, 40, 40, 40, 16, 20, + 40, 40, 40, 18, 24, 26, 22, 40, 0 }; static const char _khmer_syllable_machine_trans_targs[] = { - 10, 14, 17, 20, 11, 21, 10, 24, - 27, 30, 31, 32, 10, 22, 33, 34, - 26, 35, 10, 12, 4, 0, 16, 3, - 13, 15, 1, 10, 18, 2, 19, 10, - 23, 5, 8, 25, 6, 10, 28, 7, - 29, 9, 10 + 22, 1, 30, 24, 25, 3, 26, 5, + 27, 7, 28, 9, 29, 23, 22, 11, + 32, 22, 33, 13, 34, 15, 35, 17, + 36, 19, 37, 40, 39, 22, 31, 38, + 22, 0, 10, 2, 4, 6, 8, 22, + 22, 12, 14, 16, 18, 20, 21 }; static const char _khmer_syllable_machine_trans_actions[] = { - 1, 2, 2, 0, 2, 2, 3, 2, - 2, 0, 2, 2, 6, 2, 0, 0, - 0, 0, 7, 2, 0, 0, 0, 0, - 2, 2, 0, 8, 0, 0, 0, 9, - 2, 0, 0, 2, 0, 10, 0, 0, - 0, 0, 11 + 1, 0, 2, 2, 2, 0, 0, 0, + 2, 0, 2, 0, 2, 2, 3, 0, + 4, 5, 2, 0, 0, 0, 2, 0, + 2, 0, 2, 4, 4, 8, 9, 0, + 10, 0, 0, 0, 0, 0, 0, 11, + 12, 0, 0, 0, 0, 0, 0 }; static const char _khmer_syllable_machine_to_state_actions[] = { 0, 0, 0, 0, 0, 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, 6, 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 _khmer_syllable_machine_from_state_actions[] = { 0, 0, 0, 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, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 + 0 }; static const unsigned char _khmer_syllable_machine_eof_trans[] = { - 1, 1, 1, 1, 1, 7, 7, 7, - 7, 7, 0, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, - 32, 43, 43, 43 + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 15, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 0, 33, + 33, 33, 33, 33, 33, 33, 33, 40, + 41, 41, 41, 41, 41, 41, 40, 41, + 41 }; -static const int khmer_syllable_machine_start = 10; -static const int khmer_syllable_machine_first_final = 10; +static const int khmer_syllable_machine_start = 22; +static const int khmer_syllable_machine_first_final = 22; static const int khmer_syllable_machine_error = -1; -static const int khmer_syllable_machine_en_main = 10; +static const int khmer_syllable_machine_en_main = 22; #line 36 "hb-ot-shape-complex-khmer-machine.rl" -#line 74 "hb-ot-shape-complex-khmer-machine.rl" +#line 80 "hb-ot-shape-complex-khmer-machine.rl" #define found_syllable(syllable_type) \ @@ -177,7 +247,7 @@ find_syllables (hb_buffer_t *buffer) int cs; hb_glyph_info_t *info = buffer->info; -#line 181 "hb-ot-shape-complex-khmer-machine.hh" +#line 251 "hb-ot-shape-complex-khmer-machine.hh" { cs = khmer_syllable_machine_start; ts = 0; @@ -185,7 +255,7 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 95 "hb-ot-shape-complex-khmer-machine.rl" +#line 101 "hb-ot-shape-complex-khmer-machine.rl" p = 0; @@ -194,7 +264,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int last = 0; unsigned int syllable_serial = 1; -#line 198 "hb-ot-shape-complex-khmer-machine.hh" +#line 268 "hb-ot-shape-complex-khmer-machine.hh" { int _slen; int _trans; @@ -204,11 +274,11 @@ find_syllables (hb_buffer_t *buffer) goto _test_eof; _resume: switch ( _khmer_syllable_machine_from_state_actions[cs] ) { - case 5: + case 7: #line 1 "NONE" {ts = p;} break; -#line 212 "hb-ot-shape-complex-khmer-machine.hh" +#line 282 "hb-ot-shape-complex-khmer-machine.hh" } _keys = _khmer_syllable_machine_trans_keys + (cs<<1); @@ -231,47 +301,63 @@ _eof_trans: {te = p+1;} break; case 8: -#line 68 "hb-ot-shape-complex-khmer-machine.rl" - {te = p+1;{ found_syllable (consonant_syllable); }} - break; - case 10: -#line 69 "hb-ot-shape-complex-khmer-machine.rl" - {te = p+1;{ found_syllable (broken_cluster); }} - break; - case 6: -#line 70 "hb-ot-shape-complex-khmer-machine.rl" +#line 76 "hb-ot-shape-complex-khmer-machine.rl" {te = p+1;{ found_syllable (non_khmer_cluster); }} break; - case 7: -#line 68 "hb-ot-shape-complex-khmer-machine.rl" + case 10: +#line 74 "hb-ot-shape-complex-khmer-machine.rl" {te = p;p--;{ found_syllable (consonant_syllable); }} break; - case 9: -#line 69 "hb-ot-shape-complex-khmer-machine.rl" + case 12: +#line 75 "hb-ot-shape-complex-khmer-machine.rl" {te = p;p--;{ found_syllable (broken_cluster); }} break; case 11: -#line 70 "hb-ot-shape-complex-khmer-machine.rl" +#line 76 "hb-ot-shape-complex-khmer-machine.rl" {te = p;p--;{ found_syllable (non_khmer_cluster); }} break; case 1: -#line 68 "hb-ot-shape-complex-khmer-machine.rl" +#line 74 "hb-ot-shape-complex-khmer-machine.rl" {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} break; - case 3: -#line 69 "hb-ot-shape-complex-khmer-machine.rl" + case 5: +#line 75 "hb-ot-shape-complex-khmer-machine.rl" {{p = ((te))-1;}{ found_syllable (broken_cluster); }} break; -#line 266 "hb-ot-shape-complex-khmer-machine.hh" + case 3: +#line 1 "NONE" + { switch( act ) { + case 2: + {{p = ((te))-1;} found_syllable (broken_cluster); } + break; + case 3: + {{p = ((te))-1;} found_syllable (non_khmer_cluster); } + break; + } + } + break; + case 4: +#line 1 "NONE" + {te = p+1;} +#line 75 "hb-ot-shape-complex-khmer-machine.rl" + {act = 2;} + break; + case 9: +#line 1 "NONE" + {te = p+1;} +#line 76 "hb-ot-shape-complex-khmer-machine.rl" + {act = 3;} + break; +#line 352 "hb-ot-shape-complex-khmer-machine.hh" } _again: switch ( _khmer_syllable_machine_to_state_actions[cs] ) { - case 4: + case 6: #line 1 "NONE" {ts = 0;} break; -#line 275 "hb-ot-shape-complex-khmer-machine.hh" +#line 361 "hb-ot-shape-complex-khmer-machine.hh" } if ( ++p != pe ) @@ -287,7 +373,7 @@ _again: } -#line 104 "hb-ot-shape-complex-khmer-machine.rl" +#line 110 "hb-ot-shape-complex-khmer-machine.rl" } diff --git a/src/hb-ot-shape-complex-khmer-machine.rl b/src/hb-ot-shape-complex-khmer-machine.rl index 7c7951629..eb9f69886 100644 --- a/src/hb-ot-shape-complex-khmer-machine.rl +++ b/src/hb-ot-shape-complex-khmer-machine.rl @@ -40,28 +40,34 @@ # Same order as enum khmer_category_t. Not sure how to avoid duplication. C = 1; V = 2; -N = 3; ZWNJ = 5; ZWJ = 6; -M = 7; -SM = 8; PLACEHOLDER = 11; DOTTEDCIRCLE = 12; -RS = 13; -Coeng = 14; -Ra = 16; +Coeng= 14; +Ra = 16; +Robatic = 20; +Xgroup = 21; +Ygroup = 22; +VAbv = 26; +VBlw = 27; +VPre = 28; +VPst = 29; -c = (C | Ra | V); # is_consonant -n = ((ZWNJ?.RS)? (N.N?)?); # is_consonant_modifier -z = ZWJ|ZWNJ; # is_joiner +c = (C | Ra | V); +cn = c.((ZWJ|ZWNJ)?.Robatic)?; +joiner = (ZWJ | ZWNJ); +xgroup = (joiner*.Xgroup)*; +ygroup = Ygroup*; -cn = c.n?; -matra_group = z?.M.N?; -syllable_tail = (SM.SM?)?; +# This grammar was experimentally extracted from what Uniscribe allows. + +matra_group = VPre? xgroup VBlw? xgroup (joiner?.VAbv)? xgroup VPst?; +syllable_tail = xgroup matra_group xgroup (Coeng.c)? ygroup; -broken_cluster = n? (Coeng.cn)* matra_group* (Coeng.cn)? syllable_tail; -consonant_syllable = (c|PLACEHOLDER|DOTTEDCIRCLE) broken_cluster; +broken_cluster = (Coeng.cn)* syllable_tail; +consonant_syllable = (cn|PLACEHOLDER|DOTTEDCIRCLE) broken_cluster; other = any; main := |* diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index d46f0b3a0..9c766be1c 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -241,7 +241,6 @@ setup_masks_khmer (const hb_ot_shape_plan_t *plan HB_UNUSED, hb_font_t *font HB_UNUSED) { HB_BUFFER_ALLOCATE_VAR (buffer, khmer_category); - HB_BUFFER_ALLOCATE_VAR (buffer, khmer_position); /* We cannot setup masks here. We save information about characters * and setup masks later on in a pause-callback. */ @@ -330,7 +329,7 @@ reorder_consonant_syllable (const hb_ot_shape_plan_t *plan, } /* Reorder left matra piece. */ - else if (info[i].khmer_position() == POS_PRE_M) + else if (info[i].khmer_category() == OT_VPre) { /* Move to the start. */ buffer->merge_clusters (start, i + 1); @@ -432,7 +431,6 @@ reorder (const hb_ot_shape_plan_t *plan, initial_reordering_syllable (plan, font->face, buffer, start, end); HB_BUFFER_DEALLOCATE_VAR (buffer, khmer_category); - HB_BUFFER_DEALLOCATE_VAR (buffer, khmer_position); } static void diff --git a/src/hb-ot-shape-complex-khmer.hh b/src/hb-ot-shape-complex-khmer.hh index c86e7aad6..4ee0b8383 100644 --- a/src/hb-ot-shape-complex-khmer.hh +++ b/src/hb-ot-shape-complex-khmer.hh @@ -34,30 +34,22 @@ /* buffer var allocations */ #define khmer_category() indic_category() /* khmer_category_t */ -#define khmer_position() indic_position() /* khmer_position_t */ +#define khmer_position() indic_position() /* indic_position_t */ -typedef indic_category_t khmer_category_t; -typedef indic_position_t khmer_position_t; - - -static inline khmer_position_t -matra_position_khmer (khmer_position_t side) +/* Note: This enum is duplicated in the -machine.rl source file. + * Not sure how to avoid duplication. */ +enum khmer_category_t { - switch ((int) side) - { - case POS_PRE_C: - return POS_PRE_M; + OT_Robatic = 20, + OT_Xgroup = 21, + OT_Ygroup = 22, - case POS_POST_C: - case POS_ABOVE_C: - case POS_BELOW_C: - return POS_AFTER_POST; - - default: - return side; - }; -} + OT_VAbv = 26, + OT_VBlw = 27, + OT_VPre = 28, + OT_VPst = 29, +}; static inline void set_khmer_properties (hb_glyph_info_t &info) @@ -65,47 +57,58 @@ set_khmer_properties (hb_glyph_info_t &info) hb_codepoint_t u = info.codepoint; unsigned int type = hb_indic_get_categories (u); khmer_category_t cat = (khmer_category_t) (type & 0x7Fu); - khmer_position_t pos = (khmer_position_t) (type >> 8); + indic_position_t pos = (indic_position_t) (type >> 8); /* * Re-assign category + * + * These categories are experimentally extracted from what Uniscribe allows. */ - - if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */ - else if (unlikely (hb_in_range (u, 0x17CDu, 0x17D1u) || - u == 0x17CBu || u == 0x17D3u || u == 0x17DDu)) /* Khmer Various signs */ + switch (u) { - /* These can occur mid-syllable (eg. before matras), even though Unicode marks them as Syllable_Modifier. - * https://github.com/roozbehp/unicode-data/issues/5 */ - cat = OT_M; - pos = POS_ABOVE_C; - } - else if (unlikely (hb_in_range (u, 0x2010u, 0x2011u))) cat = OT_PLACEHOLDER; - else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE; + case 0x179Au: + cat = (khmer_category_t) OT_Ra; + break; + case 0x17CCu: + case 0x17C9u: + case 0x17CAu: + cat = OT_Robatic; + break; + + case 0x17C6u: + case 0x17CBu: + case 0x17CDu: + case 0x17CEu: + case 0x17CFu: + case 0x17D0u: + case 0x17D1u: + cat = OT_Xgroup; + break; + + case 0x17C7u: + case 0x17C8u: + case 0x17DDu: + case 0x17D3u: /* Just guessing. Uniscribe doesn't categorize it. */ + cat = OT_Ygroup; + break; + } /* * Re-assign position. */ - - if ((FLAG_UNSAFE (cat) & CONSONANT_FLAGS)) - { - pos = POS_BASE_C; - if (u == 0x179Au) - cat = OT_Ra; - } - else if (cat == OT_M) - { - pos = matra_position_khmer (pos); - } - else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_A) | FLAG (OT_Symbol)))) - { - pos = POS_SMVD; - } + if (cat == (khmer_category_t) OT_M) + switch ((int) pos) + { + case POS_PRE_C: cat = OT_VPre; break; + case POS_BELOW_C: cat = OT_VBlw; break; + case POS_ABOVE_C: cat = OT_VAbv; break; + case POS_POST_C: cat = OT_VPst; break; + default: assert (0); + }; info.khmer_category() = cat; - info.khmer_position() = pos; } From ab4c37f73a7d4fcf48584cda3fff94e98a672086 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 1 Oct 2018 19:35:48 +0200 Subject: [PATCH 03/30] [khmer] Add mark-ordering tests Fixes https://github.com/harfbuzz/harfbuzz/issues/667 --- test/shaping/data/in-house/Makefile.sources | 2 ++ ...031119874ae9ff1dd65383a335e361c0962220.ttf | Bin 0 -> 2564 bytes .../in-house/tests/khmer-mark-order.tests | 25 ++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 test/shaping/data/in-house/fonts/b6031119874ae9ff1dd65383a335e361c0962220.ttf create mode 100644 test/shaping/data/in-house/tests/khmer-mark-order.tests diff --git a/test/shaping/data/in-house/Makefile.sources b/test/shaping/data/in-house/Makefile.sources index c0b85f2f1..e5cf77fd3 100644 --- a/test/shaping/data/in-house/Makefile.sources +++ b/test/shaping/data/in-house/Makefile.sources @@ -26,6 +26,8 @@ TESTS = \ tests/indic-script-extensions.tests \ tests/indic-special-cases.tests \ tests/indic-syllable.tests \ + tests/khmer-mark-order.tests \ + tests/khmer-misc.tests \ tests/language-tags.tests \ tests/ligature-id.tests \ tests/mark-attachment.tests \ diff --git a/test/shaping/data/in-house/fonts/b6031119874ae9ff1dd65383a335e361c0962220.ttf b/test/shaping/data/in-house/fonts/b6031119874ae9ff1dd65383a335e361c0962220.ttf new file mode 100644 index 0000000000000000000000000000000000000000..a9dc202b561924775df09f70494525352287b423 GIT binary patch literal 2564 zcmb7GSxi({82-<>voV99z%Z1}5g4!*5M}{UKxI@4Mxc;V#nw8&jF`?a2xvu3Gi-Zh!GKkpVWevo8`DI{4TVgOJ~Y9NrZk3(b5ncnbVABKiJ6Fwk#nKm7@j@+HR~ zfWmy(_$}GRgq)Ozg2c4$2Ag&J`_ zaP6wIz><=mH#QbHd}L{%#hM3Jn!?i)6MvPu(#^($OXajBvd z+bt8RGL}5293vZLFjmyVXx#? zXRfX-D=dUd;zTkvnV0;PjHtb@7@mpGyyJhry863hlCT#_nzEb9NKyKdzfmcfup4Gd zq1&K>=S3%m4Vg;#ZOFSrTg7t>)ZzLDneMr<4P1K z7uzj>!NWL0t!=F`b`cHAnY*z0K;B{muyA14XYR(Ts$w$c_xbz;w7t|K9}x+lv|C4F;m6jwMnbO7NHe|IPcoQooVWTRs z2KA;)oCmesI2<|Fv@|Qau&D&BS|5VlR#f%}N@w2%EfwdCn~zRVj6R}Cx+zF35q_~v zwZv@ZPrqDyHog8fY9D9Q?}aUo>5td_x29b)Tg)pAFF-Wukw_k(o$??RC};TuCsNT* zC~nFZPTr?PhzK=2h`B0w0ga&|aTS~S&a^ApWL|L}K1Obk7sNQ93wc~_h0kV;BxTdrmh6;gOt2LP;C&4*6u8Ld%&BD%eeX{Ue zaHb4e42^W0alGL;@A%m9spEoU(lv!Wrh9Z>u`V8o_r*8ITjI^}jq%2x8y;8*0-~9z zhqD+`!0$lUctM4bG+t5~9nyJ)*3ogDH&7+^N3$`~0Nv4f6Ri+C$xl%lqA?n#-Lwm{ zqgb08HLj)_aLt&FLLa6eq!t>)nX3f19-1&{=bYDwDg|i-mcz6UV?Qk0;5~}&q%I1; zo2@n@OGLHm#JG$0B2oZ8ZrE3;-x}m?$JdNEY&OEI|GakvvM=4sAfHh=LRCfWYK;=aq`&;wt?P# z5lZU~KOf;&SJ$dDh-tx@JF0pJ@B&rkU(OAbs?Me1ehE<`PoWG?@hBQ`uT4m+S*OBI zAS%BFjL?i2jF;ast&7AJ8JmxlxS~wr7vzfap*pTcX2V>p3~>4Q55ntWEw5Orb>KG( zUg{mUATpzBNd5y Date: Mon, 1 Oct 2018 20:05:00 +0200 Subject: [PATCH 04/30] [indic] Remove Consonant_Medial from grammar and code The only Indic CM is U+0A75 GURMUKHI SIGN YAKASH, which Uniscribe doesn't treat specially, and font designers design for that. So, do the same. --- src/hb-ot-shape-complex-indic-machine.hh | 1246 ++++++++++------------ src/hb-ot-shape-complex-indic-machine.rl | 10 +- src/hb-ot-shape-complex-indic.cc | 2 +- src/hb-ot-shape-complex-indic.hh | 6 +- 4 files changed, 590 insertions(+), 674 deletions(-) diff --git a/src/hb-ot-shape-complex-indic-machine.hh b/src/hb-ot-shape-complex-indic-machine.hh index 351d5970c..6a19bfb3e 100644 --- a/src/hb-ot-shape-complex-indic-machine.hh +++ b/src/hb-ot-shape-complex-indic-machine.hh @@ -51,40 +51,40 @@ static const unsigned char _indic_syllable_machine_trans_keys[] = { 5u, 7u, 7u, 7u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 8u, 4u, 13u, 4u, 13u, - 5u, 8u, 8u, 8u, 1u, 19u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, - 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, - 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 10u, 5u, 10u, + 5u, 8u, 8u, 8u, 1u, 19u, 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, 3u, 13u, + 3u, 10u, 4u, 10u, 1u, 16u, 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, 3u, 13u, + 3u, 10u, 4u, 10u, 1u, 16u, 3u, 13u, 3u, 10u, 4u, 10u, 5u, 10u, 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 3u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, - 3u, 10u, 4u, 10u, 4u, 10u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, - 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, - 3u, 17u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, - 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, - 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 10u, 5u, 10u, 5u, 10u, 10u, 10u, - 10u, 10u, 10u, 10u, 5u, 10u, 3u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, + 3u, 10u, 4u, 10u, 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 10u, + 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, + 1u, 16u, 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 10u, 3u, 13u, + 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, + 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, + 3u, 13u, 3u, 10u, 4u, 10u, 5u, 10u, 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, + 10u, 10u, 5u, 10u, 3u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, + 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 3u, 10u, + 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, + 1u, 16u, 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 10u, 3u, 13u, + 1u, 16u, 1u, 16u, 1u, 16u, 4u, 8u, 3u, 10u, 3u, 10u, 4u, 10u, 1u, 16u, + 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, + 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, 3u, 13u, 3u, 10u, 4u, 10u, 5u, 10u, + 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 3u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, - 4u, 10u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, - 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 8u, 3u, 17u, 3u, 17u, - 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, - 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, - 4u, 17u, 5u, 10u, 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, - 3u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, - 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 4u, 10u, 3u, 17u, 3u, 17u, - 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, - 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, - 1u, 16u, 1u, 16u, 4u, 13u, 3u, 17u, 4u, 8u, 3u, 17u, 3u, 17u, 4u, 17u, - 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, - 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, - 5u, 10u, 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 3u, 10u, + 5u, 10u, 3u, 10u, 4u, 10u, 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, + 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 10u, 3u, 13u, 1u, 16u, + 1u, 16u, 1u, 16u, 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 13u, + 3u, 10u, 4u, 8u, 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, 3u, 13u, 3u, 10u, + 4u, 10u, 1u, 16u, 3u, 13u, 3u, 10u, 4u, 10u, 1u, 16u, 3u, 13u, 3u, 10u, + 4u, 10u, 1u, 16u, 3u, 13u, 3u, 10u, 4u, 10u, 5u, 10u, 5u, 10u, 5u, 10u, + 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 3u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 5u, 10u, 3u, 10u, - 4u, 10u, 5u, 10u, 3u, 10u, 4u, 10u, 4u, 10u, 3u, 17u, 3u, 17u, 1u, 16u, - 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, - 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, - 1u, 16u, 3u, 17u, 1u, 17u, 3u, 17u, 1u, 17u, 4u, 13u, 5u, 10u, 10u, 10u, - 10u, 10u, 10u, 10u, 5u, 10u, 1u, 16u, 3u, 10u, 5u, 10u, 5u, 10u, 10u, 10u, - 10u, 10u, 10u, 10u, 5u, 10u, 1u, 16u, 0 + 4u, 10u, 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 10u, 3u, 13u, + 1u, 16u, 1u, 16u, 1u, 16u, 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, + 3u, 10u, 3u, 13u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 10u, 1u, 16u, 3u, 13u, + 1u, 16u, 4u, 13u, 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 1u, 16u, + 3u, 10u, 5u, 10u, 5u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 5u, 10u, 1u, 16u, + 0 }; static const char _indic_syllable_machine_key_spans[] = { @@ -105,40 +105,39 @@ static const char _indic_syllable_machine_key_spans[] = { 3, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 10, 5, 10, 5, 10, 5, 10, 5, 10, 10, - 4, 1, 19, 15, 15, 14, 16, 15, - 15, 14, 16, 15, 15, 14, 16, 15, - 15, 14, 16, 15, 15, 14, 6, 6, + 4, 1, 19, 11, 8, 7, 16, 11, + 8, 7, 16, 11, 8, 7, 16, 11, + 8, 7, 16, 11, 8, 7, 6, 6, 6, 1, 1, 1, 6, 8, 6, 8, 7, 6, 8, 7, 6, 8, 7, 6, - 8, 7, 7, 15, 15, 16, 16, 16, - 15, 15, 16, 16, 16, 15, 15, 16, - 16, 16, 15, 15, 16, 16, 16, 15, - 15, 15, 15, 14, 16, 15, 15, 14, - 16, 15, 15, 14, 16, 15, 15, 14, - 16, 15, 15, 14, 6, 6, 6, 1, - 1, 1, 6, 8, 6, 8, 7, 6, + 8, 7, 8, 11, 16, 16, 16, 8, + 11, 16, 16, 16, 8, 11, 16, 16, + 16, 8, 11, 16, 16, 16, 8, 11, + 11, 8, 7, 16, 11, 8, 7, 16, + 11, 8, 7, 16, 11, 8, 7, 16, + 11, 8, 7, 6, 6, 6, 1, 1, + 1, 6, 8, 6, 8, 7, 6, 8, + 7, 6, 8, 7, 6, 8, 7, 8, + 11, 16, 16, 16, 8, 11, 16, 16, + 16, 8, 11, 16, 16, 16, 8, 11, + 16, 16, 16, 5, 8, 8, 7, 16, + 11, 8, 7, 16, 11, 8, 7, 16, + 11, 8, 7, 16, 11, 8, 7, 6, + 6, 6, 1, 1, 1, 6, 8, 6, 8, 7, 6, 8, 7, 6, 8, 7, - 7, 15, 15, 16, 16, 16, 15, 15, - 16, 16, 16, 15, 15, 16, 16, 16, - 15, 15, 16, 16, 16, 5, 15, 15, - 14, 16, 15, 15, 14, 16, 15, 15, - 14, 16, 15, 15, 14, 16, 15, 15, - 14, 6, 6, 6, 1, 1, 1, 6, - 8, 6, 8, 7, 6, 8, 7, 6, - 8, 7, 6, 8, 7, 7, 15, 15, - 16, 16, 16, 15, 15, 16, 16, 16, - 15, 15, 16, 16, 16, 15, 15, 16, - 16, 16, 10, 15, 5, 15, 15, 14, - 16, 15, 15, 14, 16, 15, 15, 14, - 16, 15, 15, 14, 16, 15, 15, 14, - 6, 6, 6, 1, 1, 1, 6, 8, + 6, 8, 7, 8, 11, 16, 16, 16, + 8, 11, 16, 16, 16, 8, 11, 16, + 16, 16, 8, 11, 16, 16, 16, 10, + 8, 5, 11, 8, 7, 16, 11, 8, + 7, 16, 11, 8, 7, 16, 11, 8, + 7, 16, 11, 8, 7, 6, 6, 6, + 1, 1, 1, 6, 8, 6, 8, 7, 6, 8, 7, 6, 8, 7, 6, 8, - 7, 6, 8, 7, 7, 15, 15, 16, - 16, 16, 15, 15, 16, 16, 16, 15, - 15, 16, 16, 16, 15, 15, 16, 16, - 16, 15, 17, 15, 17, 10, 6, 1, - 1, 1, 6, 16, 8, 6, 6, 1, - 1, 1, 6, 16 + 7, 8, 11, 16, 16, 16, 8, 11, + 16, 16, 16, 8, 11, 16, 16, 16, + 8, 11, 16, 16, 16, 8, 16, 11, + 16, 10, 6, 1, 1, 1, 6, 16, + 8, 6, 6, 1, 1, 1, 6, 16 }; static const short _indic_syllable_machine_index_offsets[] = { @@ -159,40 +158,39 @@ static const short _indic_syllable_machine_index_offsets[] = { 528, 532, 534, 540, 542, 544, 550, 552, 554, 560, 562, 564, 570, 572, 574, 585, 591, 602, 608, 619, 625, 636, 642, 653, - 664, 669, 671, 691, 707, 723, 738, 755, - 771, 787, 802, 819, 835, 851, 866, 883, - 899, 915, 930, 947, 963, 979, 994, 1001, - 1008, 1015, 1017, 1019, 1021, 1028, 1037, 1044, - 1053, 1061, 1068, 1077, 1085, 1092, 1101, 1109, - 1116, 1125, 1133, 1141, 1157, 1173, 1190, 1207, - 1224, 1240, 1256, 1273, 1290, 1307, 1323, 1339, - 1356, 1373, 1390, 1406, 1422, 1439, 1456, 1473, - 1489, 1505, 1521, 1537, 1552, 1569, 1585, 1601, - 1616, 1633, 1649, 1665, 1680, 1697, 1713, 1729, - 1744, 1761, 1777, 1793, 1808, 1815, 1822, 1829, - 1831, 1833, 1835, 1842, 1851, 1858, 1867, 1875, - 1882, 1891, 1899, 1906, 1915, 1923, 1930, 1939, - 1947, 1955, 1971, 1987, 2004, 2021, 2038, 2054, - 2070, 2087, 2104, 2121, 2137, 2153, 2170, 2187, - 2204, 2220, 2236, 2253, 2270, 2287, 2293, 2309, - 2325, 2340, 2357, 2373, 2389, 2404, 2421, 2437, - 2453, 2468, 2485, 2501, 2517, 2532, 2549, 2565, - 2581, 2596, 2603, 2610, 2617, 2619, 2621, 2623, - 2630, 2639, 2646, 2655, 2663, 2670, 2679, 2687, - 2694, 2703, 2711, 2718, 2727, 2735, 2743, 2759, - 2775, 2792, 2809, 2826, 2842, 2858, 2875, 2892, - 2909, 2925, 2941, 2958, 2975, 2992, 3008, 3024, - 3041, 3058, 3075, 3086, 3102, 3108, 3124, 3140, - 3155, 3172, 3188, 3204, 3219, 3236, 3252, 3268, - 3283, 3300, 3316, 3332, 3347, 3364, 3380, 3396, - 3411, 3418, 3425, 3432, 3434, 3436, 3438, 3445, - 3454, 3461, 3470, 3478, 3485, 3494, 3502, 3509, - 3518, 3526, 3533, 3542, 3550, 3558, 3574, 3590, - 3607, 3624, 3641, 3657, 3673, 3690, 3707, 3724, - 3740, 3756, 3773, 3790, 3807, 3823, 3839, 3856, - 3873, 3890, 3906, 3924, 3940, 3958, 3969, 3976, - 3978, 3980, 3982, 3989, 4006, 4015, 4022, 4029, - 4031, 4033, 4035, 4042 + 664, 669, 671, 691, 703, 712, 720, 737, + 749, 758, 766, 783, 795, 804, 812, 829, + 841, 850, 858, 875, 887, 896, 904, 911, + 918, 925, 927, 929, 931, 938, 947, 954, + 963, 971, 978, 987, 995, 1002, 1011, 1019, + 1026, 1035, 1043, 1052, 1064, 1081, 1098, 1115, + 1124, 1136, 1153, 1170, 1187, 1196, 1208, 1225, + 1242, 1259, 1268, 1280, 1297, 1314, 1331, 1340, + 1352, 1364, 1373, 1381, 1398, 1410, 1419, 1427, + 1444, 1456, 1465, 1473, 1490, 1502, 1511, 1519, + 1536, 1548, 1557, 1565, 1572, 1579, 1586, 1588, + 1590, 1592, 1599, 1608, 1615, 1624, 1632, 1639, + 1648, 1656, 1663, 1672, 1680, 1687, 1696, 1704, + 1713, 1725, 1742, 1759, 1776, 1785, 1797, 1814, + 1831, 1848, 1857, 1869, 1886, 1903, 1920, 1929, + 1941, 1958, 1975, 1992, 1998, 2007, 2016, 2024, + 2041, 2053, 2062, 2070, 2087, 2099, 2108, 2116, + 2133, 2145, 2154, 2162, 2179, 2191, 2200, 2208, + 2215, 2222, 2229, 2231, 2233, 2235, 2242, 2251, + 2258, 2267, 2275, 2282, 2291, 2299, 2306, 2315, + 2323, 2330, 2339, 2347, 2356, 2368, 2385, 2402, + 2419, 2428, 2440, 2457, 2474, 2491, 2500, 2512, + 2529, 2546, 2563, 2572, 2584, 2601, 2618, 2635, + 2646, 2655, 2661, 2673, 2682, 2690, 2707, 2719, + 2728, 2736, 2753, 2765, 2774, 2782, 2799, 2811, + 2820, 2828, 2845, 2857, 2866, 2874, 2881, 2888, + 2895, 2897, 2899, 2901, 2908, 2917, 2924, 2933, + 2941, 2948, 2957, 2965, 2972, 2981, 2989, 2996, + 3005, 3013, 3022, 3034, 3051, 3068, 3085, 3094, + 3106, 3123, 3140, 3157, 3166, 3178, 3195, 3212, + 3229, 3238, 3250, 3267, 3284, 3301, 3310, 3327, + 3339, 3356, 3367, 3374, 3376, 3378, 3380, 3387, + 3404, 3413, 3420, 3427, 3429, 3431, 3433, 3440 }; static const short _indic_syllable_machine_indicies[] = { @@ -281,485 +279,410 @@ static const short _indic_syllable_machine_indicies[] = { 76, 73, 72, 72, 72, 72, 144, 72, 78, 78, 76, 1, 0, 146, 145, 148, 149, 150, 151, 152, 153, 76, 73, 147, - 154, 155, 155, 144, 147, 156, 157, 158, - 159, 160, 147, 162, 163, 164, 165, 4, - 1, 161, 166, 161, 161, 35, 161, 161, - 161, 167, 161, 168, 163, 169, 169, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 163, 169, 169, 4, 1, - 161, 166, 161, 161, 161, 161, 161, 161, - 167, 161, 170, 161, 161, 161, 17, 171, - 161, 1, 161, 166, 161, 161, 161, 161, - 161, 170, 161, 172, 173, 174, 175, 4, - 1, 161, 166, 161, 161, 33, 161, 161, - 161, 167, 161, 176, 173, 177, 177, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 173, 177, 177, 4, 1, - 161, 166, 161, 161, 161, 161, 161, 161, - 167, 161, 178, 161, 161, 161, 17, 179, - 161, 1, 161, 166, 161, 161, 161, 161, - 161, 178, 161, 180, 181, 182, 183, 4, - 1, 161, 166, 161, 161, 31, 161, 161, - 161, 167, 161, 184, 181, 185, 185, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 181, 185, 185, 4, 1, - 161, 166, 161, 161, 161, 161, 161, 161, - 167, 161, 186, 161, 161, 161, 17, 187, - 161, 1, 161, 166, 161, 161, 161, 161, - 161, 186, 161, 188, 189, 190, 191, 4, - 1, 161, 166, 161, 161, 29, 161, 161, - 161, 167, 161, 192, 189, 193, 193, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 189, 193, 193, 4, 1, - 161, 166, 161, 161, 161, 161, 161, 161, - 167, 161, 194, 161, 161, 161, 17, 195, - 161, 1, 161, 166, 161, 161, 161, 161, - 161, 194, 161, 196, 197, 198, 199, 4, - 1, 161, 166, 161, 161, 27, 161, 161, - 161, 167, 161, 200, 197, 201, 201, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 197, 201, 201, 4, 1, - 161, 166, 161, 161, 161, 161, 161, 161, - 167, 161, 17, 202, 161, 1, 161, 166, - 161, 203, 203, 161, 1, 161, 166, 161, - 204, 161, 161, 205, 161, 166, 161, 166, - 161, 206, 161, 207, 161, 204, 161, 161, - 161, 161, 166, 161, 17, 161, 203, 203, - 161, 1, 161, 166, 161, 203, 202, 161, - 1, 161, 166, 161, 208, 26, 209, 210, - 7, 1, 161, 166, 161, 26, 209, 210, - 7, 1, 161, 166, 161, 209, 209, 7, - 1, 161, 166, 161, 211, 23, 212, 213, - 10, 1, 161, 166, 161, 23, 212, 213, - 10, 1, 161, 166, 161, 212, 212, 10, - 1, 161, 166, 161, 214, 20, 215, 216, - 13, 1, 161, 166, 161, 20, 215, 216, - 13, 1, 161, 166, 161, 215, 215, 13, - 1, 161, 166, 161, 217, 17, 203, 218, - 161, 1, 161, 166, 161, 17, 203, 218, - 161, 1, 161, 166, 161, 197, 201, 201, - 4, 1, 161, 166, 161, 196, 197, 201, - 201, 4, 1, 161, 166, 161, 161, 161, - 161, 161, 161, 167, 161, 196, 197, 198, - 201, 4, 1, 161, 166, 161, 161, 27, - 161, 161, 161, 167, 161, 194, 161, 219, - 161, 203, 203, 161, 1, 161, 166, 161, - 161, 161, 161, 161, 194, 161, 194, 161, - 161, 161, 203, 203, 161, 1, 161, 166, - 161, 161, 161, 161, 161, 194, 161, 194, - 161, 161, 161, 203, 195, 161, 1, 161, - 166, 161, 161, 161, 161, 161, 194, 161, - 188, 189, 193, 193, 4, 1, 161, 166, - 161, 161, 161, 161, 161, 161, 167, 161, - 188, 189, 190, 193, 4, 1, 161, 166, - 161, 161, 29, 161, 161, 161, 167, 161, - 186, 161, 220, 161, 203, 203, 161, 1, - 161, 166, 161, 161, 161, 161, 161, 186, - 161, 186, 161, 161, 161, 203, 203, 161, - 1, 161, 166, 161, 161, 161, 161, 161, - 186, 161, 186, 161, 161, 161, 203, 187, - 161, 1, 161, 166, 161, 161, 161, 161, - 161, 186, 161, 180, 181, 185, 185, 4, - 1, 161, 166, 161, 161, 161, 161, 161, - 161, 167, 161, 180, 181, 182, 185, 4, - 1, 161, 166, 161, 161, 31, 161, 161, - 161, 167, 161, 178, 161, 221, 161, 203, - 203, 161, 1, 161, 166, 161, 161, 161, - 161, 161, 178, 161, 178, 161, 161, 161, - 203, 203, 161, 1, 161, 166, 161, 161, - 161, 161, 161, 178, 161, 178, 161, 161, - 161, 203, 179, 161, 1, 161, 166, 161, - 161, 161, 161, 161, 178, 161, 172, 173, - 177, 177, 4, 1, 161, 166, 161, 161, - 161, 161, 161, 161, 167, 161, 172, 173, - 174, 177, 4, 1, 161, 166, 161, 161, - 33, 161, 161, 161, 167, 161, 170, 161, - 222, 161, 203, 203, 161, 1, 161, 166, - 161, 161, 161, 161, 161, 170, 161, 170, - 161, 161, 161, 203, 203, 161, 1, 161, - 166, 161, 161, 161, 161, 161, 170, 161, - 170, 161, 161, 161, 203, 171, 161, 1, - 161, 166, 161, 161, 161, 161, 161, 170, - 161, 162, 163, 169, 169, 4, 1, 161, - 166, 161, 161, 161, 161, 161, 161, 167, - 161, 162, 163, 164, 169, 4, 1, 161, - 166, 161, 161, 35, 161, 161, 161, 167, - 161, 224, 225, 226, 227, 40, 37, 223, - 228, 223, 223, 71, 223, 223, 223, 229, - 223, 230, 225, 231, 227, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 225, 231, 227, 40, 37, 223, 228, - 223, 223, 223, 223, 223, 223, 229, 223, - 232, 223, 223, 223, 53, 233, 223, 37, - 223, 228, 223, 223, 223, 223, 223, 232, - 223, 234, 235, 236, 237, 40, 37, 223, - 228, 223, 223, 69, 223, 223, 223, 229, - 223, 238, 235, 239, 239, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 235, 239, 239, 40, 37, 223, 228, - 223, 223, 223, 223, 223, 223, 229, 223, - 240, 223, 223, 223, 53, 241, 223, 37, - 223, 228, 223, 223, 223, 223, 223, 240, - 223, 242, 243, 244, 245, 40, 37, 223, - 228, 223, 223, 67, 223, 223, 223, 229, - 223, 246, 243, 247, 247, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 243, 247, 247, 40, 37, 223, 228, - 223, 223, 223, 223, 223, 223, 229, 223, - 248, 223, 223, 223, 53, 249, 223, 37, - 223, 228, 223, 223, 223, 223, 223, 248, - 223, 250, 251, 252, 253, 40, 37, 223, - 228, 223, 223, 65, 223, 223, 223, 229, - 223, 254, 251, 255, 255, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 251, 255, 255, 40, 37, 223, 228, - 223, 223, 223, 223, 223, 223, 229, 223, - 256, 223, 223, 223, 53, 257, 223, 37, - 223, 228, 223, 223, 223, 223, 223, 256, - 223, 258, 259, 260, 261, 40, 37, 223, - 228, 223, 223, 63, 223, 223, 223, 229, - 223, 262, 259, 263, 263, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 259, 263, 263, 40, 37, 223, 228, - 223, 223, 223, 223, 223, 223, 229, 223, - 53, 264, 223, 37, 223, 228, 223, 265, - 265, 223, 37, 223, 228, 223, 266, 223, - 223, 267, 223, 228, 223, 228, 223, 268, - 223, 269, 223, 266, 223, 223, 223, 223, - 228, 223, 53, 223, 265, 265, 223, 37, - 223, 228, 223, 265, 264, 223, 37, 223, - 228, 223, 270, 62, 271, 272, 43, 37, - 223, 228, 223, 62, 271, 272, 43, 37, - 223, 228, 223, 271, 271, 43, 37, 223, - 228, 223, 273, 59, 274, 275, 46, 37, - 223, 228, 223, 59, 274, 275, 46, 37, - 223, 228, 223, 274, 274, 46, 37, 223, - 228, 223, 276, 56, 277, 278, 49, 37, - 223, 228, 223, 56, 277, 278, 49, 37, - 223, 228, 223, 277, 277, 49, 37, 223, - 228, 223, 279, 53, 265, 280, 223, 37, - 223, 228, 223, 53, 265, 280, 223, 37, - 223, 228, 223, 259, 263, 263, 40, 37, - 223, 228, 223, 258, 259, 263, 263, 40, - 37, 223, 228, 223, 223, 223, 223, 223, - 223, 229, 223, 258, 259, 260, 263, 40, - 37, 223, 228, 223, 223, 63, 223, 223, - 223, 229, 223, 256, 223, 281, 223, 265, - 265, 223, 37, 223, 228, 223, 223, 223, - 223, 223, 256, 223, 256, 223, 223, 223, - 265, 265, 223, 37, 223, 228, 223, 223, - 223, 223, 223, 256, 223, 256, 223, 223, - 223, 265, 257, 223, 37, 223, 228, 223, - 223, 223, 223, 223, 256, 223, 250, 251, - 255, 255, 40, 37, 223, 228, 223, 223, - 223, 223, 223, 223, 229, 223, 250, 251, - 252, 255, 40, 37, 223, 228, 223, 223, - 65, 223, 223, 223, 229, 223, 248, 223, - 282, 223, 265, 265, 223, 37, 223, 228, - 223, 223, 223, 223, 223, 248, 223, 248, - 223, 223, 223, 265, 265, 223, 37, 223, - 228, 223, 223, 223, 223, 223, 248, 223, - 248, 223, 223, 223, 265, 249, 223, 37, - 223, 228, 223, 223, 223, 223, 223, 248, - 223, 242, 243, 247, 247, 40, 37, 223, - 228, 223, 223, 223, 223, 223, 223, 229, - 223, 242, 243, 244, 247, 40, 37, 223, - 228, 223, 223, 67, 223, 223, 223, 229, - 223, 240, 223, 283, 223, 265, 265, 223, - 37, 223, 228, 223, 223, 223, 223, 223, - 240, 223, 240, 223, 223, 223, 265, 265, - 223, 37, 223, 228, 223, 223, 223, 223, - 223, 240, 223, 240, 223, 223, 223, 265, - 241, 223, 37, 223, 228, 223, 223, 223, - 223, 223, 240, 223, 234, 235, 239, 239, - 40, 37, 223, 228, 223, 223, 223, 223, - 223, 223, 229, 223, 234, 235, 236, 239, - 40, 37, 223, 228, 223, 223, 69, 223, - 223, 223, 229, 223, 232, 223, 284, 223, - 265, 265, 223, 37, 223, 228, 223, 223, - 223, 223, 223, 232, 223, 232, 223, 223, - 223, 265, 265, 223, 37, 223, 228, 223, - 223, 223, 223, 223, 232, 223, 232, 223, - 223, 223, 265, 233, 223, 37, 223, 228, - 223, 223, 223, 223, 223, 232, 223, 70, - 39, 39, 40, 37, 223, 224, 225, 231, - 227, 40, 37, 223, 228, 223, 223, 223, - 223, 223, 223, 229, 223, 286, 151, 287, - 287, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 151, 287, 287, - 76, 73, 285, 154, 285, 285, 285, 285, - 285, 285, 158, 285, 288, 285, 285, 285, - 90, 289, 285, 73, 285, 154, 285, 285, - 285, 285, 285, 288, 285, 290, 291, 292, - 293, 76, 73, 285, 154, 285, 285, 106, - 285, 285, 285, 158, 285, 294, 291, 295, - 295, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 291, 295, 295, - 76, 73, 285, 154, 285, 285, 285, 285, - 285, 285, 158, 285, 296, 285, 285, 285, - 90, 297, 285, 73, 285, 154, 285, 285, - 285, 285, 285, 296, 285, 298, 299, 300, - 301, 76, 73, 285, 154, 285, 285, 104, - 285, 285, 285, 158, 285, 302, 299, 303, - 303, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 299, 303, 303, - 76, 73, 285, 154, 285, 285, 285, 285, - 285, 285, 158, 285, 304, 285, 285, 285, - 90, 305, 285, 73, 285, 154, 285, 285, - 285, 285, 285, 304, 285, 306, 307, 308, - 309, 76, 73, 285, 154, 285, 285, 102, - 285, 285, 285, 158, 285, 310, 307, 311, - 311, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 307, 311, 311, - 76, 73, 285, 154, 285, 285, 285, 285, - 285, 285, 158, 285, 312, 285, 285, 285, - 90, 313, 285, 73, 285, 154, 285, 285, - 285, 285, 285, 312, 285, 314, 315, 316, - 317, 76, 73, 285, 154, 285, 285, 100, - 285, 285, 285, 158, 285, 318, 315, 319, - 319, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 315, 319, 319, - 76, 73, 285, 154, 285, 285, 285, 285, - 285, 285, 158, 285, 90, 320, 285, 73, - 285, 154, 285, 321, 321, 285, 73, 285, - 154, 285, 322, 285, 285, 323, 285, 154, - 285, 154, 285, 324, 285, 325, 285, 322, - 285, 285, 285, 285, 154, 285, 90, 285, - 321, 321, 285, 73, 285, 154, 285, 321, - 320, 285, 73, 285, 154, 285, 326, 99, - 327, 328, 80, 73, 285, 154, 285, 99, - 327, 328, 80, 73, 285, 154, 285, 327, - 327, 80, 73, 285, 154, 285, 329, 96, - 330, 331, 83, 73, 285, 154, 285, 96, - 330, 331, 83, 73, 285, 154, 285, 330, - 330, 83, 73, 285, 154, 285, 332, 93, - 333, 334, 86, 73, 285, 154, 285, 93, - 333, 334, 86, 73, 285, 154, 285, 333, - 333, 86, 73, 285, 154, 285, 335, 90, - 321, 336, 285, 73, 285, 154, 285, 90, - 321, 336, 285, 73, 285, 154, 285, 315, - 319, 319, 76, 73, 285, 154, 285, 314, - 315, 319, 319, 76, 73, 285, 154, 285, - 285, 285, 285, 285, 285, 158, 285, 314, - 315, 316, 319, 76, 73, 285, 154, 285, - 285, 100, 285, 285, 285, 158, 285, 312, - 285, 337, 285, 321, 321, 285, 73, 285, - 154, 285, 285, 285, 285, 285, 312, 285, - 312, 285, 285, 285, 321, 321, 285, 73, - 285, 154, 285, 285, 285, 285, 285, 312, - 285, 312, 285, 285, 285, 321, 313, 285, - 73, 285, 154, 285, 285, 285, 285, 285, - 312, 285, 306, 307, 311, 311, 76, 73, - 285, 154, 285, 285, 285, 285, 285, 285, - 158, 285, 306, 307, 308, 311, 76, 73, - 285, 154, 285, 285, 102, 285, 285, 285, - 158, 285, 304, 285, 338, 285, 321, 321, - 285, 73, 285, 154, 285, 285, 285, 285, - 285, 304, 285, 304, 285, 285, 285, 321, - 321, 285, 73, 285, 154, 285, 285, 285, - 285, 285, 304, 285, 304, 285, 285, 285, - 321, 305, 285, 73, 285, 154, 285, 285, - 285, 285, 285, 304, 285, 298, 299, 303, - 303, 76, 73, 285, 154, 285, 285, 285, - 285, 285, 285, 158, 285, 298, 299, 300, - 303, 76, 73, 285, 154, 285, 285, 104, - 285, 285, 285, 158, 285, 296, 285, 339, - 285, 321, 321, 285, 73, 285, 154, 285, - 285, 285, 285, 285, 296, 285, 296, 285, - 285, 285, 321, 321, 285, 73, 285, 154, - 285, 285, 285, 285, 285, 296, 285, 296, - 285, 285, 285, 321, 297, 285, 73, 285, - 154, 285, 285, 285, 285, 285, 296, 285, - 290, 291, 295, 295, 76, 73, 285, 154, - 285, 285, 285, 285, 285, 285, 158, 285, - 290, 291, 292, 295, 76, 73, 285, 154, - 285, 285, 106, 285, 285, 285, 158, 285, - 288, 285, 340, 285, 321, 321, 285, 73, - 285, 154, 285, 285, 285, 285, 285, 288, - 285, 288, 285, 285, 285, 321, 321, 285, - 73, 285, 154, 285, 285, 285, 285, 285, - 288, 285, 288, 285, 285, 285, 321, 289, - 285, 73, 285, 154, 285, 285, 285, 285, - 285, 288, 285, 107, 75, 75, 76, 73, - 341, 341, 341, 341, 144, 341, 150, 151, - 287, 287, 76, 73, 285, 154, 285, 285, - 285, 285, 285, 285, 158, 285, 107, 75, - 75, 76, 73, 341, 343, 344, 345, 346, - 112, 109, 342, 347, 342, 342, 143, 342, - 342, 342, 348, 342, 349, 344, 346, 346, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 344, 346, 346, 112, - 109, 342, 347, 342, 342, 342, 342, 342, - 342, 348, 342, 350, 342, 342, 342, 125, - 351, 342, 109, 342, 347, 342, 342, 342, - 342, 342, 350, 342, 352, 353, 354, 355, - 112, 109, 342, 347, 342, 342, 141, 342, - 342, 342, 348, 342, 356, 353, 357, 357, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 353, 357, 357, 112, - 109, 342, 347, 342, 342, 342, 342, 342, - 342, 348, 342, 358, 342, 342, 342, 125, - 359, 342, 109, 342, 347, 342, 342, 342, - 342, 342, 358, 342, 360, 361, 362, 363, - 112, 109, 342, 347, 342, 342, 139, 342, - 342, 342, 348, 342, 364, 361, 365, 365, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 361, 365, 365, 112, - 109, 342, 347, 342, 342, 342, 342, 342, - 342, 348, 342, 366, 342, 342, 342, 125, - 367, 342, 109, 342, 347, 342, 342, 342, - 342, 342, 366, 342, 368, 369, 370, 371, - 112, 109, 342, 347, 342, 342, 137, 342, - 342, 342, 348, 342, 372, 369, 373, 373, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 369, 373, 373, 112, - 109, 342, 347, 342, 342, 342, 342, 342, - 342, 348, 342, 374, 342, 342, 342, 125, - 375, 342, 109, 342, 347, 342, 342, 342, - 342, 342, 374, 342, 376, 377, 378, 379, - 112, 109, 342, 347, 342, 342, 135, 342, - 342, 342, 348, 342, 380, 377, 381, 381, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 377, 381, 381, 112, - 109, 342, 347, 342, 342, 342, 342, 342, - 342, 348, 342, 125, 382, 342, 109, 342, - 347, 342, 383, 383, 342, 109, 342, 347, - 342, 384, 342, 342, 385, 342, 347, 342, - 347, 342, 386, 342, 387, 342, 384, 342, - 342, 342, 342, 347, 342, 125, 342, 383, - 383, 342, 109, 342, 347, 342, 383, 382, - 342, 109, 342, 347, 342, 388, 134, 389, - 390, 115, 109, 342, 347, 342, 134, 389, - 390, 115, 109, 342, 347, 342, 389, 389, - 115, 109, 342, 347, 342, 391, 131, 392, - 393, 118, 109, 342, 347, 342, 131, 392, - 393, 118, 109, 342, 347, 342, 392, 392, - 118, 109, 342, 347, 342, 394, 128, 395, - 396, 121, 109, 342, 347, 342, 128, 395, - 396, 121, 109, 342, 347, 342, 395, 395, - 121, 109, 342, 347, 342, 397, 125, 383, - 398, 342, 109, 342, 347, 342, 125, 383, - 398, 342, 109, 342, 347, 342, 377, 381, - 381, 112, 109, 342, 347, 342, 376, 377, - 381, 381, 112, 109, 342, 347, 342, 342, - 342, 342, 342, 342, 348, 342, 376, 377, - 378, 381, 112, 109, 342, 347, 342, 342, - 135, 342, 342, 342, 348, 342, 374, 342, - 399, 342, 383, 383, 342, 109, 342, 347, - 342, 342, 342, 342, 342, 374, 342, 374, - 342, 342, 342, 383, 383, 342, 109, 342, - 347, 342, 342, 342, 342, 342, 374, 342, - 374, 342, 342, 342, 383, 375, 342, 109, - 342, 347, 342, 342, 342, 342, 342, 374, - 342, 368, 369, 373, 373, 112, 109, 342, - 347, 342, 342, 342, 342, 342, 342, 348, - 342, 368, 369, 370, 373, 112, 109, 342, - 347, 342, 342, 137, 342, 342, 342, 348, - 342, 366, 342, 400, 342, 383, 383, 342, - 109, 342, 347, 342, 342, 342, 342, 342, - 366, 342, 366, 342, 342, 342, 383, 383, - 342, 109, 342, 347, 342, 342, 342, 342, - 342, 366, 342, 366, 342, 342, 342, 383, - 367, 342, 109, 342, 347, 342, 342, 342, - 342, 342, 366, 342, 360, 361, 365, 365, - 112, 109, 342, 347, 342, 342, 342, 342, - 342, 342, 348, 342, 360, 361, 362, 365, - 112, 109, 342, 347, 342, 342, 139, 342, - 342, 342, 348, 342, 358, 342, 401, 342, - 383, 383, 342, 109, 342, 347, 342, 342, - 342, 342, 342, 358, 342, 358, 342, 342, - 342, 383, 383, 342, 109, 342, 347, 342, - 342, 342, 342, 342, 358, 342, 358, 342, - 342, 342, 383, 359, 342, 109, 342, 347, - 342, 342, 342, 342, 342, 358, 342, 352, - 353, 357, 357, 112, 109, 342, 347, 342, - 342, 342, 342, 342, 342, 348, 342, 352, - 353, 354, 357, 112, 109, 342, 347, 342, - 342, 141, 342, 342, 342, 348, 342, 350, - 342, 402, 342, 383, 383, 342, 109, 342, - 347, 342, 342, 342, 342, 342, 350, 342, - 350, 342, 342, 342, 383, 383, 342, 109, - 342, 347, 342, 342, 342, 342, 342, 350, - 342, 350, 342, 342, 342, 383, 351, 342, - 109, 342, 347, 342, 342, 342, 342, 342, - 350, 342, 343, 344, 346, 346, 112, 109, - 342, 347, 342, 342, 342, 342, 342, 342, - 348, 342, 148, 149, 150, 151, 403, 287, - 76, 73, 285, 154, 155, 155, 144, 285, - 285, 148, 158, 285, 162, 404, 164, 165, - 4, 1, 161, 166, 161, 161, 35, 161, - 161, 161, 167, 161, 170, 149, 150, 151, - 405, 406, 76, 407, 161, 408, 161, 155, - 144, 161, 161, 170, 158, 161, 107, 409, - 409, 76, 407, 161, 166, 161, 161, 144, - 161, 410, 161, 161, 411, 161, 408, 161, - 408, 161, 412, 161, 207, 161, 410, 161, - 161, 161, 161, 408, 161, 170, 161, 222, - 107, 409, 409, 76, 407, 161, 166, 161, - 161, 161, 161, 161, 170, 161, 414, 413, - 415, 415, 413, 146, 413, 416, 413, 415, - 415, 413, 146, 413, 416, 413, 417, 413, - 413, 418, 413, 416, 413, 416, 413, 419, - 413, 420, 413, 417, 413, 413, 413, 413, - 416, 413, 148, 341, 341, 341, 341, 341, - 341, 341, 341, 341, 155, 341, 341, 341, - 341, 148, 341, 0 + 154, 155, 155, 144, 147, 156, 157, 147, + 158, 159, 147, 161, 162, 163, 164, 4, + 1, 160, 165, 160, 160, 35, 160, 166, + 162, 167, 167, 4, 1, 160, 165, 160, + 162, 167, 167, 4, 1, 160, 165, 160, + 168, 160, 160, 160, 17, 169, 160, 1, + 160, 165, 160, 160, 160, 160, 160, 168, + 160, 170, 171, 172, 173, 4, 1, 160, + 165, 160, 160, 33, 160, 174, 171, 175, + 175, 4, 1, 160, 165, 160, 171, 175, + 175, 4, 1, 160, 165, 160, 176, 160, + 160, 160, 17, 177, 160, 1, 160, 165, + 160, 160, 160, 160, 160, 176, 160, 178, + 179, 180, 181, 4, 1, 160, 165, 160, + 160, 31, 160, 182, 179, 183, 183, 4, + 1, 160, 165, 160, 179, 183, 183, 4, + 1, 160, 165, 160, 184, 160, 160, 160, + 17, 185, 160, 1, 160, 165, 160, 160, + 160, 160, 160, 184, 160, 186, 187, 188, + 189, 4, 1, 160, 165, 160, 160, 29, + 160, 190, 187, 191, 191, 4, 1, 160, + 165, 160, 187, 191, 191, 4, 1, 160, + 165, 160, 192, 160, 160, 160, 17, 193, + 160, 1, 160, 165, 160, 160, 160, 160, + 160, 192, 160, 194, 195, 196, 197, 4, + 1, 160, 165, 160, 160, 27, 160, 198, + 195, 199, 199, 4, 1, 160, 165, 160, + 195, 199, 199, 4, 1, 160, 165, 160, + 17, 200, 160, 1, 160, 165, 160, 201, + 201, 160, 1, 160, 165, 160, 202, 160, + 160, 203, 160, 165, 160, 165, 160, 204, + 160, 205, 160, 202, 160, 160, 160, 160, + 165, 160, 17, 160, 201, 201, 160, 1, + 160, 165, 160, 201, 200, 160, 1, 160, + 165, 160, 206, 26, 207, 208, 7, 1, + 160, 165, 160, 26, 207, 208, 7, 1, + 160, 165, 160, 207, 207, 7, 1, 160, + 165, 160, 209, 23, 210, 211, 10, 1, + 160, 165, 160, 23, 210, 211, 10, 1, + 160, 165, 160, 210, 210, 10, 1, 160, + 165, 160, 212, 20, 213, 214, 13, 1, + 160, 165, 160, 20, 213, 214, 13, 1, + 160, 165, 160, 213, 213, 13, 1, 160, + 165, 160, 215, 17, 201, 216, 160, 1, + 160, 165, 160, 17, 201, 216, 160, 1, + 160, 165, 160, 194, 195, 199, 199, 4, + 1, 160, 165, 160, 194, 195, 196, 199, + 4, 1, 160, 165, 160, 160, 27, 160, + 192, 160, 217, 160, 201, 201, 160, 1, + 160, 165, 160, 160, 160, 160, 160, 192, + 160, 192, 160, 160, 160, 201, 201, 160, + 1, 160, 165, 160, 160, 160, 160, 160, + 192, 160, 192, 160, 160, 160, 201, 193, + 160, 1, 160, 165, 160, 160, 160, 160, + 160, 192, 160, 186, 187, 191, 191, 4, + 1, 160, 165, 160, 186, 187, 188, 191, + 4, 1, 160, 165, 160, 160, 29, 160, + 184, 160, 218, 160, 201, 201, 160, 1, + 160, 165, 160, 160, 160, 160, 160, 184, + 160, 184, 160, 160, 160, 201, 201, 160, + 1, 160, 165, 160, 160, 160, 160, 160, + 184, 160, 184, 160, 160, 160, 201, 185, + 160, 1, 160, 165, 160, 160, 160, 160, + 160, 184, 160, 178, 179, 183, 183, 4, + 1, 160, 165, 160, 178, 179, 180, 183, + 4, 1, 160, 165, 160, 160, 31, 160, + 176, 160, 219, 160, 201, 201, 160, 1, + 160, 165, 160, 160, 160, 160, 160, 176, + 160, 176, 160, 160, 160, 201, 201, 160, + 1, 160, 165, 160, 160, 160, 160, 160, + 176, 160, 176, 160, 160, 160, 201, 177, + 160, 1, 160, 165, 160, 160, 160, 160, + 160, 176, 160, 170, 171, 175, 175, 4, + 1, 160, 165, 160, 170, 171, 172, 175, + 4, 1, 160, 165, 160, 160, 33, 160, + 168, 160, 220, 160, 201, 201, 160, 1, + 160, 165, 160, 160, 160, 160, 160, 168, + 160, 168, 160, 160, 160, 201, 201, 160, + 1, 160, 165, 160, 160, 160, 160, 160, + 168, 160, 168, 160, 160, 160, 201, 169, + 160, 1, 160, 165, 160, 160, 160, 160, + 160, 168, 160, 161, 162, 167, 167, 4, + 1, 160, 165, 160, 161, 162, 163, 167, + 4, 1, 160, 165, 160, 160, 35, 160, + 222, 223, 224, 225, 40, 37, 221, 226, + 221, 221, 71, 221, 227, 223, 228, 225, + 40, 37, 221, 226, 221, 223, 228, 225, + 40, 37, 221, 226, 221, 229, 221, 221, + 221, 53, 230, 221, 37, 221, 226, 221, + 221, 221, 221, 221, 229, 221, 231, 232, + 233, 234, 40, 37, 221, 226, 221, 221, + 69, 221, 235, 232, 236, 236, 40, 37, + 221, 226, 221, 232, 236, 236, 40, 37, + 221, 226, 221, 237, 221, 221, 221, 53, + 238, 221, 37, 221, 226, 221, 221, 221, + 221, 221, 237, 221, 239, 240, 241, 242, + 40, 37, 221, 226, 221, 221, 67, 221, + 243, 240, 244, 244, 40, 37, 221, 226, + 221, 240, 244, 244, 40, 37, 221, 226, + 221, 245, 221, 221, 221, 53, 246, 221, + 37, 221, 226, 221, 221, 221, 221, 221, + 245, 221, 247, 248, 249, 250, 40, 37, + 221, 226, 221, 221, 65, 221, 251, 248, + 252, 252, 40, 37, 221, 226, 221, 248, + 252, 252, 40, 37, 221, 226, 221, 253, + 221, 221, 221, 53, 254, 221, 37, 221, + 226, 221, 221, 221, 221, 221, 253, 221, + 255, 256, 257, 258, 40, 37, 221, 226, + 221, 221, 63, 221, 259, 256, 260, 260, + 40, 37, 221, 226, 221, 256, 260, 260, + 40, 37, 221, 226, 221, 53, 261, 221, + 37, 221, 226, 221, 262, 262, 221, 37, + 221, 226, 221, 263, 221, 221, 264, 221, + 226, 221, 226, 221, 265, 221, 266, 221, + 263, 221, 221, 221, 221, 226, 221, 53, + 221, 262, 262, 221, 37, 221, 226, 221, + 262, 261, 221, 37, 221, 226, 221, 267, + 62, 268, 269, 43, 37, 221, 226, 221, + 62, 268, 269, 43, 37, 221, 226, 221, + 268, 268, 43, 37, 221, 226, 221, 270, + 59, 271, 272, 46, 37, 221, 226, 221, + 59, 271, 272, 46, 37, 221, 226, 221, + 271, 271, 46, 37, 221, 226, 221, 273, + 56, 274, 275, 49, 37, 221, 226, 221, + 56, 274, 275, 49, 37, 221, 226, 221, + 274, 274, 49, 37, 221, 226, 221, 276, + 53, 262, 277, 221, 37, 221, 226, 221, + 53, 262, 277, 221, 37, 221, 226, 221, + 255, 256, 260, 260, 40, 37, 221, 226, + 221, 255, 256, 257, 260, 40, 37, 221, + 226, 221, 221, 63, 221, 253, 221, 278, + 221, 262, 262, 221, 37, 221, 226, 221, + 221, 221, 221, 221, 253, 221, 253, 221, + 221, 221, 262, 262, 221, 37, 221, 226, + 221, 221, 221, 221, 221, 253, 221, 253, + 221, 221, 221, 262, 254, 221, 37, 221, + 226, 221, 221, 221, 221, 221, 253, 221, + 247, 248, 252, 252, 40, 37, 221, 226, + 221, 247, 248, 249, 252, 40, 37, 221, + 226, 221, 221, 65, 221, 245, 221, 279, + 221, 262, 262, 221, 37, 221, 226, 221, + 221, 221, 221, 221, 245, 221, 245, 221, + 221, 221, 262, 262, 221, 37, 221, 226, + 221, 221, 221, 221, 221, 245, 221, 245, + 221, 221, 221, 262, 246, 221, 37, 221, + 226, 221, 221, 221, 221, 221, 245, 221, + 239, 240, 244, 244, 40, 37, 221, 226, + 221, 239, 240, 241, 244, 40, 37, 221, + 226, 221, 221, 67, 221, 237, 221, 280, + 221, 262, 262, 221, 37, 221, 226, 221, + 221, 221, 221, 221, 237, 221, 237, 221, + 221, 221, 262, 262, 221, 37, 221, 226, + 221, 221, 221, 221, 221, 237, 221, 237, + 221, 221, 221, 262, 238, 221, 37, 221, + 226, 221, 221, 221, 221, 221, 237, 221, + 231, 232, 236, 236, 40, 37, 221, 226, + 221, 231, 232, 233, 236, 40, 37, 221, + 226, 221, 221, 69, 221, 229, 221, 281, + 221, 262, 262, 221, 37, 221, 226, 221, + 221, 221, 221, 221, 229, 221, 229, 221, + 221, 221, 262, 262, 221, 37, 221, 226, + 221, 221, 221, 221, 221, 229, 221, 229, + 221, 221, 221, 262, 230, 221, 37, 221, + 226, 221, 221, 221, 221, 221, 229, 221, + 70, 39, 39, 40, 37, 221, 222, 223, + 228, 225, 40, 37, 221, 226, 221, 283, + 151, 284, 284, 76, 73, 282, 154, 282, + 151, 284, 284, 76, 73, 282, 154, 282, + 285, 282, 282, 282, 90, 286, 282, 73, + 282, 154, 282, 282, 282, 282, 282, 285, + 282, 287, 288, 289, 290, 76, 73, 282, + 154, 282, 282, 106, 282, 291, 288, 292, + 292, 76, 73, 282, 154, 282, 288, 292, + 292, 76, 73, 282, 154, 282, 293, 282, + 282, 282, 90, 294, 282, 73, 282, 154, + 282, 282, 282, 282, 282, 293, 282, 295, + 296, 297, 298, 76, 73, 282, 154, 282, + 282, 104, 282, 299, 296, 300, 300, 76, + 73, 282, 154, 282, 296, 300, 300, 76, + 73, 282, 154, 282, 301, 282, 282, 282, + 90, 302, 282, 73, 282, 154, 282, 282, + 282, 282, 282, 301, 282, 303, 304, 305, + 306, 76, 73, 282, 154, 282, 282, 102, + 282, 307, 304, 308, 308, 76, 73, 282, + 154, 282, 304, 308, 308, 76, 73, 282, + 154, 282, 309, 282, 282, 282, 90, 310, + 282, 73, 282, 154, 282, 282, 282, 282, + 282, 309, 282, 311, 312, 313, 314, 76, + 73, 282, 154, 282, 282, 100, 282, 315, + 312, 316, 316, 76, 73, 282, 154, 282, + 312, 316, 316, 76, 73, 282, 154, 282, + 90, 317, 282, 73, 282, 154, 282, 318, + 318, 282, 73, 282, 154, 282, 319, 282, + 282, 320, 282, 154, 282, 154, 282, 321, + 282, 322, 282, 319, 282, 282, 282, 282, + 154, 282, 90, 282, 318, 318, 282, 73, + 282, 154, 282, 318, 317, 282, 73, 282, + 154, 282, 323, 99, 324, 325, 80, 73, + 282, 154, 282, 99, 324, 325, 80, 73, + 282, 154, 282, 324, 324, 80, 73, 282, + 154, 282, 326, 96, 327, 328, 83, 73, + 282, 154, 282, 96, 327, 328, 83, 73, + 282, 154, 282, 327, 327, 83, 73, 282, + 154, 282, 329, 93, 330, 331, 86, 73, + 282, 154, 282, 93, 330, 331, 86, 73, + 282, 154, 282, 330, 330, 86, 73, 282, + 154, 282, 332, 90, 318, 333, 282, 73, + 282, 154, 282, 90, 318, 333, 282, 73, + 282, 154, 282, 311, 312, 316, 316, 76, + 73, 282, 154, 282, 311, 312, 313, 316, + 76, 73, 282, 154, 282, 282, 100, 282, + 309, 282, 334, 282, 318, 318, 282, 73, + 282, 154, 282, 282, 282, 282, 282, 309, + 282, 309, 282, 282, 282, 318, 318, 282, + 73, 282, 154, 282, 282, 282, 282, 282, + 309, 282, 309, 282, 282, 282, 318, 310, + 282, 73, 282, 154, 282, 282, 282, 282, + 282, 309, 282, 303, 304, 308, 308, 76, + 73, 282, 154, 282, 303, 304, 305, 308, + 76, 73, 282, 154, 282, 282, 102, 282, + 301, 282, 335, 282, 318, 318, 282, 73, + 282, 154, 282, 282, 282, 282, 282, 301, + 282, 301, 282, 282, 282, 318, 318, 282, + 73, 282, 154, 282, 282, 282, 282, 282, + 301, 282, 301, 282, 282, 282, 318, 302, + 282, 73, 282, 154, 282, 282, 282, 282, + 282, 301, 282, 295, 296, 300, 300, 76, + 73, 282, 154, 282, 295, 296, 297, 300, + 76, 73, 282, 154, 282, 282, 104, 282, + 293, 282, 336, 282, 318, 318, 282, 73, + 282, 154, 282, 282, 282, 282, 282, 293, + 282, 293, 282, 282, 282, 318, 318, 282, + 73, 282, 154, 282, 282, 282, 282, 282, + 293, 282, 293, 282, 282, 282, 318, 294, + 282, 73, 282, 154, 282, 282, 282, 282, + 282, 293, 282, 287, 288, 292, 292, 76, + 73, 282, 154, 282, 287, 288, 289, 292, + 76, 73, 282, 154, 282, 282, 106, 282, + 285, 282, 337, 282, 318, 318, 282, 73, + 282, 154, 282, 282, 282, 282, 282, 285, + 282, 285, 282, 282, 282, 318, 318, 282, + 73, 282, 154, 282, 282, 282, 282, 282, + 285, 282, 285, 282, 282, 282, 318, 286, + 282, 73, 282, 154, 282, 282, 282, 282, + 282, 285, 282, 107, 75, 75, 76, 73, + 338, 338, 338, 338, 144, 338, 150, 151, + 284, 284, 76, 73, 282, 154, 282, 107, + 75, 75, 76, 73, 338, 340, 341, 342, + 343, 112, 109, 339, 344, 339, 339, 143, + 339, 345, 341, 343, 343, 112, 109, 339, + 344, 339, 341, 343, 343, 112, 109, 339, + 344, 339, 346, 339, 339, 339, 125, 347, + 339, 109, 339, 344, 339, 339, 339, 339, + 339, 346, 339, 348, 349, 350, 351, 112, + 109, 339, 344, 339, 339, 141, 339, 352, + 349, 353, 353, 112, 109, 339, 344, 339, + 349, 353, 353, 112, 109, 339, 344, 339, + 354, 339, 339, 339, 125, 355, 339, 109, + 339, 344, 339, 339, 339, 339, 339, 354, + 339, 356, 357, 358, 359, 112, 109, 339, + 344, 339, 339, 139, 339, 360, 357, 361, + 361, 112, 109, 339, 344, 339, 357, 361, + 361, 112, 109, 339, 344, 339, 362, 339, + 339, 339, 125, 363, 339, 109, 339, 344, + 339, 339, 339, 339, 339, 362, 339, 364, + 365, 366, 367, 112, 109, 339, 344, 339, + 339, 137, 339, 368, 365, 369, 369, 112, + 109, 339, 344, 339, 365, 369, 369, 112, + 109, 339, 344, 339, 370, 339, 339, 339, + 125, 371, 339, 109, 339, 344, 339, 339, + 339, 339, 339, 370, 339, 372, 373, 374, + 375, 112, 109, 339, 344, 339, 339, 135, + 339, 376, 373, 377, 377, 112, 109, 339, + 344, 339, 373, 377, 377, 112, 109, 339, + 344, 339, 125, 378, 339, 109, 339, 344, + 339, 379, 379, 339, 109, 339, 344, 339, + 380, 339, 339, 381, 339, 344, 339, 344, + 339, 382, 339, 383, 339, 380, 339, 339, + 339, 339, 344, 339, 125, 339, 379, 379, + 339, 109, 339, 344, 339, 379, 378, 339, + 109, 339, 344, 339, 384, 134, 385, 386, + 115, 109, 339, 344, 339, 134, 385, 386, + 115, 109, 339, 344, 339, 385, 385, 115, + 109, 339, 344, 339, 387, 131, 388, 389, + 118, 109, 339, 344, 339, 131, 388, 389, + 118, 109, 339, 344, 339, 388, 388, 118, + 109, 339, 344, 339, 390, 128, 391, 392, + 121, 109, 339, 344, 339, 128, 391, 392, + 121, 109, 339, 344, 339, 391, 391, 121, + 109, 339, 344, 339, 393, 125, 379, 394, + 339, 109, 339, 344, 339, 125, 379, 394, + 339, 109, 339, 344, 339, 372, 373, 377, + 377, 112, 109, 339, 344, 339, 372, 373, + 374, 377, 112, 109, 339, 344, 339, 339, + 135, 339, 370, 339, 395, 339, 379, 379, + 339, 109, 339, 344, 339, 339, 339, 339, + 339, 370, 339, 370, 339, 339, 339, 379, + 379, 339, 109, 339, 344, 339, 339, 339, + 339, 339, 370, 339, 370, 339, 339, 339, + 379, 371, 339, 109, 339, 344, 339, 339, + 339, 339, 339, 370, 339, 364, 365, 369, + 369, 112, 109, 339, 344, 339, 364, 365, + 366, 369, 112, 109, 339, 344, 339, 339, + 137, 339, 362, 339, 396, 339, 379, 379, + 339, 109, 339, 344, 339, 339, 339, 339, + 339, 362, 339, 362, 339, 339, 339, 379, + 379, 339, 109, 339, 344, 339, 339, 339, + 339, 339, 362, 339, 362, 339, 339, 339, + 379, 363, 339, 109, 339, 344, 339, 339, + 339, 339, 339, 362, 339, 356, 357, 361, + 361, 112, 109, 339, 344, 339, 356, 357, + 358, 361, 112, 109, 339, 344, 339, 339, + 139, 339, 354, 339, 397, 339, 379, 379, + 339, 109, 339, 344, 339, 339, 339, 339, + 339, 354, 339, 354, 339, 339, 339, 379, + 379, 339, 109, 339, 344, 339, 339, 339, + 339, 339, 354, 339, 354, 339, 339, 339, + 379, 355, 339, 109, 339, 344, 339, 339, + 339, 339, 339, 354, 339, 348, 349, 353, + 353, 112, 109, 339, 344, 339, 348, 349, + 350, 353, 112, 109, 339, 344, 339, 339, + 141, 339, 346, 339, 398, 339, 379, 379, + 339, 109, 339, 344, 339, 339, 339, 339, + 339, 346, 339, 346, 339, 339, 339, 379, + 379, 339, 109, 339, 344, 339, 339, 339, + 339, 339, 346, 339, 346, 339, 339, 339, + 379, 347, 339, 109, 339, 344, 339, 339, + 339, 339, 339, 346, 339, 340, 341, 343, + 343, 112, 109, 339, 344, 339, 148, 149, + 150, 151, 399, 284, 76, 73, 282, 154, + 155, 155, 144, 282, 282, 148, 282, 161, + 400, 163, 164, 4, 1, 160, 165, 160, + 160, 35, 160, 168, 149, 150, 151, 401, + 402, 76, 403, 160, 404, 160, 155, 144, + 160, 160, 168, 160, 107, 405, 405, 76, + 403, 160, 165, 160, 160, 144, 160, 406, + 160, 160, 407, 160, 404, 160, 404, 160, + 408, 160, 205, 160, 406, 160, 160, 160, + 160, 404, 160, 168, 160, 220, 107, 405, + 405, 76, 403, 160, 165, 160, 160, 160, + 160, 160, 168, 160, 410, 409, 411, 411, + 409, 146, 409, 412, 409, 411, 411, 409, + 146, 409, 412, 409, 413, 409, 409, 414, + 409, 412, 409, 412, 409, 415, 409, 416, + 409, 413, 409, 409, 409, 409, 412, 409, + 148, 338, 338, 338, 338, 338, 338, 338, + 338, 338, 155, 338, 338, 338, 338, 148, + 338, 0 }; static const short _indic_syllable_machine_trans_targs[] = { 138, 160, 166, 2, 167, 3, 5, 170, 6, 8, 173, 9, 11, 176, 12, 14, 15, 159, 17, 18, 175, 20, 21, 172, - 23, 24, 169, 179, 183, 184, 188, 189, - 193, 194, 198, 199, 138, 222, 228, 36, - 229, 37, 39, 232, 40, 42, 235, 43, - 45, 238, 46, 48, 49, 221, 51, 52, - 237, 54, 55, 234, 57, 58, 231, 241, - 245, 246, 250, 251, 255, 256, 260, 262, - 138, 283, 289, 70, 290, 138, 71, 73, - 293, 74, 76, 296, 77, 79, 299, 80, - 82, 83, 282, 85, 86, 298, 88, 89, - 295, 91, 92, 292, 302, 306, 307, 311, - 312, 316, 317, 321, 138, 346, 352, 103, - 353, 104, 106, 356, 107, 109, 359, 110, - 112, 362, 113, 115, 116, 345, 118, 119, - 361, 121, 122, 358, 124, 125, 355, 365, - 369, 370, 374, 375, 379, 380, 384, 385, - 323, 138, 398, 138, 139, 201, 263, 265, - 322, 324, 285, 325, 386, 387, 301, 396, - 403, 138, 140, 142, 33, 200, 162, 178, - 141, 32, 143, 196, 144, 146, 31, 195, - 145, 30, 147, 191, 148, 150, 29, 190, - 149, 28, 151, 186, 152, 154, 27, 185, - 153, 26, 155, 181, 156, 158, 25, 180, - 157, 1, 165, 0, 161, 164, 163, 138, - 168, 4, 22, 171, 7, 19, 174, 10, - 16, 177, 13, 182, 187, 192, 197, 138, - 202, 204, 67, 261, 224, 240, 203, 66, - 205, 258, 206, 208, 65, 257, 207, 64, - 209, 253, 210, 212, 63, 252, 211, 62, - 213, 248, 214, 216, 61, 247, 215, 60, - 217, 243, 218, 220, 59, 242, 219, 35, - 227, 34, 223, 226, 225, 138, 230, 38, - 56, 233, 41, 53, 236, 44, 50, 239, - 47, 244, 249, 254, 259, 138, 264, 100, - 266, 319, 267, 269, 99, 318, 268, 98, - 270, 314, 271, 273, 97, 313, 272, 96, - 274, 309, 275, 277, 95, 308, 276, 94, - 278, 304, 279, 281, 93, 303, 280, 69, - 288, 68, 284, 287, 286, 138, 291, 72, - 90, 294, 75, 87, 297, 78, 84, 300, - 81, 305, 310, 315, 320, 138, 138, 326, - 328, 134, 133, 348, 364, 327, 329, 382, - 330, 332, 132, 381, 331, 131, 333, 377, - 334, 336, 130, 376, 335, 129, 337, 372, - 338, 340, 128, 371, 339, 127, 341, 367, - 342, 344, 126, 366, 343, 102, 351, 101, - 347, 350, 349, 138, 354, 105, 123, 357, - 108, 120, 360, 111, 117, 363, 114, 368, - 373, 378, 383, 135, 388, 389, 395, 390, - 392, 136, 391, 394, 393, 138, 397, 137, - 400, 399, 402, 401, 138 + 23, 24, 169, 178, 182, 183, 187, 188, + 192, 193, 197, 198, 138, 221, 227, 36, + 228, 37, 39, 231, 40, 42, 234, 43, + 45, 237, 46, 48, 49, 220, 51, 52, + 236, 54, 55, 233, 57, 58, 230, 239, + 243, 244, 248, 249, 253, 254, 258, 260, + 138, 281, 287, 70, 288, 138, 71, 73, + 291, 74, 76, 294, 77, 79, 297, 80, + 82, 83, 280, 85, 86, 296, 88, 89, + 293, 91, 92, 290, 299, 303, 304, 308, + 309, 313, 314, 318, 138, 343, 349, 103, + 350, 104, 106, 353, 107, 109, 356, 110, + 112, 359, 113, 115, 116, 342, 118, 119, + 358, 121, 122, 355, 124, 125, 352, 361, + 365, 366, 370, 371, 375, 376, 380, 381, + 320, 138, 394, 138, 139, 200, 261, 263, + 319, 321, 283, 322, 382, 383, 392, 399, + 138, 140, 142, 33, 199, 162, 141, 32, + 143, 195, 144, 146, 31, 194, 145, 30, + 147, 190, 148, 150, 29, 189, 149, 28, + 151, 185, 152, 154, 27, 184, 153, 26, + 155, 180, 156, 158, 25, 179, 157, 1, + 165, 0, 161, 164, 163, 138, 168, 4, + 22, 171, 7, 19, 174, 10, 16, 177, + 13, 181, 186, 191, 196, 138, 201, 203, + 67, 259, 223, 202, 66, 204, 256, 205, + 207, 65, 255, 206, 64, 208, 251, 209, + 211, 63, 250, 210, 62, 212, 246, 213, + 215, 61, 245, 214, 60, 216, 241, 217, + 219, 59, 240, 218, 35, 226, 34, 222, + 225, 224, 138, 229, 38, 56, 232, 41, + 53, 235, 44, 50, 238, 47, 242, 247, + 252, 257, 138, 262, 100, 264, 316, 265, + 267, 99, 315, 266, 98, 268, 311, 269, + 271, 97, 310, 270, 96, 272, 306, 273, + 275, 95, 305, 274, 94, 276, 301, 277, + 279, 93, 300, 278, 69, 286, 68, 282, + 285, 284, 138, 289, 72, 90, 292, 75, + 87, 295, 78, 84, 298, 81, 302, 307, + 312, 317, 138, 138, 323, 325, 134, 133, + 345, 324, 326, 378, 327, 329, 132, 377, + 328, 131, 330, 373, 331, 333, 130, 372, + 332, 129, 334, 368, 335, 337, 128, 367, + 336, 127, 338, 363, 339, 341, 126, 362, + 340, 102, 348, 101, 344, 347, 346, 138, + 351, 105, 123, 354, 108, 120, 357, 111, + 117, 360, 114, 364, 369, 374, 379, 135, + 384, 385, 391, 386, 388, 136, 387, 390, + 389, 138, 393, 137, 396, 395, 398, 397, + 138 }; static const char _indic_syllable_machine_trans_actions[] = { @@ -782,40 +705,40 @@ static const char _indic_syllable_machine_trans_actions[] = { 2, 0, 0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 8, 0, 11, 2, 2, 6, 0, - 12, 12, 0, 2, 6, 2, 6, 2, - 0, 13, 2, 0, 0, 2, 0, 2, + 12, 12, 0, 2, 6, 2, 2, 0, + 13, 2, 0, 0, 2, 0, 2, 0, + 2, 2, 2, 0, 0, 2, 2, 0, + 2, 2, 2, 0, 0, 2, 2, 0, + 2, 2, 2, 0, 0, 2, 2, 0, + 2, 2, 2, 0, 0, 2, 2, 0, + 2, 0, 0, 0, 0, 14, 2, 0, + 0, 2, 0, 0, 2, 0, 0, 2, + 0, 2, 2, 2, 2, 15, 2, 0, + 0, 2, 0, 2, 0, 2, 2, 2, + 0, 0, 2, 2, 0, 2, 2, 2, + 0, 0, 2, 2, 0, 2, 2, 2, + 0, 0, 2, 2, 0, 2, 2, 2, + 0, 0, 2, 2, 0, 2, 0, 0, + 0, 0, 16, 2, 0, 0, 2, 0, + 0, 2, 0, 0, 2, 0, 2, 2, + 2, 2, 17, 6, 0, 6, 2, 6, + 0, 0, 6, 6, 0, 6, 2, 6, + 0, 0, 6, 6, 0, 6, 2, 6, + 0, 0, 6, 6, 0, 6, 2, 6, + 0, 0, 6, 6, 0, 2, 0, 0, + 0, 0, 18, 2, 0, 0, 2, 0, + 0, 2, 0, 0, 2, 0, 2, 2, + 2, 2, 19, 20, 2, 0, 0, 0, + 0, 2, 2, 2, 2, 0, 0, 2, 2, 0, 2, 2, 2, 0, 0, 2, 2, 0, 2, 2, 2, 0, 0, 2, 2, 0, 2, 2, 2, 0, 0, 2, - 2, 0, 2, 2, 2, 0, 0, 2, - 2, 0, 2, 0, 0, 0, 0, 14, + 2, 0, 2, 0, 0, 0, 0, 21, 2, 0, 0, 2, 0, 0, 2, 0, - 0, 2, 0, 2, 2, 2, 2, 15, - 2, 0, 0, 2, 0, 2, 2, 0, - 2, 2, 2, 0, 0, 2, 2, 0, - 2, 2, 2, 0, 0, 2, 2, 0, - 2, 2, 2, 0, 0, 2, 2, 0, - 2, 2, 2, 0, 0, 2, 2, 0, - 2, 0, 0, 0, 0, 16, 2, 0, - 0, 2, 0, 0, 2, 0, 0, 2, - 0, 2, 2, 2, 2, 17, 6, 0, - 6, 2, 6, 0, 0, 6, 6, 0, - 6, 2, 6, 0, 0, 6, 6, 0, - 6, 2, 6, 0, 0, 6, 6, 0, - 6, 2, 6, 0, 0, 6, 6, 0, - 2, 0, 0, 0, 0, 18, 2, 0, - 0, 2, 0, 0, 2, 0, 0, 2, - 0, 2, 2, 2, 2, 19, 20, 2, - 0, 0, 0, 0, 2, 2, 2, 2, - 2, 0, 0, 2, 2, 0, 2, 2, - 2, 0, 0, 2, 2, 0, 2, 2, - 2, 0, 0, 2, 2, 0, 2, 2, - 2, 0, 0, 2, 2, 0, 2, 0, - 0, 0, 0, 21, 2, 0, 0, 2, - 0, 0, 2, 0, 0, 2, 0, 2, - 2, 2, 2, 0, 0, 22, 22, 0, - 0, 0, 0, 0, 0, 23, 2, 0, - 0, 0, 0, 0, 24 + 0, 2, 0, 2, 2, 2, 2, 0, + 0, 22, 22, 0, 0, 0, 0, 0, + 0, 23, 2, 0, 0, 0, 0, 0, + 24 }; static const char _indic_syllable_machine_to_state_actions[] = { @@ -868,8 +791,7 @@ static const char _indic_syllable_machine_to_state_actions[] = { 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, 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_from_state_actions[] = { @@ -922,8 +844,7 @@ static const char _indic_syllable_machine_from_state_actions[] = { 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, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0 }; static const short _indic_syllable_machine_eof_trans[] = { @@ -944,40 +865,39 @@ static const short _indic_syllable_machine_eof_trans[] = { 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 73, - 1, 146, 0, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, - 286, 286, 342, 286, 342, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 286, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 414, 414, 414, 414, - 414, 414, 414, 342 + 1, 146, 0, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 222, 222, 222, 222, 222, 222, 222, 222, + 222, 222, 222, 222, 222, 222, 222, 222, + 222, 222, 222, 222, 222, 222, 222, 222, + 222, 222, 222, 222, 222, 222, 222, 222, + 222, 222, 222, 222, 222, 222, 222, 222, + 222, 222, 222, 222, 222, 222, 222, 222, + 222, 222, 222, 222, 222, 222, 222, 222, + 222, 222, 222, 222, 222, 283, 283, 283, + 283, 283, 283, 283, 283, 283, 283, 283, + 283, 283, 283, 283, 283, 283, 283, 283, + 283, 283, 283, 283, 283, 283, 283, 283, + 283, 283, 283, 283, 283, 283, 283, 283, + 283, 283, 283, 283, 283, 283, 283, 283, + 283, 283, 283, 283, 283, 283, 283, 283, + 283, 283, 283, 283, 283, 283, 283, 339, + 283, 339, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 340, 340, + 340, 340, 340, 340, 340, 340, 283, 161, + 161, 161, 161, 161, 161, 161, 161, 161, + 410, 410, 410, 410, 410, 410, 410, 339 }; static const int indic_syllable_machine_start = 138; @@ -991,7 +911,7 @@ static const int indic_syllable_machine_en_main = 138; -#line 92 "hb-ot-shape-complex-indic-machine.rl" +#line 90 "hb-ot-shape-complex-indic-machine.rl" #define found_syllable(syllable_type) \ @@ -1011,7 +931,7 @@ find_syllables (hb_buffer_t *buffer) int cs; hb_glyph_info_t *info = buffer->info; -#line 1015 "hb-ot-shape-complex-indic-machine.hh" +#line 935 "hb-ot-shape-complex-indic-machine.hh" { cs = indic_syllable_machine_start; ts = 0; @@ -1019,7 +939,7 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 113 "hb-ot-shape-complex-indic-machine.rl" +#line 111 "hb-ot-shape-complex-indic-machine.rl" p = 0; @@ -1028,7 +948,7 @@ find_syllables (hb_buffer_t *buffer) unsigned int last = 0; unsigned int syllable_serial = 1; -#line 1032 "hb-ot-shape-complex-indic-machine.hh" +#line 952 "hb-ot-shape-complex-indic-machine.hh" { int _slen; int _trans; @@ -1042,7 +962,7 @@ _resume: #line 1 "NONE" {ts = p;} break; -#line 1046 "hb-ot-shape-complex-indic-machine.hh" +#line 966 "hb-ot-shape-complex-indic-machine.hh" } _keys = _indic_syllable_machine_trans_keys + (cs<<1); @@ -1065,71 +985,71 @@ _eof_trans: {te = p+1;} break; case 14: -#line 83 "hb-ot-shape-complex-indic-machine.rl" +#line 81 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (consonant_syllable); }} break; case 16: -#line 84 "hb-ot-shape-complex-indic-machine.rl" +#line 82 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (vowel_syllable); }} break; case 21: -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (standalone_cluster); }} break; case 24: -#line 86 "hb-ot-shape-complex-indic-machine.rl" +#line 84 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (symbol_cluster); }} break; case 18: -#line 87 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (broken_cluster); }} break; case 11: -#line 88 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (non_indic_cluster); }} break; case 13: -#line 83 "hb-ot-shape-complex-indic-machine.rl" +#line 81 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (consonant_syllable); }} break; case 15: -#line 84 "hb-ot-shape-complex-indic-machine.rl" +#line 82 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (vowel_syllable); }} break; case 20: -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (standalone_cluster); }} break; case 23: -#line 86 "hb-ot-shape-complex-indic-machine.rl" +#line 84 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (symbol_cluster); }} break; case 17: -#line 87 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (broken_cluster); }} break; case 19: -#line 88 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (non_indic_cluster); }} break; case 1: -#line 83 "hb-ot-shape-complex-indic-machine.rl" +#line 81 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} break; case 3: -#line 84 "hb-ot-shape-complex-indic-machine.rl" +#line 82 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (vowel_syllable); }} break; case 7: -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (standalone_cluster); }} break; case 8: -#line 86 "hb-ot-shape-complex-indic-machine.rl" +#line 84 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (symbol_cluster); }} break; case 4: -#line 87 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (broken_cluster); }} break; case 5: @@ -1150,22 +1070,22 @@ _eof_trans: case 22: #line 1 "NONE" {te = p+1;} -#line 83 "hb-ot-shape-complex-indic-machine.rl" +#line 81 "hb-ot-shape-complex-indic-machine.rl" {act = 1;} break; case 6: #line 1 "NONE" {te = p+1;} -#line 87 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "hb-ot-shape-complex-indic-machine.rl" {act = 5;} break; case 12: #line 1 "NONE" {te = p+1;} -#line 88 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "hb-ot-shape-complex-indic-machine.rl" {act = 6;} break; -#line 1169 "hb-ot-shape-complex-indic-machine.hh" +#line 1089 "hb-ot-shape-complex-indic-machine.hh" } _again: @@ -1174,7 +1094,7 @@ _again: #line 1 "NONE" {ts = 0;} break; -#line 1178 "hb-ot-shape-complex-indic-machine.hh" +#line 1098 "hb-ot-shape-complex-indic-machine.hh" } if ( ++p != pe ) @@ -1190,7 +1110,7 @@ _again: } -#line 122 "hb-ot-shape-complex-indic-machine.rl" +#line 120 "hb-ot-shape-complex-indic-machine.rl" } diff --git a/src/hb-ot-shape-complex-indic-machine.rl b/src/hb-ot-shape-complex-indic-machine.rl index c5c5fe698..5c5fece33 100644 --- a/src/hb-ot-shape-complex-indic-machine.rl +++ b/src/hb-ot-shape-complex-indic-machine.rl @@ -52,7 +52,6 @@ DOTTEDCIRCLE = 12; RS = 13; Repha = 15; Ra = 16; -CM = 17; Symbol= 18; CS = 19; @@ -68,15 +67,14 @@ matra_group = z{0,3}.M.N?.(H | forced_rakar)?; syllable_tail = (z?.SM.SM?.ZWNJ?)? A{0,3}?; halant_group = (z?.H.(ZWJ.N?)?); final_halant_group = halant_group | H.ZWNJ; -medial_group = CM?; halant_or_matra_group = (final_halant_group | matra_group{0,4}); -consonant_syllable = (Repha|CS)? (cn.halant_group){0,4} cn medial_group halant_or_matra_group syllable_tail; -vowel_syllable = reph? V.n? (ZWJ | (halant_group.cn){0,4} medial_group halant_or_matra_group syllable_tail); -standalone_cluster = ((Repha|CS)? PLACEHOLDER | reph? DOTTEDCIRCLE).n? (halant_group.cn){0,4} medial_group halant_or_matra_group syllable_tail; +consonant_syllable = (Repha|CS)? (cn.halant_group){0,4} cn halant_or_matra_group syllable_tail; +vowel_syllable = reph? V.n? (ZWJ | (halant_group.cn){0,4} halant_or_matra_group syllable_tail); +standalone_cluster = ((Repha|CS)? PLACEHOLDER | reph? DOTTEDCIRCLE).n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail; symbol_cluster = symbol syllable_tail; -broken_cluster = reph? n? (halant_group.cn){0,4} medial_group halant_or_matra_group syllable_tail; +broken_cluster = reph? n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail; other = any; main := |* diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 4131e705d..e6c9ba8da 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -720,7 +720,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, indic_position_t last_pos = POS_START; for (unsigned int i = start; i < end; i++) { - if ((FLAG_UNSAFE (info[i].indic_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | MEDIAL_FLAGS | FLAG (OT_H)))) + if ((FLAG_UNSAFE (info[i].indic_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | FLAG (OT_H)))) { info[i].indic_position() = last_pos; if (unlikely (info[i].indic_category() == OT_H && diff --git a/src/hb-ot-shape-complex-indic.hh b/src/hb-ot-shape-complex-indic.hh index fe5595f89..b0f88e8bd 100644 --- a/src/hb-ot-shape-complex-indic.hh +++ b/src/hb-ot-shape-complex-indic.hh @@ -64,19 +64,17 @@ enum indic_category_t { OT_Coeng = 14, /* Khmer-style Virama. */ OT_Repha = 15, /* Atomically-encoded logical or visual repha. */ OT_Ra = 16, - OT_CM = 17, /* Consonant-Medial. */ + OT_CM = 17, /* Consonant-Medial; Unused by Indic shaper. */ OT_Symbol = 18, /* Avagraha, etc that take marks (SM,A,VD). */ OT_CS = 19 }; -#define MEDIAL_FLAGS (FLAG (OT_CM)) - /* Note: * * We treat Vowels and placeholders as if they were consonants. This is safe because Vowels * cannot happen in a consonant syllable. The plus side however is, we can call the * consonant syllable logic from the vowel syllable function and get it all right! */ -#define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_CS) | FLAG (OT_Ra) | MEDIAL_FLAGS | FLAG (OT_V) | FLAG (OT_PLACEHOLDER) | FLAG (OT_DOTTEDCIRCLE)) +#define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_CS) | FLAG (OT_Ra) | FLAG (OT_V) | FLAG (OT_PLACEHOLDER) | FLAG (OT_DOTTEDCIRCLE)) #define JOINER_FLAGS (FLAG (OT_ZWJ) | FLAG (OT_ZWNJ)) From f72b748371da2d7ce327a5d15feea46960aa7dd3 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 2 Oct 2018 00:16:08 +0330 Subject: [PATCH 05/30] [circleci] Fix "msan" and "everything" bots (#1205) --- .circleci/config.yml | 13 ++++++------- src/check-symbols.sh | 2 -- test/fuzzing/main.cc | 22 +++++++++------------- test/fuzzing/run-shape-fuzzer-tests.py | 2 -- test/fuzzing/run-subset-fuzzer-tests.py | 2 -- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 450b62bee..9a0bfe39d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,9 +91,9 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CFLAGS="-Weverything -Werror -fPIC -Wno-unused-parameter -Wno-missing-variable-declarations -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro -Wno-shadow -Wno-reserved-id-macro -Wno-disabled-macro-expansion -Wno-missing-variable-declarations -Wno-unused-macros -Wno-unreachable-code-return" CXXFLAGS="-Weverything -Werror -fPIC -Wno-undef -Wno-deprecated-declarations -Wno-weak-vtables -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make -j32 - - run: make check || .ci/fail.sh + - run: CFLAGS="-Weverything -Wno-unused-parameter -Wno-missing-variable-declarations -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro -Wno-shadow -Wno-reserved-id-macro -Wno-disabled-macro-expansion -Wno-missing-variable-declarations -Wno-unused-macros -Wno-unreachable-code-return" CXXFLAGS="-Weverything -Wno-undef -Wno-deprecated-declarations -Wno-weak-vtables -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: make -j32 CPPFLAGS="-Werror" + - run: make check CPPFLAGS="-Werror" || .ci/fail.sh clang-asan: docker: @@ -121,14 +121,13 @@ jobs: - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list - run: apt update || true - - run: apt install -y clang lld binutils libtool autoconf automake automake1.11 gtk-doc-tools gettext make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y clang lld binutils libtool autoconf automake gtk-doc-tools gettext make pkg-config ragel libcairo2-dev libicu-dev libmount-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.lld" 10 - - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && ./autogen.sh || true && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. + - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.58/glib-2.58.1.tar.xz && tar xf glib-2.58.1.tar.xz && cd glib-2.58.1 && ./autogen.sh --with-pcre CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ && make -j32 && make install && cd .. - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --without-icu - - run: make -j32 - - run: MSAN_OPTIONS=exitcode=42 SKIPCHECKSYMBOLS=1 SKIPFUZZERTESTS=1 make check || .ci/fail.sh | asan_symbolize | c++filt + - run: make -j32 && MSAN_OPTIONS=exitcode=42 make check || .ci/fail.sh | asan_symbolize | c++filt clang-tsan: docker: diff --git a/src/check-symbols.sh b/src/check-symbols.sh index d197e8e3c..cea868488 100755 --- a/src/check-symbols.sh +++ b/src/check-symbols.sh @@ -3,8 +3,6 @@ LC_ALL=C export LC_ALL -test -z "$SKIPCHECKSYMBOLS" || exit 77 - test -z "$srcdir" && srcdir=. test -z "$libs" && libs=.libs stat=0 diff --git a/test/fuzzing/main.cc b/test/fuzzing/main.cc index 4692f7b5f..3ff8803ee 100644 --- a/test/fuzzing/main.cc +++ b/test/fuzzing/main.cc @@ -1,21 +1,17 @@ #include "hb-fuzzer.hh" -#include -#include -#include +#include #include -std::string FileToString(const std::string &Path) { - /* TODO This silently passes if file does not exist. Fix it! */ - std::ifstream T(Path.c_str()); - return std::string((std::istreambuf_iterator(T)), - std::istreambuf_iterator()); -} - int main(int argc, char **argv) { + hb_blob_t *blob = hb_blob_create_from_file (argv[1]); + unsigned int len; + const char *font_data = hb_blob_get_data (blob, &len); + for (int i = 1; i < argc; i++) { - std::string s = FileToString(argv[i]); - std::cout << argv[i] << std::endl; - LLVMFuzzerTestOneInput((const unsigned char*)s.data(), s.size()); + printf ("%s\n", argv[i]); + LLVMFuzzerTestOneInput((const uint8_t *) font_data, len); } + + hb_blob_destroy (blob); } diff --git a/test/fuzzing/run-shape-fuzzer-tests.py b/test/fuzzing/run-shape-fuzzer-tests.py index e87cd09df..fea0b01b4 100755 --- a/test/fuzzing/run-shape-fuzzer-tests.py +++ b/test/fuzzing/run-shape-fuzzer-tests.py @@ -4,8 +4,6 @@ from __future__ import print_function, division, absolute_import import sys, os, subprocess -if os.environ.get ("SKIPFUZZERTESTS", "") != "": sys.exit (0) - srcdir = os.environ.get ("srcdir", ".") EXEEXT = os.environ.get ("EXEEXT", "") top_builddir = os.environ.get ("top_builddir", ".") diff --git a/test/fuzzing/run-subset-fuzzer-tests.py b/test/fuzzing/run-subset-fuzzer-tests.py index aa045fed6..013628860 100755 --- a/test/fuzzing/run-subset-fuzzer-tests.py +++ b/test/fuzzing/run-subset-fuzzer-tests.py @@ -4,8 +4,6 @@ from __future__ import print_function, division, absolute_import import sys, os, subprocess -if os.environ.get ("SKIPFUZZERTESTS", "") != "": sys.exit (0) - srcdir = os.environ.get ("srcdir", ".") EXEEXT = os.environ.get ("EXEEXT", "") top_builddir = os.environ.get ("top_builddir", ".") From 9742679b8253919f8bfec8a77532092044e951aa Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 2 Oct 2018 03:20:48 +0330 Subject: [PATCH 06/30] [circleci] Remove some of the not needed flags --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9a0bfe39d..670efa5ad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,7 +91,7 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CFLAGS="-Weverything -Wno-unused-parameter -Wno-missing-variable-declarations -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro -Wno-shadow -Wno-reserved-id-macro -Wno-disabled-macro-expansion -Wno-missing-variable-declarations -Wno-unused-macros -Wno-unreachable-code-return" CXXFLAGS="-Weverything -Wno-undef -Wno-deprecated-declarations -Wno-weak-vtables -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro" CXXFLAGS="-Weverything -Wno-undef -Wno-deprecated-declarations -Wno-weak-vtables -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make -j32 CPPFLAGS="-Werror" - run: make check CPPFLAGS="-Werror" || .ci/fail.sh From f9ea3dc4c6e85c417dd4c8546e5ebe02b67131b9 Mon Sep 17 00:00:00 2001 From: HinTak Date: Tue, 2 Oct 2018 06:43:06 +0100 Subject: [PATCH 07/30] Missing "out" indicator (#1209) Missing "out" indicator. Affect gobject introspection. --- src/hb-font.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-font.cc b/src/hb-font.cc index c0beea66e..5c259dca2 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -1005,7 +1005,7 @@ hb_font_get_glyph_from_name (hb_font_t *font, * hb_font_get_extents_for_direction: * @font: a font. * @direction: - * @extents: + * @extents: (out): * * * From d27e5ec3a236b8eb37ef9ce558ad54077e46b003 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Tue, 2 Oct 2018 08:25:29 +0200 Subject: [PATCH 08/30] Skip BOM in the Python sample file Fixes https://github.com/harfbuzz/harfbuzz/issues/1208 --- src/sample.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sample.py b/src/sample.py index 8f97195f2..5d65aa09e 100755 --- a/src/sample.py +++ b/src/sample.py @@ -54,11 +54,11 @@ if False: # buffer: hb.buffer_add_utf8 (buf, text.encode('utf-8'), 0, -1) # Otherwise, then following handles both narrow and wide - # Python builds: + # Python builds (the first item in the array is BOM, so we skip it): elif sys.maxunicode == 0x10FFFF: - hb.buffer_add_utf32 (buf, array.array('I', text.encode('utf-32')), 0, -1) + hb.buffer_add_utf32 (buf, array.array('I', text.encode('utf-32'))[1:], 0, -1) else: - hb.buffer_add_utf16 (buf, array.array('H', text.encode('utf-16')), 0, -1) + hb.buffer_add_utf16 (buf, array.array('H', text.encode('utf-16'))[1:], 0, -1) hb.buffer_guess_segment_properties (buf) From bf5088b3dcd94106937290c180f3f40bc8524b48 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 2 Oct 2018 11:07:06 +0330 Subject: [PATCH 09/30] Minor, fix -Weverthing bot warnings (#1210) --- test/api/test-buffer.c | 8 ++++---- test/api/test-multithread.c | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c index 5c98a9a16..5fba3b228 100644 --- a/test/api/test-buffer.c +++ b/test/api/test-buffer.c @@ -92,14 +92,14 @@ fixture_init (fixture_t *fixture, gconstpointer user_data) } static void -fixture_finish (fixture_t *fixture, gconstpointer user_data) +fixture_finish (fixture_t *fixture, gconstpointer user_data HB_UNUSED) { hb_buffer_destroy (fixture->buffer); } static void -test_buffer_properties (fixture_t *fixture, gconstpointer user_data) +test_buffer_properties (fixture_t *fixture, gconstpointer user_data HB_UNUSED) { hb_buffer_t *b = fixture->buffer; hb_unicode_funcs_t *ufuncs; @@ -294,7 +294,7 @@ test_buffer_contents (fixture_t *fixture, gconstpointer user_data) } static void -test_buffer_positions (fixture_t *fixture, gconstpointer user_data) +test_buffer_positions (fixture_t *fixture, gconstpointer user_data HB_UNUSED) { hb_buffer_t *b = fixture->buffer; unsigned int i, len, len2; @@ -319,7 +319,7 @@ test_buffer_positions (fixture_t *fixture, gconstpointer user_data) } static void -test_buffer_allocation (fixture_t *fixture, gconstpointer user_data) +test_buffer_allocation (fixture_t *fixture, gconstpointer user_data HB_UNUSED) { hb_buffer_t *b = fixture->buffer; diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index de288b6a4..e1e7eb531 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -49,7 +49,7 @@ static int num_iters = 200; static hb_font_t *font; static hb_buffer_t *ref_buffer; -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static void fill_the_buffer (hb_buffer_t *buffer) @@ -105,7 +105,6 @@ static void test_body (void) { int i; - int num_threads = 30; pthread_t *threads = calloc (num_threads, sizeof (pthread_t)); hb_buffer_t **buffers = calloc (num_threads, sizeof (hb_buffer_t *)); From 1d1734e985e1f2a746b4fff0cd82d96d477577d5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 13:04:05 +0200 Subject: [PATCH 10/30] Shuffle code around --- src/hb-ot-shape-complex-hebrew.cc | 2 +- src/hb-ot-shape-fallback.cc | 2 +- src/hb-ot-shape-normalize.cc | 2 +- src/hb-ot-shape.cc | 32 +++++++++++++++++++++++++++---- src/hb-ot-shape.hh | 29 ++++++---------------------- 5 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/hb-ot-shape-complex-hebrew.cc b/src/hb-ot-shape-complex-hebrew.cc index ba25258a3..ddb25ef2a 100644 --- a/src/hb-ot-shape-complex-hebrew.cc +++ b/src/hb-ot-shape-complex-hebrew.cc @@ -70,7 +70,7 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c, bool found = (bool) c->unicode->compose (a, b, ab); - if (!found && !c->plan->has_mark) + if (!found && !c->plan->has_gpos_mark) { /* Special-case Hebrew presentation forms that are excluded from * standard normalization, but wanted for old fonts. */ diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index f7409e8bf..6673abd14 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -441,7 +441,7 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { - if (!plan->has_kern) return; + if (!plan->kerning_requested) return; OT::hb_ot_apply_context_t c (1, font, buffer); hb_mask_t kern_mask = plan->kern_mask; diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc index 2f0cba184..0e13707ed 100644 --- a/src/hb-ot-shape-normalize.cc +++ b/src/hb-ot-shape-normalize.cc @@ -296,7 +296,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, hb_ot_shape_normalization_mode_t mode = plan->shaper->normalization_preference; if (mode == HB_OT_SHAPE_NORMALIZATION_MODE_AUTO) { - if (plan->has_mark) + if (plan->has_gpos_mark) // https://github.com/harfbuzz/harfbuzz/issues/653#issuecomment-423905920 //mode = HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED; mode = HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS; diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 5404a5c3a..f0e3c8be7 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -43,7 +43,32 @@ #include "hb-ot-layout-gsubgpos.hh" #include "hb-aat-layout.hh" -static hb_tag_t common_features[] = { + +void +hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, + const int *coords, + unsigned int num_coords) +{ + plan.props = props; + plan.shaper = shaper; + map.compile (plan.map, coords, num_coords); + + plan.rtlm_mask = plan.map.get_1_mask (HB_TAG ('r','t','l','m')); + plan.frac_mask = plan.map.get_1_mask (HB_TAG ('f','r','a','c')); + plan.numr_mask = plan.map.get_1_mask (HB_TAG ('n','u','m','r')); + plan.dnom_mask = plan.map.get_1_mask (HB_TAG ('d','n','o','m')); + + plan.kern_mask = plan.map.get_mask (HB_DIRECTION_IS_HORIZONTAL (plan.props.direction) ? + HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n')); + + plan.has_frac = plan.frac_mask || (plan.numr_mask && plan.dnom_mask); + plan.kerning_requested = !!plan.kern_mask; + plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k')); +} + + +static hb_tag_t common_features[] = +{ HB_TAG('c','c','m','p'), HB_TAG('l','o','c','l'), HB_TAG('m','a','r','k'), @@ -52,7 +77,8 @@ static hb_tag_t common_features[] = { }; -static hb_tag_t horizontal_features[] = { +static hb_tag_t horizontal_features[] = +{ HB_TAG('c','a','l','t'), HB_TAG('c','l','i','g'), HB_TAG('c','u','r','s'), @@ -61,8 +87,6 @@ static hb_tag_t horizontal_features[] = { HB_TAG('r','c','l','t'), }; - - static void hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, const hb_segment_properties_t *props, diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh index b3a490a37..a6a315a42 100644 --- a/src/hb-ot-shape.hh +++ b/src/hb-ot-shape.hh @@ -42,9 +42,9 @@ struct hb_ot_shape_plan_t const void *data; hb_mask_t rtlm_mask, frac_mask, numr_mask, dnom_mask; hb_mask_t kern_mask; - unsigned int has_frac : 1; - unsigned int has_kern : 1; - unsigned int has_mark : 1; + bool has_frac : 1; + bool kerning_requested : 1; + bool has_gpos_mark : 1; inline void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const { @@ -83,26 +83,9 @@ struct hb_ot_shape_planner_t shaper (nullptr), map (face, &props) {} - inline void compile (hb_ot_shape_plan_t &plan, - const int *coords, - unsigned int num_coords) - { - plan.props = props; - plan.shaper = shaper; - map.compile (plan.map, coords, num_coords); - - plan.rtlm_mask = plan.map.get_1_mask (HB_TAG ('r','t','l','m')); - plan.frac_mask = plan.map.get_1_mask (HB_TAG ('f','r','a','c')); - plan.numr_mask = plan.map.get_1_mask (HB_TAG ('n','u','m','r')); - plan.dnom_mask = plan.map.get_1_mask (HB_TAG ('d','n','o','m')); - - plan.kern_mask = plan.map.get_mask (HB_DIRECTION_IS_HORIZONTAL (plan.props.direction) ? - HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n')); - - plan.has_frac = plan.frac_mask || (plan.numr_mask && plan.dnom_mask); - plan.has_kern = !!plan.kern_mask; - plan.has_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k')); - } + HB_INTERNAL void compile (hb_ot_shape_plan_t &plan, + const int *coords, + unsigned int num_coords); private: HB_DISALLOW_COPY_AND_ASSIGN (hb_ot_shape_planner_t); From 10b6c7c63870fa04cd8adcf9f38644c2a799db8a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 13:11:18 +0200 Subject: [PATCH 11/30] Minor include cleanup --- src/hb-ot-shape-complex.hh | 1 + src/hb-ot-shape.cc | 4 +--- src/hb-ot-shape.hh | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hb-ot-shape-complex.hh b/src/hb-ot-shape-complex.hh index a48a38a20..e0be8d3c4 100644 --- a/src/hb-ot-shape-complex.hh +++ b/src/hb-ot-shape-complex.hh @@ -29,6 +29,7 @@ #include "hb.hh" +#include "hb-ot-layout.hh" #include "hb-ot-shape.hh" #include "hb-ot-shape-normalize.hh" diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index f0e3c8be7..7f4e442d4 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -36,11 +36,9 @@ #include "hb-ot-shape-normalize.hh" #include "hb-ot-face.hh" -#include "hb-ot-layout.hh" -#include "hb-unicode.hh" + #include "hb-set.hh" -#include "hb-ot-layout-gsubgpos.hh" #include "hb-aat-layout.hh" diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh index a6a315a42..52e6b1106 100644 --- a/src/hb-ot-shape.hh +++ b/src/hb-ot-shape.hh @@ -30,7 +30,7 @@ #include "hb.hh" #include "hb-ot-map.hh" -#include "hb-ot-layout.hh" +#include "hb-shape-plan.hh" From 588a4ac8bc9fd20464c7a77ead27ae34478c9bc8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 13:13:47 +0200 Subject: [PATCH 12/30] Rename --- src/hb-ot-face.cc | 20 ++++++------ src/hb-ot-face.hh | 78 +++++++++++++++++++++++------------------------ 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/hb-ot-face.cc b/src/hb-ot-face.cc index 388a59720..1bc68d366 100644 --- a/src/hb-ot-face.cc +++ b/src/hb-ot-face.cc @@ -40,19 +40,19 @@ void hb_ot_face_data_t::init0 (hb_face_t *face) { this->face = face; -#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 (); -#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_ACCELERATOR -#undef HB_OT_LAYOUT_TABLE +#define HB_OT_TABLE(Namespace, Type) Type.init0 (); +#define HB_OT_ACCELERATOR(Namespace, Type) HB_OT_TABLE (Namespace, Type) + HB_OT_TABLES +#undef HB_OT_ACCELERATOR +#undef HB_OT_TABLE } void hb_ot_face_data_t::fini (void) { -#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini (); -#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_ACCELERATOR -#undef HB_OT_LAYOUT_TABLE +#define HB_OT_TABLE(Namespace, Type) Type.fini (); +#define HB_OT_ACCELERATOR(Namespace, Type) HB_OT_TABLE (Namespace, Type) + HB_OT_TABLES +#undef HB_OT_ACCELERATOR +#undef HB_OT_TABLE } hb_ot_face_data_t * diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index 5ac3538e4..e30592218 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -43,66 +43,66 @@ /* Most of these tables are NOT needed for shaping. But we need to hook them *somewhere*. * This is as good as any place. */ -#define HB_OT_LAYOUT_TABLES \ +#define HB_OT_TABLES \ /* OpenType shaping. */ \ - HB_OT_LAYOUT_TABLE(OT, JSTF) \ - HB_OT_LAYOUT_TABLE(OT, BASE) \ + HB_OT_TABLE(OT, JSTF) \ + HB_OT_TABLE(OT, BASE) \ /* AAT shaping. */ \ - HB_OT_LAYOUT_TABLE(AAT, morx) \ - HB_OT_LAYOUT_TABLE(AAT, kerx) \ - HB_OT_LAYOUT_TABLE(AAT, ankr) \ - HB_OT_LAYOUT_TABLE(AAT, trak) \ + HB_OT_TABLE(AAT, morx) \ + HB_OT_TABLE(AAT, kerx) \ + HB_OT_TABLE(AAT, ankr) \ + HB_OT_TABLE(AAT, trak) \ /* OpenType variations. */ \ - HB_OT_LAYOUT_TABLE(OT, fvar) \ - HB_OT_LAYOUT_TABLE(OT, avar) \ - HB_OT_LAYOUT_TABLE(OT, MVAR) \ + HB_OT_TABLE(OT, fvar) \ + HB_OT_TABLE(OT, avar) \ + HB_OT_TABLE(OT, MVAR) \ /* OpenType math. */ \ - HB_OT_LAYOUT_TABLE(OT, MATH) \ + HB_OT_TABLE(OT, MATH) \ /* OpenType fundamentals. */ \ - HB_OT_LAYOUT_ACCELERATOR(OT, GDEF) \ - HB_OT_LAYOUT_ACCELERATOR(OT, GSUB) \ - HB_OT_LAYOUT_ACCELERATOR(OT, GPOS) \ - HB_OT_LAYOUT_ACCELERATOR(OT, cmap) \ - HB_OT_LAYOUT_ACCELERATOR(OT, hmtx) \ - HB_OT_LAYOUT_ACCELERATOR(OT, vmtx) \ - HB_OT_LAYOUT_ACCELERATOR(OT, post) \ - HB_OT_LAYOUT_ACCELERATOR(OT, kern) \ - HB_OT_LAYOUT_ACCELERATOR(OT, glyf) \ - HB_OT_LAYOUT_ACCELERATOR(OT, CBDT) \ + HB_OT_ACCELERATOR(OT, GDEF) \ + HB_OT_ACCELERATOR(OT, GSUB) \ + HB_OT_ACCELERATOR(OT, GPOS) \ + HB_OT_ACCELERATOR(OT, cmap) \ + HB_OT_ACCELERATOR(OT, hmtx) \ + HB_OT_ACCELERATOR(OT, vmtx) \ + HB_OT_ACCELERATOR(OT, post) \ + HB_OT_ACCELERATOR(OT, kern) \ + HB_OT_ACCELERATOR(OT, glyf) \ + HB_OT_ACCELERATOR(OT, CBDT) \ /* */ /* Declare tables. */ -#define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; } -#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type##_accelerator_t) -HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_ACCELERATOR -#undef HB_OT_LAYOUT_TABLE +#define HB_OT_TABLE(Namespace, Type) namespace Namespace { struct Type; } +#define HB_OT_ACCELERATOR(Namespace, Type) HB_OT_TABLE (Namespace, Type##_accelerator_t) +HB_OT_TABLES +#undef HB_OT_ACCELERATOR +#undef HB_OT_TABLE struct hb_ot_face_data_t { HB_INTERNAL void init0 (hb_face_t *face); HB_INTERNAL void fini (void); -#define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \ +#define HB_OT_TABLE_ORDER(Namespace, Type) \ HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) enum order_t { ORDER_ZERO, -#define HB_OT_LAYOUT_TABLE(Namespace, Type) HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), -#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_ACCELERATOR -#undef HB_OT_LAYOUT_TABLE +#define HB_OT_TABLE(Namespace, Type) HB_OT_TABLE_ORDER (Namespace, Type), +#define HB_OT_ACCELERATOR(Namespace, Type) HB_OT_TABLE (Namespace, Type) + HB_OT_TABLES +#undef HB_OT_ACCELERATOR +#undef HB_OT_TABLE }; hb_face_t *face; /* MUST be JUST before the lazy loaders. */ -#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ - hb_table_lazy_loader_t Type; -#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \ - hb_face_lazy_loader_t Type; - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_ACCELERATOR -#undef HB_OT_LAYOUT_TABLE +#define HB_OT_TABLE(Namespace, Type) \ + hb_table_lazy_loader_t Type; +#define HB_OT_ACCELERATOR(Namespace, Type) \ + hb_face_lazy_loader_t Type; + HB_OT_TABLES +#undef HB_OT_ACCELERATOR +#undef HB_OT_TABLE }; From 96eca87f89588126d3fa5c7f3884ae2f302a91e1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 13:24:40 +0200 Subject: [PATCH 13/30] Move things --- src/hb-ot-shape.cc | 22 ++++++++++------------ src/hb-ot-shape.hh | 3 +++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 7f4e442d4..4b7c2efa2 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -62,6 +62,11 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, plan.has_frac = plan.frac_mask || (plan.numr_mask && plan.dnom_mask); plan.kerning_requested = !!plan.kern_mask; plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k')); + + bool disable_otl = plan.shaper->disable_otl && plan.shaper->disable_otl (&plan); + //plan.fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (face); + plan.fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (face); + plan.fallback_glyph_classes = disable_otl || !hb_ot_layout_has_glyph_classes (face); } @@ -257,8 +262,6 @@ struct hb_ot_shape_context_t unsigned int num_user_features; /* Transient stuff */ - bool fallback_positioning; - bool fallback_glyph_classes; hb_direction_t target_direction; }; @@ -634,7 +637,7 @@ hb_ot_substitute_default (hb_ot_shape_context_t *c) hb_ot_shape_setup_masks (c); /* This is unfortunate to go here, but necessary... */ - if (c->fallback_positioning) + if (c->plan->fallback_positioning) _hb_ot_shape_fallback_position_recategorize_marks (c->plan, c->font, buffer); hb_ot_map_glyphs_fast (buffer); @@ -748,7 +751,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) * If fallback positinoing happens or GPOS is present, we don't * care. */ - bool adjust_offsets_when_zeroing = c->fallback_positioning && + bool adjust_offsets_when_zeroing = c->plan->fallback_positioning && !c->plan->shaper->fallback_position && HB_DIRECTION_IS_FORWARD (c->buffer->props.direction); @@ -775,7 +778,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) break; } - if (likely (!c->fallback_positioning)) + if (likely (!c->plan->fallback_positioning)) c->plan->position (c->font, c->buffer); switch (c->plan->shaper->zero_width_marks) @@ -812,7 +815,7 @@ hb_ot_position (hb_ot_shape_context_t *c) hb_ot_position_complex (c); - if (c->fallback_positioning && c->plan->shaper->fallback_position) + if (c->plan->fallback_positioning && c->plan->shaper->fallback_position) _hb_ot_shape_fallback_position (c->plan, c->font, c->buffer); if (HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction)) @@ -820,7 +823,7 @@ hb_ot_position (hb_ot_shape_context_t *c) /* Visual fallback goes here. */ - if (c->fallback_positioning) + if (c->plan->fallback_positioning) _hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer); _hb_buffer_deallocate_gsubgpos_vars (c->buffer); @@ -872,11 +875,6 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c) (unsigned) HB_BUFFER_MAX_OPS_MIN); } - bool disable_otl = c->plan->shaper->disable_otl && c->plan->shaper->disable_otl (c->plan); - //c->fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (c->face); - c->fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (c->face); - c->fallback_glyph_classes = disable_otl || !hb_ot_layout_has_glyph_classes (c->face); - /* Save the original direction, we use it later. */ c->target_direction = c->buffer->props.direction; diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh index 52e6b1106..88c72dc15 100644 --- a/src/hb-ot-shape.hh +++ b/src/hb-ot-shape.hh @@ -42,9 +42,12 @@ struct hb_ot_shape_plan_t const void *data; hb_mask_t rtlm_mask, frac_mask, numr_mask, dnom_mask; hb_mask_t kern_mask; + bool has_frac : 1; bool kerning_requested : 1; bool has_gpos_mark : 1; + bool fallback_positioning : 1; + bool fallback_glyph_classes : 1; inline void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const { From cca757ae56d6a82cfad35edc6dbae58049a34f91 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 13:27:11 +0200 Subject: [PATCH 14/30] Minor --- src/hb-ot-shape.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 4b7c2efa2..df1b86fe9 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -66,7 +66,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, bool disable_otl = plan.shaper->disable_otl && plan.shaper->disable_otl (&plan); //plan.fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (face); plan.fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (face); - plan.fallback_glyph_classes = disable_otl || !hb_ot_layout_has_glyph_classes (face); + plan.fallback_glyph_classes = !hb_ot_layout_has_glyph_classes (face); } @@ -652,7 +652,7 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c) hb_ot_layout_substitute_start (c->font, buffer); - if (!hb_ot_layout_has_glyph_classes (c->face)) + if (c->plan->fallback_glyph_classes) hb_synthesize_glyph_classes (c); c->plan->substitute (c->font, buffer); From 48c513fec978819927535bc86b43be74315f746c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 14:17:42 +0200 Subject: [PATCH 15/30] Minor --- src/hb-ot-shape-complex-arabic.cc | 2 +- src/hb-ot-shape-complex-default.cc | 2 +- src/hb-ot-shape-complex-hangul.cc | 2 +- src/hb-ot-shape-complex-hebrew.cc | 14 +------------- src/hb-ot-shape-complex-indic.cc | 2 +- src/hb-ot-shape-complex-indic.hh | 2 -- src/hb-ot-shape-complex-khmer.cc | 2 +- src/hb-ot-shape-complex-myanmar.cc | 4 ++-- src/hb-ot-shape-complex-thai.cc | 2 +- src/hb-ot-shape-complex-tibetan.cc | 2 +- src/hb-ot-shape-complex-use.cc | 2 +- src/hb-ot-shape-complex.hh | 11 ++++------- src/hb-ot-shape.cc | 8 ++++---- 13 files changed, 19 insertions(+), 36 deletions(-) diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index c4a695ab9..e4e1d5fa9 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -731,7 +731,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic = nullptr, /* decompose */ nullptr, /* compose */ setup_masks_arabic, - nullptr, /* disable_otl */ + HB_TAG_NONE, /* gpos_tag */ reorder_marks_arabic, HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ diff --git a/src/hb-ot-shape-complex-default.cc b/src/hb-ot-shape-complex-default.cc index 45d5f4346..97923ecf6 100644 --- a/src/hb-ot-shape-complex-default.cc +++ b/src/hb-ot-shape-complex-default.cc @@ -39,7 +39,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default = nullptr, /* decompose */ nullptr, /* compose */ nullptr, /* setup_masks */ - nullptr, /* disable_otl */ + HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc index 96fd42678..0e7abadbe 100644 --- a/src/hb-ot-shape-complex-hangul.cc +++ b/src/hb-ot-shape-complex-hangul.cc @@ -424,7 +424,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hangul = nullptr, /* decompose */ nullptr, /* compose */ setup_masks_hangul, - nullptr, /* disable_otl */ + HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ diff --git a/src/hb-ot-shape-complex-hebrew.cc b/src/hb-ot-shape-complex-hebrew.cc index ddb25ef2a..90c36c023 100644 --- a/src/hb-ot-shape-complex-hebrew.cc +++ b/src/hb-ot-shape-complex-hebrew.cc @@ -154,18 +154,6 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c, return found; } -static bool -disable_otl_hebrew (const hb_ot_shape_plan_t *plan) -{ - /* For Hebrew shaper, use fallback if GPOS does not have 'hebr' - * script. This matches Uniscribe better, and makes fonts like - * Arial that have GSUB/GPOS/GDEF but no data for Hebrew work. - * See: - * https://github.com/harfbuzz/harfbuzz/issues/347#issuecomment-267838368 - */ - return plan->map.chosen_script[1] != HB_TAG ('h','e','b','r'); -} - const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew = { @@ -179,7 +167,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew = nullptr, /* decompose */ compose_hebrew, nullptr, /* setup_masks */ - disable_otl_hebrew, + HB_TAG ('h','e','b','r'), /* gpos_tag. https://github.com/harfbuzz/harfbuzz/issues/347#issuecomment-267838368 */ nullptr, /* reorder_marks */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index e6c9ba8da..9824d756f 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -1620,7 +1620,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic = decompose_indic, compose_indic, setup_masks_indic, - nullptr, /* disable_otl */ + HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ diff --git a/src/hb-ot-shape-complex-indic.hh b/src/hb-ot-shape-complex-indic.hh index b0f88e8bd..dcc2a7a6c 100644 --- a/src/hb-ot-shape-complex-indic.hh +++ b/src/hb-ot-shape-complex-indic.hh @@ -29,9 +29,7 @@ #include "hb.hh" - #include "hb-ot-shape-complex.hh" -#include "hb-ot-shape.hh" /* XXX Remove */ /* buffer var allocations */ diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index 9c766be1c..88d16267b 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -496,7 +496,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_khmer = decompose_khmer, compose_khmer, setup_masks_khmer, - nullptr, /* disable_otl */ + HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index 532ebfdc9..b0ca3c74a 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -389,7 +389,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old = nullptr, /* decompose */ nullptr, /* compose */ nullptr, /* setup_masks */ - nullptr, /* disable_otl */ + HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ @@ -407,7 +407,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar = nullptr, /* decompose */ nullptr, /* compose */ setup_masks_myanmar, - nullptr, /* disable_otl */ + HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, false, /* fallback_position */ diff --git a/src/hb-ot-shape-complex-thai.cc b/src/hb-ot-shape-complex-thai.cc index 1d18760e4..34110684c 100644 --- a/src/hb-ot-shape-complex-thai.cc +++ b/src/hb-ot-shape-complex-thai.cc @@ -376,7 +376,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai = nullptr, /* decompose */ nullptr, /* compose */ nullptr, /* setup_masks */ - nullptr, /* disable_otl */ + HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, false,/* fallback_position */ diff --git a/src/hb-ot-shape-complex-tibetan.cc b/src/hb-ot-shape-complex-tibetan.cc index 27c60b11e..5d6dfeae4 100644 --- a/src/hb-ot-shape-complex-tibetan.cc +++ b/src/hb-ot-shape-complex-tibetan.cc @@ -56,7 +56,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_tibetan = nullptr, /* decompose */ nullptr, /* compose */ nullptr, /* setup_masks */ - nullptr, /* disable_otl */ + HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, true, /* fallback_position */ diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index 929d60d9b..bdcad409d 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc @@ -597,7 +597,7 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use = nullptr, /* decompose */ compose_use, setup_masks_use, - nullptr, /* disable_otl */ + HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, false, /* fallback_position */ diff --git a/src/hb-ot-shape-complex.hh b/src/hb-ot-shape-complex.hh index e0be8d3c4..c18f1b96c 100644 --- a/src/hb-ot-shape-complex.hh +++ b/src/hb-ot-shape-complex.hh @@ -34,7 +34,6 @@ #include "hb-ot-shape-normalize.hh" - /* buffer var allocations, used by complex shapers */ #define complex_var_u8_0() var2.u8[2] #define complex_var_u8_1() var2.u8[3] @@ -148,13 +147,11 @@ struct hb_ot_complex_shaper_t hb_buffer_t *buffer, hb_font_t *font); - /* disable_otl() - * Called during shape(). - * If set and returns true, GDEF/GSUB/GPOS of the font are ignored - * and fallback operations used. - * May be nullptr. + /* gpos_tag() + * If not HB_TAG_NONE, then must match found GPOS script tag for + * GPOS to be applied. Otherwise, fallback positioning will be used. */ - bool (*disable_otl) (const hb_ot_shape_plan_t *plan); + hb_tag_t gpos_tag; /* reorder_marks() * Called during shape(). diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index df1b86fe9..bcb5b72ff 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -63,10 +63,10 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, plan.kerning_requested = !!plan.kern_mask; plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k')); - bool disable_otl = plan.shaper->disable_otl && plan.shaper->disable_otl (&plan); - //plan.fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (face); - plan.fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (face); - plan.fallback_glyph_classes = !hb_ot_layout_has_glyph_classes (face); + bool disable_gpos = plan.shaper->gpos_tag && + plan.shaper->gpos_tag != plan.map.chosen_script[1]; + plan.fallback_positioning = disable_gpos || !hb_ot_layout_has_positioning (face); + plan.fallback_glyph_classes = !hb_ot_layout_has_glyph_classes (face); } From c36f3f5bef52e660541933f003fafa6e3a14785d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 14:34:29 +0200 Subject: [PATCH 16/30] [arabic] Use manual-zwj instead of flipping joiners --- src/hb-buffer.hh | 3 +-- src/hb-ot-layout.hh | 12 ++------- src/hb-ot-shape-complex-arabic.cc | 41 +++++-------------------------- 3 files changed, 9 insertions(+), 47 deletions(-) diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 24d46400a..bcaf066c7 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -68,8 +68,7 @@ enum hb_buffer_scratch_flags_t { HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK = 0x00000004u, HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000008u, HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK = 0x00000010u, - HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS = 0x00000020u, - HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000040u, + HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000020u, /* Reserved for complex shapers' internal use. */ HB_BUFFER_SCRATCH_FLAG_COMPLEX0 = 0x01000000u, diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index d9b954f4c..7a787b77e 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -224,16 +224,8 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer) { buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES; props |= UPROPS_MASK_IGNORABLE; - if (u == 0x200Cu) - { - props |= UPROPS_MASK_Cf_ZWNJ; - buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS; - } - else if (u == 0x200Du) - { - props |= UPROPS_MASK_Cf_ZWJ; - buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS; - } + if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ; + else if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ; /* Mongolian Free Variation Selectors need to be remembered * because although we need to hide them like default-ignorables, * they need to non-ignorable during shaping. This is similar to diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index e4e1d5fa9..9893a22fb 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -158,11 +158,6 @@ static const struct arabic_state_table_entry { }; -static void -flip_joiners (const hb_ot_shape_plan_t *plan, - hb_font_t *font, - hb_buffer_t *buffer); - static void arabic_fallback_shape (const hb_ot_shape_plan_t *plan, hb_font_t *font, @@ -217,28 +212,20 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) } /* Normally, Unicode says a ZWNJ means "don't ligate". In Arabic script - * however, it says a ZWJ should also mean "don't ligate". So we convert - * a ZWJ to a ZWNJ for GSUB. We want to revert it back to ZWJ before - * GPOS processing though. So we just flip their roles, and flip back - * later. Note that this makes a ZWNJ into ZWJ for GSUB stage, which - * means it would *not* break ligatures. But since ligatures around - * ZWNJ are rare, we don't care. - * - * Since we don't currently have a way to apply a pause before GPOS - * starts, let's just do this dance around a few required GUSB features. */ - map->add_gsub_pause (flip_joiners); + * however, it says a ZWJ should also mean "don't ligate". So we run + * the main ligating features as MANUAL_ZWJ. */ - map->add_feature (HB_TAG('r','l','i','g'), F_GLOBAL | F_HAS_FALLBACK); + map->add_feature (HB_TAG('r','l','i','g'), F_GLOBAL | F_MANUAL_ZWJ | F_HAS_FALLBACK); if (plan->props.script == HB_SCRIPT_ARABIC) map->add_gsub_pause (arabic_fallback_shape); /* No pause after rclt. See 98460779bae19e4d64d29461ff154b3527bf8420. */ - map->enable_feature (HB_TAG('r','c','l','t')); - map->enable_feature (HB_TAG('c','a','l','t')); + map->add_feature (HB_TAG('r','c','l','t'), F_GLOBAL | F_MANUAL_ZWJ); + map->add_feature (HB_TAG('c','a','l','t'), F_GLOBAL | F_MANUAL_ZWJ); + map->add_gsub_pause (nullptr); /* And undo here. */ - map->add_gsub_pause (flip_joiners); /* The spec includes 'cswh'. Earlier versions of Windows * used to enable this by default, but testing suggests @@ -393,22 +380,6 @@ setup_masks_arabic (const hb_ot_shape_plan_t *plan, setup_masks_arabic_plan (arabic_plan, buffer, plan->props.script); } - -static void -flip_joiners (const hb_ot_shape_plan_t *plan HB_UNUSED, - hb_font_t *font HB_UNUSED, - hb_buffer_t *buffer) -{ - if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS)) - return; - - unsigned int count = buffer->len; - hb_glyph_info_t *info = buffer->info; - for (unsigned int i = 0; i < count; i++) - if (_hb_glyph_info_is_joiner (&info[i])) - _hb_glyph_info_flip_joiners (&info[i]); -} - static void arabic_fallback_shape (const hb_ot_shape_plan_t *plan, hb_font_t *font, From 729f634728fb553300021d52089495271dfb19fd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 14:40:14 +0200 Subject: [PATCH 17/30] Disable joiner-skipping when looking back for base to attach mark to Fixes https://github.com/harfbuzz/harfbuzz/issues/1189 --- src/hb-ot-shape.cc | 5 ++++- test/shaping/data/in-house/Makefile.sources | 1 + ...641ca9d7808b01cafa9a666c13811c9b56eb9c52.ttf | Bin 0 -> 11492 bytes .../in-house/tests/arabic-mark-attach.tests | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 test/shaping/data/in-house/fonts/641ca9d7808b01cafa9a666c13811c9b56eb9c52.ttf create mode 100644 test/shaping/data/in-house/tests/arabic-mark-attach.tests diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index bcb5b72ff..9c941a3b7 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -129,7 +129,10 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, planner->shaper->collect_features (planner); for (unsigned int i = 0; i < ARRAY_LENGTH (common_features); i++) - map->enable_feature (common_features[i]); + map->add_feature (common_features[i], F_GLOBAL | + (common_features[i] == HB_TAG('m','a','r','k') || + common_features[i] == HB_TAG('m','k','m','k') ? + F_MANUAL_JOINERS : F_NONE)); if (HB_DIRECTION_IS_HORIZONTAL (props->direction)) for (unsigned int i = 0; i < ARRAY_LENGTH (horizontal_features); i++) diff --git a/test/shaping/data/in-house/Makefile.sources b/test/shaping/data/in-house/Makefile.sources index e5cf77fd3..a79ab0413 100644 --- a/test/shaping/data/in-house/Makefile.sources +++ b/test/shaping/data/in-house/Makefile.sources @@ -2,6 +2,7 @@ TESTS = \ tests/arabic-fallback-shaping.tests \ tests/arabic-feature-order.tests \ tests/arabic-like-joining.tests \ + tests/arabic-mark-attach.tests \ tests/arabic-mark-order.tests \ tests/arabic-stch.tests \ tests/automatic-fractions.tests \ diff --git a/test/shaping/data/in-house/fonts/641ca9d7808b01cafa9a666c13811c9b56eb9c52.ttf b/test/shaping/data/in-house/fonts/641ca9d7808b01cafa9a666c13811c9b56eb9c52.ttf new file mode 100644 index 0000000000000000000000000000000000000000..1328e13caf2dad8f6f33d0206422c424dfcb7c4c GIT binary patch literal 11492 zcmcI~d2}4dd1qDiIXykyGd=fx&tPUSgSmjgIk*p!AP9m036dg+0YQS02$BLRnUdwi zc5KPku{umyv}7x>B*&IxQL?1f;U~$K5+|0|hy2!lc6RsKQTFX7yQ`<&>?+ySL14e? z20%!T{>gh8pu6kps_*;NufFfAnn4&Lq@YhD2F;HS4UgbCyns;hB`BR6o!ql;=(mHt z2&DoDF$<&nW(F>HeD!IBGM|S0;+}mi<%b{n{4henJE8sjv6aTzsUz>a1NpZge`=|5 z?ksX6GxYZz$Xl0A-E^Y$^MB`oG}Qai$>WVhW?|@e2nEhUS=&h{@ZKbO;r)}4Pn=vi zf8l$JS6op4Ey(}i)R|+AZ$J9TMaavLUs!2eIE!Z3XP_@SUgUIR<@hOdb1OojS%lcd zvuDno|B?ILqX@-7AM!TB>vuuBXZfFk#>g(DZE>5BuBB`4np=1_G(9jKURep>a6{-? z?$^QTcmFr9Ob1u4rDfM5gwc*GZ}XRlgpPtfAza5b`cGVff`t%MtESSmHg^aM3M23Z zl2&j!grQ3RkH-q6wc1u|3lTvfE@)OMx6$|EtpZL%qKy_ZKkh7)ZCZ1q>Smm_H-M5U~ zGdOsC%Bg8Zzgd3By~Jx!IZA#DXsnn60-p@`c$#VlXaZA=VA(^sl|e z+|SLS8lb~~PN}Mn4+gc|3gfoxI4L+DqZ)5vL8}cYnB8CCRkw*(LMkURa%Wy~DI94y zF}Js`?;D5q-&roV_f|NGXK=wE3V!L9_A}-3fpO-S*~yg5S%RHGk(Em){GM3QZ@uDs zkvVj++S*Yq7QeXv@Dm`v$-*3Zb@%RL9*<{?&gS6SZ`uFL9HFzxZOu_SrO%NQ1P(E7 zmp(;x4B8YJ`k$(kS{Z!xmJbKd(%nbJOB2OGi z4`b8%_b+u!J$2x~*9UDx^_qf1qr<^ySF;}zcXL-PKDlo?oh{oX8)GKCFOl;Um*#e8 zn%(c;F)$kPDWV5tErf~JTccCZ?QXknweu|XVmNJXfLg=Z(>3S z;$WTN^|keN{1>8nk&{703}%Vohw(IOr#f#fUzled07?N0 zLTeS4c#6`1vK-buWdMGd5<`}VoyTTXVMG1hMT zL_=YXb-A>+g_uq8i!3i$WTFKeG9kRo%Vv>GniPU%MJA#vtJrL=oc(~t%8FGayl66J z=mY!;dLKD;X}6BB~?hXS{k<=G2UJpYG+;NUTTKQ8?77#@aK!YBbpE$ev`h3;H0m;wvk|eeSLv>FyV-*AOaQHw~ zi@--q?@eWQxCK`rss)Cl(KbtMXJTJL@pfcZ|LCsa$vc+1x?6b(Y+s8n6uj?K!}r{J zeaf3IdYTwB@6JB1Dze#ew9UczeZi13Dw|D=bFM9<1WKcBx2qHimK0TM&)D*rfTpS` z$F7J~X69d?=$P*CmyX`H|HyZ#@l(j$E4z0u`rBvg)rBJmo4+U$5zHQ}k?(>h{2%z= zB5G8&Bc=NTiqi&hfa5?XFdGV{kbwmR05?_wZL$e2`Mwz81=S?f;_*?ptk#K$J=n%M z0tuJ9HxjKo1C7qkn_Iijm9=mP7}UF5%uj?R56dW;%N!btRSw7OA-v>b{GPl^OUM?{ zl;}-g$6|K)#=5;!h!e(aQ8NDKc1cqGaaSoAESsF#?yAPPwdO)b5m}aNYI3!McHrx| zPJA960PWfgS9g^Mpq$&aod%%XCJQ!o1u}d@-OX+c_duSLy*#Ixg;F@w>x?y9MIT`U zf!3Rh$!{G`Oy>kwFlP4-L}NY9_<>S+rNdVbh1;E42tHc(iG1^(gvHJZ5x1i&S~?JS zrSYVLxSe^Q4W?TX&BxnAlD|CWYAy$ZC5xKaXKl^|WQ&~kH?@i;d&utL1y)DFW*z8o za?Zq5kmngT8gsP5ny6oSguS1A9(4g046JtGF5vs26_8G)L(Io9p4t0vq=3p=$RXb6 z^-gvhn$?TND8qAL9Cm-|8}l=F9&hh%(_MHLw7U0}_Ulg`e4ooid!qujT~Yf^CX#7N zR!vJrc8zx17QT9>t1|z^{YU<6kM5ffzB)0n;4STdIeP-;>MPt{RM0Ihog@V$c2E;W zSMo=uBSj4J3u^rXI9_YD;14o~&33OPI9n_pNf^>k=>gz3v#dnWV#IT*WYke)Phjj@b_tk+9}uX zL8;r2?Sg7r_i8SeH!Whm!btd>7>k4(V_GB}j%c|PT@ zyewe;gVp}|Xe2^mQ@!4!lhgAak6a3dN&pb*zB0pM^fj~xW_2S}xk_bf!{FcP01pMG zomw-R->`5gBaQ=;zv-{qbg2uNF{MK@>%vtcoQ(dop4}F>btAsk55fqY*)?J#A2ak@LOHGsyo~+Cly!}1gnL$ z%c|D_{#A8_o#8$H`f@tmT&4tN%=<<1Y5|IxR{Q`1K84 z!LNfSUteFpyf%+tAz2ioegh(Z38A$`D1UnGAh{o(LvbjntsOxGLF{eJ9{vKf&p}3K zzVqYQRNrvs5DS+v7iiHm2P;}ko|#HzIj4mqk+4=gn#~P4%$SqBsx@YhG75(! zv@M%UD~V<^7=uu##IUSt;WfqA>~N;+cbW}rq{~-9s04G-TCJ0-MwG5g7r*73LS)l9 zQIiXk2j)Uh-KrMe9gFt)9bTDpW6b&d{-fP?)ujr-kiD%D8%Vmk6Un(!NDa6Y)?`XX zJ>`f6{Bcb2Rh>@1;tHstlGE8Vk?*$K0Zxo|u3cjPoVkQ1AOk_75f4Blpd%$HoZ$w+ z^Xbt)4HWbhz|dF-{y~Xaonu)xS?=`mE(^nr&BcQiZ-=KdY`4#xyW_rl`wl*Ey4Mja z`dJgt5Npt7CT#!W&GlRV=UHo|oFtZm-GiSSG$~ddr#l9_v-on;!I@pY>~vP(#{Ts2 z$HrJq4y|-|o;)~O_P5O6d#rTg*fnV$IK#&GOiiVCEcJ&*yG_wl!t73iI~2uuB1AA4 zfp8M|f_7ecl#`fCBnG=VoiEJzm2ZOPQ&;Zcs}L>F7}`NSKE%X&XkXUdo~|j?j)qID zURP)7q6sl{sp+u;1Oqhm1LFkiEW~iyP+R?L-@ZI?%{Oit8|Yyrkzt$(C$TuES8nN< zc5D`<{lVd$7J(mIJX>(J zq&(jlTg{dCb%hzGcJeF7mtL6V1v8(YJ9=9Q`3_@ z2|}{jY{e&*x=Tv5no3mT)oyPx@0D3%@#xr0eeey60bm3BR=Sp$*FJb0uo+#uD7KTI zq0iDaLsfI?F%h5uc))fK(AvU>X$9U;=<2K<6o<%0U{E$(uD-i8JkLfv0kBbZ*- zLYNkzzQ2)k7E&HE+SYOJSN~+}$e-RahVe+JU}x2sS2SDqUH_T-}dR+(M(d*z4hJbn~f5Z2S0hRJ6(w8zT}Zm z%rIsd;&-c6;dpPZo{jCBn&?h=5;;e6MRE9pus@Y$*`Et*xrn4D$C9CeAjfiJ_jhZ> z<~VPXBIWR|xRdv_XS8@wiEH)Hq+)e>@1p-7#bkS50_%)j56YmhMNf>$4Ug zA*JE*U~ITOjsun9$=RH%DH+$2^GnAw?xs}C###VERuEucQ|_&6s^8-fMIUB;ZTtHT zZja9Q=QQ3GjBBx>o}%h%^|!BHJD=9lse~HZHPV((HG5?qsG0EYTFn)wx*~+MFF$DT zUFH+B^T$g=M>@UN%!*z~w5b-3_hjqM(Y_BO5$Oc!=+kopm*#dUgn8%CILi&4y8X+Sh7Mjj)9Z}uwvga> zo@M)weX@SbU$0opr6lZ~qe(3>v%Awo%vQVEl4)s4xdl%kqMBp}4P1f>D-jWbX}983 zc%oEnEGugmS!ert&Mr)Lh6_jUTPzLF`A50FeThj=}j-3IZisy>ZI0-EbbYRd01!F`A_JMzH9&XfHiPpZXb ziX@_Di(6C70`VSs^@o48h`+4mo6{DS2aH~SW%s~bcL2EKD(~%{y%)Us%U~|Q$sIr= z2-V6|#WL`M9stnQ2}B@mbR(ELj2` zJ47q)Q?GpgXMd2LNbx);@aIIav=DUDQ>EG0o`0y+a&Bo9&e?)dS;BIloN|>qOEji> zdF>e02K+#HBc_tpmO#rVA@Y?;Cu#x`=;s7_=)@WF!)(^sS{qfjj`3N}?k~pS#LHwc z*+veYXv_qRFxNVCpmA_ivvIb;tY{}0n>{cvHlDKOa%pODtrA=6Dq%Q3P$iSCHj|By zQHh>}XbwgOiJ}`4H9<^=*WtVrTNsJ%4{B}TNc3Y2DuQujrwgh3s;e@RUtwQ!Cmdd~ zti*VNGLJb;5iHefhBFuk(^|P!b8DesD5!b6JF7pI$L3CCiHYSn#^qB47nd53+vLKh z?)=hV?LR1X%DzcweBd`OgKMSyp*^0>}|AJVY3{vdUx*G<>xic%5nHvDV_AP zNAJqVGcExnIxtb_P1_*BD1MLHQY~u=mGGIh6)FWtnB2gzbM1PNj_$KKZU(`20#3Fl zLpP2Mfv3hcOW)%Iv$yTBu3;obboe*Sk2&afGFWm&oxzzNEfS4Jv}nDW6dipb-r|N+ z9$SzbGqDy=xtLKr@t|LwfAt4HXha6OTQ#o}B;{bi{d@e-=2oi*L|T6y&c6Q_X`l>b zbh(UZeS>nfN+$;EvcWla8VK)gNxDSEA;<4{>2LpO?Pih6ApMLw(r~9p}btng% zJ0KF-Ke%%usdaXhM0X;f!6bGTF>7)}JiOL%C>tLKte#(M(6Iq4;5&_m$n9&#L8k8^ z#3THF=xz&S`u(uR<)G$JKQ{-9r%!AFSL^yAlkN_TlXiMcqG#D(u&M%)npNU!BcpD~ zY7JV6NW50w9!R>Ky@Pc}WbX8Z&O<-{$xEXmgzbvoDb^l&`A64`%?EkK%oCzGTvD*F zukO!v;m0J|Y=Hv_VrbT!=D^?9ckEbz8WpSn~_+cvIX>q;SN$ zx7}>PX4#g@XH}6EG{sG~0P8P+;(x{6MEANBe-~`O1>OntpdksDBh+vi3qPGA^r)Q4 z5s8hC@OH^<_WRvJI1|3%;y1s3Pi0)DM;!9_)6YG5@wAU)N@d;?*%Vkx}Jp(7h!Hp%#eJgff_W zT?_?-A#rSFZ-;&S)t~+R*}GCFcq#;cruov#zxdJ9bxGw#aDCZ<`G;Y=U}ZGZ(x3B~ z2_4+zOm*i(7sje3)m!iZA6{9zhmH<>Xg2u3^sQYqq!RAKkDz@BMX3vfXm;D=Z$YFx z!nz(qV8I0|X)_Jdf_I=yqI-11DGF2m=9!%x*218BVApsgdhNOEBKux_^_js5LxVj} zKlk*WY)_@x2LxalIj)t@E+6#6`L7A~fpY77x69iKw36cWy)Ay&zXvO0x!YyV>`S}T zIg-g|+aeaKrUlkvAX!aGCSsAZyI}X8-q|X_0+GVK{$PkDU3W-kvs^z2Cy3o8(Dpg- z`IsBf83CuVS5J>Nw?Hr(x36zZ+Z{AcMZUZuG-PDuBo=L%0LFrx0<_>%%mn%AqqjL zNd64j36Cs#4hl9t>{dR6p1>Tw8$WM{MLl$ScB8>P=muS>r+`^+ixs`)ANOLAGhNq#~83rm;f(=Zm5 z0j_sH)5;%JyZ;e+MO}a&tDpKlO~CUv?`7W?oNt*1A!~v&2>rvt9lr**-u1iq56}+g zzoC9^9~z_=oN25<&8=|xXV#i^g514+nZ1m<>4o1}zf4Bg zpT_^icya{o)UW@HrZ~97JJ6`9f+pC%LnG|lXpFV2zf3Q(u>K^y@WJ(G;JQSPtUp69 ze1822uCo3-z4)&6@3EQn7r58gU!j*!TYrW99xwoOHqF03iI7WuFZ=(#=zMDnZxCDm z6cNK6!}rkdUbqK2IOD)!_L5_WtnZN6XgVeD{ra zfAH>0@4oo%v+p+j?jQA@py5Y80y;!TVd0AkCIWRv8lyJI8EJwPX8%T-L37OFMw;E$ zhC?3awT*Hf6`B8lrqM}s9Q0X)Zz-1GIuHAdQ}A~al%3PdPDA}7Fc2Ku-OdZ+T7gf>Ro$HC@BpvN*QLX1#^9%+7;F3l38Mqtd7dat7}(i#1I+Ar;M zFFaSF{xqZ~^%^P@)q}n{2(4FOOsc~Lh>k39Ubh2m=>VKTbwYgyd<)wS7QYQft-!N= zLxMcW(F*yZE=fN~PPID+f6LG#9cu!f1$dTF72Yg@#j1h)v^P3NKa6+^YOiWaWu>T6 zd{)toa9`Blr*mYWvx(;>TIZpLB7YXzQ{3o#=k>We1GDh2fe%HUBDu*3%9GPD_IY?N z=(11^40#p-cZ$iPj?fCUqAWWBmocZGfE3k$&J%rqQyV%DvJx1X-molifaRE zjS+5yG{x{=OWOi4Yy^!0gC>C|5j3OANLRvXkmwkc?1MX%?kvftJM!RhV1sn zM(tMP*5Zd6Lw0*(qqf2lFTQBQE(FXPp>0CK_^UdYbhk!4)Zf2qX z?OlT6+q0m{KiA*(GI-z)jY9Rq) zCkB3dWref`ejXza{1N0sA-G52kHGgoF(^;KA4VyZhIOhf9Js`w?!e zHWpxP8iv817<#6)1Tn{MSUravD~;9bP+;Y{mFr+7Q&|LPi{QS|3f|*DDw;Dvk1qIC zNC5ZYTk$`U6hxSp$aA{n7~aC6U48OW*=b3^^yzQ#v7vJ;b&nS3>Y#{!vk(I zq!pwBej2hv-)YDP0E;G&qzZPh53J@08V9>Mi{_x`rMdoX8e~-3Ahu~d0e>w{IvMyB!MyDloo}dm7LqD8e z0!ZQ8b)??Yu^=$JK0uz=XPKup%ym>-JWOWwawuWPsT}wn{2#aVqU(>Ig;^ocvmf|D zc_e|h1<;cA2ygOzx_&8g`&P+g3`Dggh2PmMVXosK7R0YzZNqd>jqx0M@9KEym%7wL z8=6IQ%{E3MZ*zYR`8UZ+SCK%E>FphWJY`%0W|*??F}NrX0B`us;%l2SfWe1(K>rnF zV}NTqmM{_n+91#d0g{w64E)KUE9MW&iqrXOEG4p4^@%DoV< zfXYMH8SRfU-q@|cx2gK7dsFY>*XuunT2bdGMz;YH7&q&){$>0Ly#-xkDe$x(U1Rh& zSOjpO>zvaqK;*>o=?2nm8>*gKUTUDumE()c;HhED0PW}+GgcmzjLJ_xl+kq68TwcO zfi|=gVwgu@Cf>t0;vW+$IYiErhsg`%C**J7ErWvuG^8l0!2hdd5h$~OeiVbvb~2Qi zK|{(_iY#40)CLh4H3WGWnFQc>RbSB87=pG&nF!wbJp8)E1#M|5?T>1_Id60<7f3+s zS)JW<1XgFbF&15!F&N8uL+=&;657yOMCT4#oAs4j&|7gJc>h_1Z(Y5%$}U0~T!{YCaibmOBmOkx;ki`?sNhq^rI%5Cs3oCjP%KlZ4o|=X&%$h7 zKo{^3z3V+F8#Q&1c@E9tEVV1pcC(!Fegtb^b&S$YgaaGzfqjE0iq@$cCDd0qUCgFg|)Mp3T~yS7cpjo>PPM5)t>Hz_vuPuQ3P56 zCi)+hMgt_WU{`Wr%`;%tsfFKspUx%q5A Date: Tue, 2 Oct 2018 14:45:09 +0200 Subject: [PATCH 18/30] Minor --- src/hb-ot-map.hh | 1 + src/hb-ot-shape.cc | 37 +++++++++++++++++-------------------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index cc8b8d842..16a0c4778 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -175,6 +175,7 @@ enum hb_ot_map_feature_flags_t F_MANUAL_ZWJ = 0x0008u, /* Don't skip over ZWJ when matching **input**. */ F_MANUAL_JOINERS = F_MANUAL_ZWNJ | F_MANUAL_ZWJ, F_GLOBAL_MANUAL_JOINERS= F_GLOBAL | F_MANUAL_JOINERS, + F_GLOBAL_HAS_FALLBACK = F_GLOBAL | F_HAS_FALLBACK, F_GLOBAL_SEARCH = 0x0010u, /* If feature not found in LangSys, look for it in global feature list and pick one. */ F_RANDOM = 0x0020u /* Randomly select a glyph from an AlternateSubstFormat1 subtable. */ }; diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 9c941a3b7..34434efe1 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -70,24 +70,26 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, } -static hb_tag_t common_features[] = +static const hb_ot_map_feature_t +common_features[] = { - HB_TAG('c','c','m','p'), - HB_TAG('l','o','c','l'), - HB_TAG('m','a','r','k'), - HB_TAG('m','k','m','k'), - HB_TAG('r','l','i','g'), + {HB_TAG('c','c','m','p'), F_GLOBAL}, + {HB_TAG('l','o','c','l'), F_GLOBAL}, + {HB_TAG('m','a','r','k'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('m','k','m','k'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('r','l','i','g'), F_GLOBAL}, }; -static hb_tag_t horizontal_features[] = +static const hb_ot_map_feature_t +horizontal_features[] = { - HB_TAG('c','a','l','t'), - HB_TAG('c','l','i','g'), - HB_TAG('c','u','r','s'), - HB_TAG('k','e','r','n'), - HB_TAG('l','i','g','a'), - HB_TAG('r','c','l','t'), + {HB_TAG('c','a','l','t'), F_GLOBAL}, + {HB_TAG('c','l','i','g'), F_GLOBAL}, + {HB_TAG('c','u','r','s'), F_GLOBAL}, + {HB_TAG('k','e','r','n'), F_GLOBAL_HAS_FALLBACK}, + {HB_TAG('l','i','g','a'), F_GLOBAL}, + {HB_TAG('r','c','l','t'), F_GLOBAL}, }; static void @@ -129,16 +131,11 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, planner->shaper->collect_features (planner); for (unsigned int i = 0; i < ARRAY_LENGTH (common_features); i++) - map->add_feature (common_features[i], F_GLOBAL | - (common_features[i] == HB_TAG('m','a','r','k') || - common_features[i] == HB_TAG('m','k','m','k') ? - F_MANUAL_JOINERS : F_NONE)); + map->add_feature (common_features[i]); if (HB_DIRECTION_IS_HORIZONTAL (props->direction)) for (unsigned int i = 0; i < ARRAY_LENGTH (horizontal_features); i++) - map->add_feature (horizontal_features[i], F_GLOBAL | - (horizontal_features[i] == HB_TAG('k','e','r','n') ? - F_HAS_FALLBACK : F_NONE)); + map->add_feature (horizontal_features[i]); else { /* We really want to find a 'vert' feature if there's any in the font, no From 0a371fee4d22ed63207aa76c00b05b75bbc95f5f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 14:48:39 +0200 Subject: [PATCH 19/30] Minor --- src/hb-ot-map.hh | 6 ++++-- src/hb-ot-shape-complex-arabic.cc | 6 +++--- src/hb-ot-shape-complex-myanmar.cc | 4 ++-- src/hb-ot-shape-complex-use.cc | 8 ++++---- src/hb-ot-shape.cc | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index 16a0c4778..40b9921fd 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -205,8 +205,10 @@ struct hb_ot_map_builder_t inline void add_feature (const hb_ot_map_feature_t &feat) { add_feature (feat.tag, feat.flags); } - inline void enable_feature (hb_tag_t tag) - { add_feature (tag, F_GLOBAL); } + inline void enable_feature (hb_tag_t tag, + hb_ot_map_feature_flags_t flags=F_NONE, + unsigned int value=1) + { add_feature (tag, F_GLOBAL | flags, value); } inline void disable_feature (hb_tag_t tag) { add_feature (tag, F_GLOBAL, 0); } diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 9893a22fb..2cdd7ba8a 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -215,14 +215,14 @@ collect_features_arabic (hb_ot_shape_planner_t *plan) * however, it says a ZWJ should also mean "don't ligate". So we run * the main ligating features as MANUAL_ZWJ. */ - map->add_feature (HB_TAG('r','l','i','g'), F_GLOBAL | F_MANUAL_ZWJ | F_HAS_FALLBACK); + map->enable_feature (HB_TAG('r','l','i','g'), F_MANUAL_ZWJ | F_HAS_FALLBACK); if (plan->props.script == HB_SCRIPT_ARABIC) map->add_gsub_pause (arabic_fallback_shape); /* No pause after rclt. See 98460779bae19e4d64d29461ff154b3527bf8420. */ - map->add_feature (HB_TAG('r','c','l','t'), F_GLOBAL | F_MANUAL_ZWJ); - map->add_feature (HB_TAG('c','a','l','t'), F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (HB_TAG('r','c','l','t'), F_MANUAL_ZWJ); + map->enable_feature (HB_TAG('c','a','l','t'), F_MANUAL_ZWJ); map->add_gsub_pause (nullptr); /* And undo here. */ diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index b0ca3c74a..bebb8ec52 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -106,14 +106,14 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan) for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) { - map->add_feature (basic_features[i], F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (basic_features[i], F_MANUAL_ZWJ); map->add_gsub_pause (nullptr); } map->add_gsub_pause (final_reordering); for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) - map->add_feature (other_features[i], F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (other_features[i], F_MANUAL_ZWJ); for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++) map->enable_feature (positioning_features[i]); diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index bdcad409d..f9a580ca2 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc @@ -132,19 +132,19 @@ collect_features_use (hb_ot_shape_planner_t *plan) map->enable_feature (HB_TAG('l','o','c','l')); map->enable_feature (HB_TAG('c','c','m','p')); map->enable_feature (HB_TAG('n','u','k','t')); - map->add_feature (HB_TAG('a','k','h','n'), F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (HB_TAG('a','k','h','n'), F_MANUAL_ZWJ); /* "Reordering group" */ map->add_gsub_pause (clear_substitution_flags); map->add_feature (HB_TAG('r','p','h','f'), F_MANUAL_ZWJ); map->add_gsub_pause (record_rphf); map->add_gsub_pause (clear_substitution_flags); - map->add_feature (HB_TAG('p','r','e','f'), F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (HB_TAG('p','r','e','f'), F_MANUAL_ZWJ); map->add_gsub_pause (record_pref); /* "Orthographic unit shaping group" */ for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) - map->add_feature (basic_features[i], F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (basic_features[i], F_MANUAL_ZWJ); map->add_gsub_pause (reorder); @@ -155,7 +155,7 @@ collect_features_use (hb_ot_shape_planner_t *plan) /* "Standard typographic presentation" */ for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) - map->add_feature (other_features[i], F_GLOBAL | F_MANUAL_ZWJ); + map->enable_feature (other_features[i], F_MANUAL_ZWJ); /* "Positional feature application" */ for (unsigned int i = 0; i < ARRAY_LENGTH (positioning_features); i++) diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 34434efe1..dc88fa9b4 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -125,7 +125,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, map->add_feature (HB_TAG ('d','n','o','m')); /* Random! */ - map->add_feature (HB_TAG ('r','a','n','d'), F_GLOBAL | F_RANDOM, HB_OT_MAP_MAX_VALUE); + map->enable_feature (HB_TAG ('r','a','n','d'), F_RANDOM, HB_OT_MAP_MAX_VALUE); if (planner->shaper->collect_features) planner->shaper->collect_features (planner); @@ -142,7 +142,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, * matter which script/langsys it is listed (or not) under. * See various bugs referenced from: * https://github.com/harfbuzz/harfbuzz/issues/63 */ - map->add_feature (HB_TAG ('v','e','r','t'), F_GLOBAL | F_GLOBAL_SEARCH); + map->enable_feature (HB_TAG ('v','e','r','t'), F_GLOBAL_SEARCH); } if (planner->shaper->override_features) From 3cca978723db43233d25402254d297dfccf991a3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 15:02:16 +0200 Subject: [PATCH 20/30] Move code around --- src/hb-ot-layout-gsub-table.hh | 3 --- src/hb-ot-layout-gsubgpos.hh | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 7e36e0639..b664f15a6 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -762,7 +762,6 @@ struct Ligature return_trace (true); } - bool is_mark_ligature = false; unsigned int total_component_count = 0; unsigned int match_length = 0; @@ -774,7 +773,6 @@ struct Ligature nullptr, &match_length, match_positions, - &is_mark_ligature, &total_component_count))) return_trace (false); @@ -783,7 +781,6 @@ struct Ligature match_positions, match_length, ligGlyph, - is_mark_ligature, total_component_count); return_trace (true); diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 5dd4c3da1..da023eab8 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -731,7 +731,6 @@ static inline bool match_input (hb_ot_apply_context_t *c, const void *match_data, unsigned int *end_offset, unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], - bool *p_is_mark_ligature = nullptr, unsigned int *p_total_component_count = nullptr) { TRACE_APPLY (nullptr); @@ -768,8 +767,6 @@ static inline bool match_input (hb_ot_apply_context_t *c, * https://github.com/harfbuzz/harfbuzz/issues/545 */ - bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->cur()); - unsigned int total_component_count = 0; total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->cur()); @@ -836,15 +833,11 @@ static inline bool match_input (hb_ot_apply_context_t *c, return_trace (false); } - is_mark_ligature = is_mark_ligature && _hb_glyph_info_is_mark (&buffer->info[skippy_iter.idx]); total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->info[skippy_iter.idx]); } *end_offset = skippy_iter.idx - buffer->idx + 1; - if (p_is_mark_ligature) - *p_is_mark_ligature = is_mark_ligature; - if (p_total_component_count) *p_total_component_count = total_component_count; @@ -855,7 +848,6 @@ static inline bool ligate_input (hb_ot_apply_context_t *c, unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */ unsigned int match_length, hb_codepoint_t lig_glyph, - bool is_mark_ligature, unsigned int total_component_count) { TRACE_APPLY (nullptr); @@ -864,11 +856,11 @@ static inline bool ligate_input (hb_ot_apply_context_t *c, buffer->merge_clusters (buffer->idx, buffer->idx + match_length); - /* - * - If it *is* a mark ligature, we don't allocate a new ligature id, and leave + /* - If all components of the ligature were marks, we call this a mark ligature. + * If it *is* a mark ligature, we don't allocate a new ligature id, and leave * the ligature to keep its old ligature id. This will allow it to attach to * a base ligature in GPOS. Eg. if the sequence is: LAM,LAM,SHADDA,FATHA,HEH, - * and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA wit a + * and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA with a * ligature id and component value of 2. Then if SHADDA,FATHA form a ligature * later, we don't want them to lose their ligature id/component, otherwise * GPOS will fail to correctly position the mark ligature on top of the @@ -892,6 +884,14 @@ static inline bool ligate_input (hb_ot_apply_context_t *c, * https://bugzilla.gnome.org/show_bug.cgi?id=437633 */ + bool is_mark_ligature = true; + for (unsigned int i = 0; i < count; i++) + if (!_hb_glyph_info_is_mark (&buffer->info[match_positions[i]])) + { + is_mark_ligature = false; + break; + } + unsigned int klass = is_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE; unsigned int lig_id = is_mark_ligature ? 0 : _hb_allocate_lig_id (buffer); unsigned int last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur()); From 9efddb9de821fc909a3ea8354f3dfd39c823e97b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 16:05:26 +0200 Subject: [PATCH 21/30] Treat a base+mark... ligature as base, not ligature Fixes https://github.com/harfbuzz/harfbuzz/issues/746 --- src/hb-ot-layout-gsubgpos.hh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index da023eab8..bdaf35a95 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -856,7 +856,11 @@ static inline bool ligate_input (hb_ot_apply_context_t *c, buffer->merge_clusters (buffer->idx, buffer->idx + match_length); - /* - If all components of the ligature were marks, we call this a mark ligature. + /* - If a base and one or more marks ligate, consider that as a base, NOT + * ligature, such that all following marks can still attach to it. + * https://github.com/harfbuzz/harfbuzz/issues/1109 + * + * - If all components of the ligature were marks, we call this a mark ligature. * If it *is* a mark ligature, we don't allocate a new ligature id, and leave * the ligature to keep its old ligature id. This will allow it to attach to * a base ligature in GPOS. Eg. if the sequence is: LAM,LAM,SHADDA,FATHA,HEH, @@ -884,21 +888,24 @@ static inline bool ligate_input (hb_ot_apply_context_t *c, * https://bugzilla.gnome.org/show_bug.cgi?id=437633 */ - bool is_mark_ligature = true; - for (unsigned int i = 0; i < count; i++) + bool is_base_ligature = _hb_glyph_info_is_base_glyph (&buffer->info[match_positions[0]]); + bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->info[match_positions[0]]); + for (unsigned int i = 1; i < count; i++) if (!_hb_glyph_info_is_mark (&buffer->info[match_positions[i]])) { + is_base_ligature = false; is_mark_ligature = false; break; } + bool is_ligature = !is_base_ligature && !is_mark_ligature; - unsigned int klass = is_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE; - unsigned int lig_id = is_mark_ligature ? 0 : _hb_allocate_lig_id (buffer); + unsigned int klass = is_ligature ? HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE : 0; + unsigned int lig_id = is_ligature ? _hb_allocate_lig_id (buffer) : 0; unsigned int last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur()); unsigned int last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur()); unsigned int components_so_far = last_num_components; - if (!is_mark_ligature) + if (is_ligature) { _hb_glyph_info_set_lig_props_for_ligature (&buffer->cur(), lig_id, total_component_count); if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) @@ -912,7 +919,8 @@ static inline bool ligate_input (hb_ot_apply_context_t *c, { while (buffer->idx < match_positions[i] && buffer->successful) { - if (!is_mark_ligature) { + if (is_ligature) + { unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur()); if (this_comp == 0) this_comp = last_num_components; From 40d5d19d5b875eef526a2a66892c3f638f633fa3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 17:04:05 +0200 Subject: [PATCH 22/30] [ragel] Use ts/te (token-start / token-end) instead of manual tracking --- src/hb-ot-shape-complex-indic-machine.hh | 22 ++++++++++------------ src/hb-ot-shape-complex-indic-machine.rl | 8 +++----- src/hb-ot-shape-complex-khmer-machine.hh | 22 ++++++++++------------ src/hb-ot-shape-complex-khmer-machine.rl | 8 +++----- src/hb-ot-shape-complex-myanmar-machine.hh | 22 ++++++++++------------ src/hb-ot-shape-complex-myanmar-machine.rl | 8 +++----- src/hb-ot-shape-complex-use-machine.hh | 22 ++++++++++------------ src/hb-ot-shape-complex-use-machine.rl | 8 +++----- 8 files changed, 52 insertions(+), 68 deletions(-) diff --git a/src/hb-ot-shape-complex-indic-machine.hh b/src/hb-ot-shape-complex-indic-machine.hh index 6a19bfb3e..85db4df55 100644 --- a/src/hb-ot-shape-complex-indic-machine.hh +++ b/src/hb-ot-shape-complex-indic-machine.hh @@ -916,10 +916,9 @@ static const int indic_syllable_machine_en_main = 138; #define found_syllable(syllable_type) \ HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ - for (unsigned int i = last; i < p+1; i++) \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - last = p+1; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END @@ -927,11 +926,11 @@ static const int indic_syllable_machine_en_main = 138; static void find_syllables (hb_buffer_t *buffer) { - unsigned int p, pe, eof, ts HB_UNUSED, te, act; + unsigned int p, pe, eof, ts, te, act; int cs; hb_glyph_info_t *info = buffer->info; -#line 935 "hb-ot-shape-complex-indic-machine.hh" +#line 934 "hb-ot-shape-complex-indic-machine.hh" { cs = indic_syllable_machine_start; ts = 0; @@ -939,16 +938,15 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 111 "hb-ot-shape-complex-indic-machine.rl" +#line 110 "hb-ot-shape-complex-indic-machine.rl" p = 0; pe = eof = buffer->len; - unsigned int last = 0; unsigned int syllable_serial = 1; -#line 952 "hb-ot-shape-complex-indic-machine.hh" +#line 950 "hb-ot-shape-complex-indic-machine.hh" { int _slen; int _trans; @@ -962,7 +960,7 @@ _resume: #line 1 "NONE" {ts = p;} break; -#line 966 "hb-ot-shape-complex-indic-machine.hh" +#line 964 "hb-ot-shape-complex-indic-machine.hh" } _keys = _indic_syllable_machine_trans_keys + (cs<<1); @@ -1085,7 +1083,7 @@ _eof_trans: #line 86 "hb-ot-shape-complex-indic-machine.rl" {act = 6;} break; -#line 1089 "hb-ot-shape-complex-indic-machine.hh" +#line 1087 "hb-ot-shape-complex-indic-machine.hh" } _again: @@ -1094,7 +1092,7 @@ _again: #line 1 "NONE" {ts = 0;} break; -#line 1098 "hb-ot-shape-complex-indic-machine.hh" +#line 1096 "hb-ot-shape-complex-indic-machine.hh" } if ( ++p != pe ) @@ -1110,7 +1108,7 @@ _again: } -#line 120 "hb-ot-shape-complex-indic-machine.rl" +#line 118 "hb-ot-shape-complex-indic-machine.rl" } diff --git a/src/hb-ot-shape-complex-indic-machine.rl b/src/hb-ot-shape-complex-indic-machine.rl index 5c5fece33..bf5c1c8dc 100644 --- a/src/hb-ot-shape-complex-indic-machine.rl +++ b/src/hb-ot-shape-complex-indic-machine.rl @@ -91,10 +91,9 @@ main := |* #define found_syllable(syllable_type) \ HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ - for (unsigned int i = last; i < p+1; i++) \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - last = p+1; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END @@ -102,7 +101,7 @@ main := |* static void find_syllables (hb_buffer_t *buffer) { - unsigned int p, pe, eof, ts HB_UNUSED, te, act; + unsigned int p, pe, eof, ts, te, act; int cs; hb_glyph_info_t *info = buffer->info; %%{ @@ -113,7 +112,6 @@ find_syllables (hb_buffer_t *buffer) p = 0; pe = eof = buffer->len; - unsigned int last = 0; unsigned int syllable_serial = 1; %%{ write exec; diff --git a/src/hb-ot-shape-complex-khmer-machine.hh b/src/hb-ot-shape-complex-khmer-machine.hh index d013456bc..2bc8ca650 100644 --- a/src/hb-ot-shape-complex-khmer-machine.hh +++ b/src/hb-ot-shape-complex-khmer-machine.hh @@ -232,10 +232,9 @@ static const int khmer_syllable_machine_en_main = 22; #define found_syllable(syllable_type) \ HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ - for (unsigned int i = last; i < p+1; i++) \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - last = p+1; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END @@ -243,11 +242,11 @@ static const int khmer_syllable_machine_en_main = 22; static void find_syllables (hb_buffer_t *buffer) { - unsigned int p, pe, eof, ts HB_UNUSED, te, act HB_UNUSED; + unsigned int p, pe, eof, ts, te, act HB_UNUSED; int cs; hb_glyph_info_t *info = buffer->info; -#line 251 "hb-ot-shape-complex-khmer-machine.hh" +#line 250 "hb-ot-shape-complex-khmer-machine.hh" { cs = khmer_syllable_machine_start; ts = 0; @@ -255,16 +254,15 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 101 "hb-ot-shape-complex-khmer-machine.rl" +#line 100 "hb-ot-shape-complex-khmer-machine.rl" p = 0; pe = eof = buffer->len; - unsigned int last = 0; unsigned int syllable_serial = 1; -#line 268 "hb-ot-shape-complex-khmer-machine.hh" +#line 266 "hb-ot-shape-complex-khmer-machine.hh" { int _slen; int _trans; @@ -278,7 +276,7 @@ _resume: #line 1 "NONE" {ts = p;} break; -#line 282 "hb-ot-shape-complex-khmer-machine.hh" +#line 280 "hb-ot-shape-complex-khmer-machine.hh" } _keys = _khmer_syllable_machine_trans_keys + (cs<<1); @@ -348,7 +346,7 @@ _eof_trans: #line 76 "hb-ot-shape-complex-khmer-machine.rl" {act = 3;} break; -#line 352 "hb-ot-shape-complex-khmer-machine.hh" +#line 350 "hb-ot-shape-complex-khmer-machine.hh" } _again: @@ -357,7 +355,7 @@ _again: #line 1 "NONE" {ts = 0;} break; -#line 361 "hb-ot-shape-complex-khmer-machine.hh" +#line 359 "hb-ot-shape-complex-khmer-machine.hh" } if ( ++p != pe ) @@ -373,7 +371,7 @@ _again: } -#line 110 "hb-ot-shape-complex-khmer-machine.rl" +#line 108 "hb-ot-shape-complex-khmer-machine.rl" } diff --git a/src/hb-ot-shape-complex-khmer-machine.rl b/src/hb-ot-shape-complex-khmer-machine.rl index eb9f69886..4c596ab64 100644 --- a/src/hb-ot-shape-complex-khmer-machine.rl +++ b/src/hb-ot-shape-complex-khmer-machine.rl @@ -81,10 +81,9 @@ main := |* #define found_syllable(syllable_type) \ HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ - for (unsigned int i = last; i < p+1; i++) \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - last = p+1; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END @@ -92,7 +91,7 @@ main := |* static void find_syllables (hb_buffer_t *buffer) { - unsigned int p, pe, eof, ts HB_UNUSED, te, act HB_UNUSED; + unsigned int p, pe, eof, ts, te, act HB_UNUSED; int cs; hb_glyph_info_t *info = buffer->info; %%{ @@ -103,7 +102,6 @@ find_syllables (hb_buffer_t *buffer) p = 0; pe = eof = buffer->len; - unsigned int last = 0; unsigned int syllable_serial = 1; %%{ write exec; diff --git a/src/hb-ot-shape-complex-myanmar-machine.hh b/src/hb-ot-shape-complex-myanmar-machine.hh index 7fa235178..0c19e4f68 100644 --- a/src/hb-ot-shape-complex-myanmar-machine.hh +++ b/src/hb-ot-shape-complex-myanmar-machine.hh @@ -283,10 +283,9 @@ static const int myanmar_syllable_machine_en_main = 0; #define found_syllable(syllable_type) \ HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ - for (unsigned int i = last; i < p+1; i++) \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - last = p+1; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END @@ -294,11 +293,11 @@ static const int myanmar_syllable_machine_en_main = 0; static void find_syllables (hb_buffer_t *buffer) { - unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; + unsigned int p, pe, eof, ts, te, act HB_UNUSED; int cs; hb_glyph_info_t *info = buffer->info; -#line 302 "hb-ot-shape-complex-myanmar-machine.hh" +#line 301 "hb-ot-shape-complex-myanmar-machine.hh" { cs = myanmar_syllable_machine_start; ts = 0; @@ -306,16 +305,15 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 115 "hb-ot-shape-complex-myanmar-machine.rl" +#line 114 "hb-ot-shape-complex-myanmar-machine.rl" p = 0; pe = eof = buffer->len; - unsigned int last = 0; unsigned int syllable_serial = 1; -#line 319 "hb-ot-shape-complex-myanmar-machine.hh" +#line 317 "hb-ot-shape-complex-myanmar-machine.hh" { int _slen; int _trans; @@ -329,7 +327,7 @@ _resume: #line 1 "NONE" {ts = p;} break; -#line 333 "hb-ot-shape-complex-myanmar-machine.hh" +#line 331 "hb-ot-shape-complex-myanmar-machine.hh" } _keys = _myanmar_syllable_machine_trans_keys + (cs<<1); @@ -379,7 +377,7 @@ _eof_trans: #line 90 "hb-ot-shape-complex-myanmar-machine.rl" {te = p;p--;{ found_syllable (non_myanmar_cluster); }} break; -#line 383 "hb-ot-shape-complex-myanmar-machine.hh" +#line 381 "hb-ot-shape-complex-myanmar-machine.hh" } _again: @@ -388,7 +386,7 @@ _again: #line 1 "NONE" {ts = 0;} break; -#line 392 "hb-ot-shape-complex-myanmar-machine.hh" +#line 390 "hb-ot-shape-complex-myanmar-machine.hh" } if ( ++p != pe ) @@ -404,7 +402,7 @@ _again: } -#line 124 "hb-ot-shape-complex-myanmar-machine.rl" +#line 122 "hb-ot-shape-complex-myanmar-machine.rl" } diff --git a/src/hb-ot-shape-complex-myanmar-machine.rl b/src/hb-ot-shape-complex-myanmar-machine.rl index 62f51d1e9..7845a86d4 100644 --- a/src/hb-ot-shape-complex-myanmar-machine.rl +++ b/src/hb-ot-shape-complex-myanmar-machine.rl @@ -95,10 +95,9 @@ main := |* #define found_syllable(syllable_type) \ HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ - for (unsigned int i = last; i < p+1; i++) \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - last = p+1; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END @@ -106,7 +105,7 @@ main := |* static void find_syllables (hb_buffer_t *buffer) { - unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; + unsigned int p, pe, eof, ts, te, act HB_UNUSED; int cs; hb_glyph_info_t *info = buffer->info; %%{ @@ -117,7 +116,6 @@ find_syllables (hb_buffer_t *buffer) p = 0; pe = eof = buffer->len; - unsigned int last = 0; unsigned int syllable_serial = 1; %%{ write exec; diff --git a/src/hb-ot-shape-complex-use-machine.hh b/src/hb-ot-shape-complex-use-machine.hh index 77ca3aeb5..ba6c9bf13 100644 --- a/src/hb-ot-shape-complex-use-machine.hh +++ b/src/hb-ot-shape-complex-use-machine.hh @@ -320,10 +320,9 @@ static const int use_syllable_machine_en_main = 4; #define found_syllable(syllable_type) \ HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ - for (unsigned int i = last; i < p+1; i++) \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - last = p+1; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END @@ -331,11 +330,11 @@ static const int use_syllable_machine_en_main = 4; static void find_syllables (hb_buffer_t *buffer) { - unsigned int p, pe, eof, ts HB_UNUSED, te, act; + unsigned int p, pe, eof, ts, te, act; int cs; hb_glyph_info_t *info = buffer->info; -#line 339 "hb-ot-shape-complex-use-machine.hh" +#line 338 "hb-ot-shape-complex-use-machine.hh" { cs = use_syllable_machine_start; ts = 0; @@ -343,16 +342,15 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 162 "hb-ot-shape-complex-use-machine.rl" +#line 161 "hb-ot-shape-complex-use-machine.rl" p = 0; pe = eof = buffer->len; - unsigned int last = 0; unsigned int syllable_serial = 1; -#line 356 "hb-ot-shape-complex-use-machine.hh" +#line 354 "hb-ot-shape-complex-use-machine.hh" { int _slen; int _trans; @@ -366,7 +364,7 @@ _resume: #line 1 "NONE" {ts = p;} break; -#line 370 "hb-ot-shape-complex-use-machine.hh" +#line 368 "hb-ot-shape-complex-use-machine.hh" } _keys = _use_syllable_machine_trans_keys + (cs<<1); @@ -468,7 +466,7 @@ _eof_trans: #line 137 "hb-ot-shape-complex-use-machine.rl" {act = 8;} break; -#line 472 "hb-ot-shape-complex-use-machine.hh" +#line 470 "hb-ot-shape-complex-use-machine.hh" } _again: @@ -477,7 +475,7 @@ _again: #line 1 "NONE" {ts = 0;} break; -#line 481 "hb-ot-shape-complex-use-machine.hh" +#line 479 "hb-ot-shape-complex-use-machine.hh" } if ( ++p != pe ) @@ -493,7 +491,7 @@ _again: } -#line 171 "hb-ot-shape-complex-use-machine.rl" +#line 169 "hb-ot-shape-complex-use-machine.rl" } diff --git a/src/hb-ot-shape-complex-use-machine.rl b/src/hb-ot-shape-complex-use-machine.rl index a233b1200..df50a3e35 100644 --- a/src/hb-ot-shape-complex-use-machine.rl +++ b/src/hb-ot-shape-complex-use-machine.rl @@ -142,10 +142,9 @@ main := |* #define found_syllable(syllable_type) \ HB_STMT_START { \ - if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ - for (unsigned int i = last; i < p+1; i++) \ + if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ + for (unsigned int i = ts; i < te; i++) \ info[i].syllable() = (syllable_serial << 4) | syllable_type; \ - last = p+1; \ syllable_serial++; \ if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ } HB_STMT_END @@ -153,7 +152,7 @@ main := |* static void find_syllables (hb_buffer_t *buffer) { - unsigned int p, pe, eof, ts HB_UNUSED, te, act; + unsigned int p, pe, eof, ts, te, act; int cs; hb_glyph_info_t *info = buffer->info; %%{ @@ -164,7 +163,6 @@ find_syllables (hb_buffer_t *buffer) p = 0; pe = eof = buffer->len; - unsigned int last = 0; unsigned int syllable_serial = 1; %%{ write exec; From d992982d23ef0c39ea42595ed0e8a4752977d1a5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 17:16:01 +0200 Subject: [PATCH 23/30] [indic] Add some confusable sequences from Unicode Standard --- .../script-bengali/bengali-vowel-leters.txt | 3 ++ .../devanagari-atomic-consonants.txt | 33 +++++++++++++++++++ .../devanagari-vowel-letters.txt | 17 ++++++++++ .../script-gujarati/gujarati-vowel-letter.txt | 8 +++++ .../gurmukhi-vowel-letters.txt | 9 +++++ .../script-kannada/kannada-vowel-letters.txt | 3 ++ .../malayalam-vowel-letters.txt | 5 +++ .../script-oriya/oriya-vowel-letters.txt | 3 ++ .../script-telugu/telugu-vowel-letters.txt | 5 +++ 9 files changed, 86 insertions(+) create mode 100644 test/shaping/texts/in-house/shaper-indic/script-bengali/bengali-vowel-leters.txt create mode 100644 test/shaping/texts/in-house/shaper-indic/script-devanagari/devanagari-atomic-consonants.txt create mode 100644 test/shaping/texts/in-house/shaper-indic/script-devanagari/devanagari-vowel-letters.txt create mode 100644 test/shaping/texts/in-house/shaper-indic/script-gujarati/gujarati-vowel-letter.txt create mode 100644 test/shaping/texts/in-house/shaper-indic/script-gurmukhi/gurmukhi-vowel-letters.txt create mode 100644 test/shaping/texts/in-house/shaper-indic/script-kannada/kannada-vowel-letters.txt create mode 100644 test/shaping/texts/in-house/shaper-indic/script-malayalam/malayalam-vowel-letters.txt create mode 100644 test/shaping/texts/in-house/shaper-indic/script-oriya/oriya-vowel-letters.txt create mode 100644 test/shaping/texts/in-house/shaper-indic/script-telugu/telugu-vowel-letters.txt diff --git a/test/shaping/texts/in-house/shaper-indic/script-bengali/bengali-vowel-leters.txt b/test/shaping/texts/in-house/shaper-indic/script-bengali/bengali-vowel-leters.txt new file mode 100644 index 000000000..f09dbc8f5 --- /dev/null +++ b/test/shaping/texts/in-house/shaper-indic/script-bengali/bengali-vowel-leters.txt @@ -0,0 +1,3 @@ +আ অা +ৠ ঋৃ +ৡ ঌৢ diff --git a/test/shaping/texts/in-house/shaper-indic/script-devanagari/devanagari-atomic-consonants.txt b/test/shaping/texts/in-house/shaper-indic/script-devanagari/devanagari-atomic-consonants.txt new file mode 100644 index 000000000..426543658 --- /dev/null +++ b/test/shaping/texts/in-house/shaper-indic/script-devanagari/devanagari-atomic-consonants.txt @@ -0,0 +1,33 @@ +ख ख्ा ख्‍ा +ग ग्ा ग्‍ा +घ घ्ा घ्‍ा +च च्ा च्‍ा +ज ज्ा ज्‍ा +झ झ्ा झ्‍ा +ञ ञ्ा ञ्‍ा +ण ण्ा ण्‍ा +त त्ा त्‍ा +थ थ्ा थ्‍ा +ध ध्ा ध्‍ा +न न्ा न्‍ा +ऩ ऩ्ा ऩ्‍ा ऩ्ा ऩ्‍ा +प प्ा प्‍ा +ब ब्ा ब्‍ा +भ भ्ा भ्‍ा +म म्ा म्‍ा +य य्ा य्‍ा +ल ल्ा ल्‍ा +व व्ा व्‍ा +श श्ा श्‍ा +ष ष्ा ष्‍ा +स स्ा स्‍ा +ख़ ख़्ा ख़्‍ा ख़्ा ख़्‍ा +ग़ ग़्ा ग़्‍ा ग़्ा ग़्‍ा +ज़ ज़्ा ज़्‍ा ज़्ा ज़्‍ा +य़ य़्ा य़्‍ा य़्ा य़्‍ा +ॹ ॹ्ा ॹ्‍ा +ॺ ॺ्ा ॺ्‍ा +ज़ ॻ्ा ॻ्‍ा +ॼ ॼ्ा ॼ्‍ा +ॾ ॾ्ा ॾ्‍ा +ॿ ॿ्ा ॿ्‍ा diff --git a/test/shaping/texts/in-house/shaper-indic/script-devanagari/devanagari-vowel-letters.txt b/test/shaping/texts/in-house/shaper-indic/script-devanagari/devanagari-vowel-letters.txt new file mode 100644 index 000000000..5a41252f2 --- /dev/null +++ b/test/shaping/texts/in-house/shaper-indic/script-devanagari/devanagari-vowel-letters.txt @@ -0,0 +1,17 @@ +ऄ अॆ +आ अा +ई र्इ +ऊ उु +ऍ एॅ +ऎ एॆ +ऐ एे +ऑ अॉ आॅ +ऒ अॊ आॆ +ओ अो आे +औ अौ आै +ॲ अॅ +ॳ अऺ +ॴ अऻ आऺ +ॵ अॏ +ॶ अॖ +ॷ अॗ diff --git a/test/shaping/texts/in-house/shaper-indic/script-gujarati/gujarati-vowel-letter.txt b/test/shaping/texts/in-house/shaper-indic/script-gujarati/gujarati-vowel-letter.txt new file mode 100644 index 000000000..add4332b3 --- /dev/null +++ b/test/shaping/texts/in-house/shaper-indic/script-gujarati/gujarati-vowel-letter.txt @@ -0,0 +1,8 @@ +આ અા +ઍ અૅ +એ અે +ઐ અૈ +ઑ અૉ +ઓ અો અાૅ +ઔ અૌ અાૈ +ૉ ૅા diff --git a/test/shaping/texts/in-house/shaper-indic/script-gurmukhi/gurmukhi-vowel-letters.txt b/test/shaping/texts/in-house/shaper-indic/script-gurmukhi/gurmukhi-vowel-letters.txt new file mode 100644 index 000000000..b2adaabd2 --- /dev/null +++ b/test/shaping/texts/in-house/shaper-indic/script-gurmukhi/gurmukhi-vowel-letters.txt @@ -0,0 +1,9 @@ +ਆ ਅਾ +ਇ ੲਿ +ਈ ੲੀ +ਉ ੳੁ +ਊ ੳੂ +ਏ ੲੇ +ਐ ਅੈ +ਓ ੳੋ +ਔ ਅੌ diff --git a/test/shaping/texts/in-house/shaper-indic/script-kannada/kannada-vowel-letters.txt b/test/shaping/texts/in-house/shaper-indic/script-kannada/kannada-vowel-letters.txt new file mode 100644 index 000000000..cc05db93f --- /dev/null +++ b/test/shaping/texts/in-house/shaper-indic/script-kannada/kannada-vowel-letters.txt @@ -0,0 +1,3 @@ +ಊ ಉಾ +ಔ ಒೌ +ೠ ಋಾ diff --git a/test/shaping/texts/in-house/shaper-indic/script-malayalam/malayalam-vowel-letters.txt b/test/shaping/texts/in-house/shaper-indic/script-malayalam/malayalam-vowel-letters.txt new file mode 100644 index 000000000..061c642f7 --- /dev/null +++ b/test/shaping/texts/in-house/shaper-indic/script-malayalam/malayalam-vowel-letters.txt @@ -0,0 +1,5 @@ +ഈ ഇൗ +ഊ ഉൗ +ഐ എെ +ഓ ഒാ +ഔ ഒൗ diff --git a/test/shaping/texts/in-house/shaper-indic/script-oriya/oriya-vowel-letters.txt b/test/shaping/texts/in-house/shaper-indic/script-oriya/oriya-vowel-letters.txt new file mode 100644 index 000000000..e8d24cb57 --- /dev/null +++ b/test/shaping/texts/in-house/shaper-indic/script-oriya/oriya-vowel-letters.txt @@ -0,0 +1,3 @@ +ଆ ଅା +ଐ ଏୗ +ଔ ଓୗ diff --git a/test/shaping/texts/in-house/shaper-indic/script-telugu/telugu-vowel-letters.txt b/test/shaping/texts/in-house/shaper-indic/script-telugu/telugu-vowel-letters.txt new file mode 100644 index 000000000..c3cfc84cd --- /dev/null +++ b/test/shaping/texts/in-house/shaper-indic/script-telugu/telugu-vowel-letters.txt @@ -0,0 +1,5 @@ +ఓ ఒౕ +ఔ ఒౌ +ీ ిౕ +ే ెౕ +ో ొౕ From 6f457f8370de5d96452ee3a2d1b0a97b025ef1d1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 17:46:27 +0200 Subject: [PATCH 24/30] [indic] Minor flip grammar around No behavior change. --- src/hb-ot-shape-complex-indic-machine.rl | 2 +- src/hb-ot-shape-complex-use-machine.rl | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hb-ot-shape-complex-indic-machine.rl b/src/hb-ot-shape-complex-indic-machine.rl index bf5c1c8dc..455938e9c 100644 --- a/src/hb-ot-shape-complex-indic-machine.rl +++ b/src/hb-ot-shape-complex-indic-machine.rl @@ -70,7 +70,7 @@ final_halant_group = halant_group | H.ZWNJ; halant_or_matra_group = (final_halant_group | matra_group{0,4}); -consonant_syllable = (Repha|CS)? (cn.halant_group){0,4} cn halant_or_matra_group syllable_tail; +consonant_syllable = (Repha|CS)? cn (halant_group.cn){0,4} halant_or_matra_group syllable_tail; vowel_syllable = reph? V.n? (ZWJ | (halant_group.cn){0,4} halant_or_matra_group syllable_tail); standalone_cluster = ((Repha|CS)? PLACEHOLDER | reph? DOTTEDCIRCLE).n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail; symbol_cluster = symbol syllable_tail; diff --git a/src/hb-ot-shape-complex-use-machine.rl b/src/hb-ot-shape-complex-use-machine.rl index df50a3e35..0c9ab078c 100644 --- a/src/hb-ot-shape-complex-use-machine.rl +++ b/src/hb-ot-shape-complex-use-machine.rl @@ -110,7 +110,6 @@ standard_cluster = vowel_modifiers final_consonants ; - broken_cluster = R? consonant_modifiers From 5101abd42f4027edf182eddfa58c629b11c2a7f6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 17:49:06 +0200 Subject: [PATCH 25/30] [indic/use] Factor common expressions in ragel machine No machine change. --- src/hb-ot-shape-complex-indic-machine.hh | 46 ++++++++++++------------ src/hb-ot-shape-complex-indic-machine.rl | 10 +++--- src/hb-ot-shape-complex-use-machine.hh | 38 ++++++++++---------- src/hb-ot-shape-complex-use-machine.rl | 20 +++++------ 4 files changed, 58 insertions(+), 56 deletions(-) diff --git a/src/hb-ot-shape-complex-indic-machine.hh b/src/hb-ot-shape-complex-indic-machine.hh index 85db4df55..e2ecfb89c 100644 --- a/src/hb-ot-shape-complex-indic-machine.hh +++ b/src/hb-ot-shape-complex-indic-machine.hh @@ -911,7 +911,7 @@ static const int indic_syllable_machine_en_main = 138; -#line 90 "hb-ot-shape-complex-indic-machine.rl" +#line 92 "hb-ot-shape-complex-indic-machine.rl" #define found_syllable(syllable_type) \ @@ -938,7 +938,7 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 110 "hb-ot-shape-complex-indic-machine.rl" +#line 112 "hb-ot-shape-complex-indic-machine.rl" p = 0; @@ -983,71 +983,71 @@ _eof_trans: {te = p+1;} break; case 14: -#line 81 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (consonant_syllable); }} break; case 16: -#line 82 "hb-ot-shape-complex-indic-machine.rl" +#line 84 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (vowel_syllable); }} break; case 21: -#line 83 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (standalone_cluster); }} break; case 24: -#line 84 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (symbol_cluster); }} break; case 18: -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 87 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (broken_cluster); }} break; case 11: -#line 86 "hb-ot-shape-complex-indic-machine.rl" +#line 88 "hb-ot-shape-complex-indic-machine.rl" {te = p+1;{ found_syllable (non_indic_cluster); }} break; case 13: -#line 81 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (consonant_syllable); }} break; case 15: -#line 82 "hb-ot-shape-complex-indic-machine.rl" +#line 84 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (vowel_syllable); }} break; case 20: -#line 83 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (standalone_cluster); }} break; case 23: -#line 84 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (symbol_cluster); }} break; case 17: -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 87 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (broken_cluster); }} break; case 19: -#line 86 "hb-ot-shape-complex-indic-machine.rl" +#line 88 "hb-ot-shape-complex-indic-machine.rl" {te = p;p--;{ found_syllable (non_indic_cluster); }} break; case 1: -#line 81 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} break; case 3: -#line 82 "hb-ot-shape-complex-indic-machine.rl" +#line 84 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (vowel_syllable); }} break; case 7: -#line 83 "hb-ot-shape-complex-indic-machine.rl" +#line 85 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (standalone_cluster); }} break; case 8: -#line 84 "hb-ot-shape-complex-indic-machine.rl" +#line 86 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (symbol_cluster); }} break; case 4: -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 87 "hb-ot-shape-complex-indic-machine.rl" {{p = ((te))-1;}{ found_syllable (broken_cluster); }} break; case 5: @@ -1068,19 +1068,19 @@ _eof_trans: case 22: #line 1 "NONE" {te = p+1;} -#line 81 "hb-ot-shape-complex-indic-machine.rl" +#line 83 "hb-ot-shape-complex-indic-machine.rl" {act = 1;} break; case 6: #line 1 "NONE" {te = p+1;} -#line 85 "hb-ot-shape-complex-indic-machine.rl" +#line 87 "hb-ot-shape-complex-indic-machine.rl" {act = 5;} break; case 12: #line 1 "NONE" {te = p+1;} -#line 86 "hb-ot-shape-complex-indic-machine.rl" +#line 88 "hb-ot-shape-complex-indic-machine.rl" {act = 6;} break; #line 1087 "hb-ot-shape-complex-indic-machine.hh" @@ -1108,7 +1108,7 @@ _again: } -#line 118 "hb-ot-shape-complex-indic-machine.rl" +#line 120 "hb-ot-shape-complex-indic-machine.rl" } diff --git a/src/hb-ot-shape-complex-indic-machine.rl b/src/hb-ot-shape-complex-indic-machine.rl index 455938e9c..c5d945d4e 100644 --- a/src/hb-ot-shape-complex-indic-machine.rl +++ b/src/hb-ot-shape-complex-indic-machine.rl @@ -69,12 +69,14 @@ halant_group = (z?.H.(ZWJ.N?)?); final_halant_group = halant_group | H.ZWNJ; halant_or_matra_group = (final_halant_group | matra_group{0,4}); +complex_syllable_tail = (halant_group.cn){0,4} halant_or_matra_group syllable_tail; -consonant_syllable = (Repha|CS)? cn (halant_group.cn){0,4} halant_or_matra_group syllable_tail; -vowel_syllable = reph? V.n? (ZWJ | (halant_group.cn){0,4} halant_or_matra_group syllable_tail); -standalone_cluster = ((Repha|CS)? PLACEHOLDER | reph? DOTTEDCIRCLE).n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail; + +consonant_syllable = (Repha|CS)? cn complex_syllable_tail; +vowel_syllable = reph? V.n? (ZWJ | complex_syllable_tail); +standalone_cluster = ((Repha|CS)? PLACEHOLDER | reph? DOTTEDCIRCLE).n? complex_syllable_tail; symbol_cluster = symbol syllable_tail; -broken_cluster = reph? n? (halant_group.cn){0,4} halant_or_matra_group syllable_tail; +broken_cluster = reph? n? complex_syllable_tail; other = any; main := |* diff --git a/src/hb-ot-shape-complex-use-machine.hh b/src/hb-ot-shape-complex-use-machine.hh index ba6c9bf13..e7caca5a1 100644 --- a/src/hb-ot-shape-complex-use-machine.hh +++ b/src/hb-ot-shape-complex-use-machine.hh @@ -315,7 +315,7 @@ static const int use_syllable_machine_en_main = 4; -#line 141 "hb-ot-shape-complex-use-machine.rl" +#line 140 "hb-ot-shape-complex-use-machine.rl" #define found_syllable(syllable_type) \ @@ -342,7 +342,7 @@ find_syllables (hb_buffer_t *buffer) act = 0; } -#line 161 "hb-ot-shape-complex-use-machine.rl" +#line 160 "hb-ot-shape-complex-use-machine.rl" p = 0; @@ -387,59 +387,59 @@ _eof_trans: {te = p+1;} break; case 12: -#line 130 "hb-ot-shape-complex-use-machine.rl" +#line 129 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (independent_cluster); }} break; case 14: -#line 132 "hb-ot-shape-complex-use-machine.rl" +#line 131 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (standard_cluster); }} break; case 9: -#line 136 "hb-ot-shape-complex-use-machine.rl" +#line 135 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (broken_cluster); }} break; case 8: -#line 137 "hb-ot-shape-complex-use-machine.rl" +#line 136 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (non_cluster); }} break; case 11: -#line 130 "hb-ot-shape-complex-use-machine.rl" +#line 129 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (independent_cluster); }} break; case 15: -#line 131 "hb-ot-shape-complex-use-machine.rl" +#line 130 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (virama_terminated_cluster); }} break; case 13: -#line 132 "hb-ot-shape-complex-use-machine.rl" +#line 131 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (standard_cluster); }} break; case 17: -#line 133 "hb-ot-shape-complex-use-machine.rl" +#line 132 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (number_joiner_terminated_cluster); }} break; case 16: -#line 134 "hb-ot-shape-complex-use-machine.rl" +#line 133 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (numeral_cluster); }} break; case 20: -#line 135 "hb-ot-shape-complex-use-machine.rl" +#line 134 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (symbol_cluster); }} break; case 18: -#line 136 "hb-ot-shape-complex-use-machine.rl" +#line 135 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (broken_cluster); }} break; case 19: -#line 137 "hb-ot-shape-complex-use-machine.rl" +#line 136 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (non_cluster); }} break; case 1: -#line 132 "hb-ot-shape-complex-use-machine.rl" +#line 131 "hb-ot-shape-complex-use-machine.rl" {{p = ((te))-1;}{ found_syllable (standard_cluster); }} break; case 4: -#line 136 "hb-ot-shape-complex-use-machine.rl" +#line 135 "hb-ot-shape-complex-use-machine.rl" {{p = ((te))-1;}{ found_syllable (broken_cluster); }} break; case 2: @@ -457,13 +457,13 @@ _eof_trans: case 3: #line 1 "NONE" {te = p+1;} -#line 136 "hb-ot-shape-complex-use-machine.rl" +#line 135 "hb-ot-shape-complex-use-machine.rl" {act = 7;} break; case 10: #line 1 "NONE" {te = p+1;} -#line 137 "hb-ot-shape-complex-use-machine.rl" +#line 136 "hb-ot-shape-complex-use-machine.rl" {act = 8;} break; #line 470 "hb-ot-shape-complex-use-machine.hh" @@ -491,7 +491,7 @@ _again: } -#line 169 "hb-ot-shape-complex-use-machine.rl" +#line 168 "hb-ot-shape-complex-use-machine.rl" } diff --git a/src/hb-ot-shape-complex-use-machine.rl b/src/hb-ot-shape-complex-use-machine.rl index 0c9ab078c..ddbeef6c3 100644 --- a/src/hb-ot-shape-complex-use-machine.rl +++ b/src/hb-ot-shape-complex-use-machine.rl @@ -97,6 +97,14 @@ dependent_vowels = VPre* VAbv* VBlw* VPst*; vowel_modifiers = VMPre* VMAbv* VMBlw* VMPst*; final_consonants = FAbv* FBlw* FPst* FM?; +complex_syllable_tail = + consonant_modifiers + medial_consonants + dependent_vowels + vowel_modifiers + final_consonants +; + virama_terminated_cluster = (R|CS)? (B | GB) VS? consonant_modifiers @@ -104,19 +112,11 @@ virama_terminated_cluster = ; standard_cluster = (R|CS)? (B | GB) VS? - consonant_modifiers - medial_consonants - dependent_vowels - vowel_modifiers - final_consonants + complex_syllable_tail ; broken_cluster = R? - consonant_modifiers - medial_consonants - dependent_vowels - vowel_modifiers - final_consonants + complex_syllable_tail ; number_joiner_terminated_cluster = N VS? (HN N VS?)* HN; From 77792187be1405599e6aecfc3ed1fc771d505ddb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 18:20:16 +0200 Subject: [PATCH 26/30] [khmer] Remove unused khmer_position() --- src/dump-khmer-data.cc | 8 +++----- src/hb-ot-shape-complex-khmer.hh | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/dump-khmer-data.cc b/src/dump-khmer-data.cc index 12871fa85..1e79a9767 100644 --- a/src/dump-khmer-data.cc +++ b/src/dump-khmer-data.cc @@ -34,10 +34,8 @@ main (void) hb_glyph_info_t info; info.codepoint = u; set_khmer_properties (info); - if (info.khmer_category() != INDIC_SYLLABIC_CATEGORY_OTHER || - info.khmer_position() != INDIC_MATRA_CATEGORY_NOT_APPLICABLE) - printf("U+%04X %u %u\n", u, - info.khmer_category(), - info.khmer_position()); + if (info.khmer_category() != INDIC_SYLLABIC_CATEGORY_OTHER) + printf("U+%04X %u\n", u, + info.khmer_category()); } } diff --git a/src/hb-ot-shape-complex-khmer.hh b/src/hb-ot-shape-complex-khmer.hh index 4ee0b8383..622294588 100644 --- a/src/hb-ot-shape-complex-khmer.hh +++ b/src/hb-ot-shape-complex-khmer.hh @@ -34,7 +34,6 @@ /* buffer var allocations */ #define khmer_category() indic_category() /* khmer_category_t */ -#define khmer_position() indic_position() /* indic_position_t */ /* Note: This enum is duplicated in the -machine.rl source file. From 32a438166fbccac6e0d9a615a492fc8cabfd21ab Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 18:43:29 +0200 Subject: [PATCH 27/30] [tibetan] Route Tibetan through USE Fixes https://github.com/harfbuzz/harfbuzz/pull/933 https://github.com/harfbuzz/harfbuzz/issues/1012 Tibetan failures go from 0 to 2: TIBETAN: 208467 out of 208469 tests passed. 2 failed (0.000959375%) --- src/gen-use-table.py | 30 ++++++++---- src/hb-ot-shape-complex-use-table.cc | 70 +++++++++++++++++----------- src/hb-ot-shape-complex.hh | 8 +--- 3 files changed, 65 insertions(+), 43 deletions(-) diff --git a/src/gen-use-table.py b/src/gen-use-table.py index 9c7e6f489..2afbc760e 100755 --- a/src/gen-use-table.py +++ b/src/gen-use-table.py @@ -8,7 +8,7 @@ if len (sys.argv) != 5: print ("usage: ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt", file=sys.stderr) sys.exit (1) -BLACKLISTED_BLOCKS = ["Thai", "Lao", "Tibetan"] +BLACKLISTED_BLOCKS = ["Thai", "Lao"] files = [io.open (x, encoding='utf-8') for x in sys.argv[1:]] @@ -307,11 +307,28 @@ def map_to_use(data): # Resolve Indic_Syllabic_Category - # TODO: These don't have UISC assigned in Unicode 8.0, but - # have UIPC + # TODO: These don't have UISC assigned in Unicode 8.0, but have UIPC if U == 0x17DD: UISC = Vowel_Dependent if 0x1CE2 <= U <= 0x1CE8: UISC = Cantillation_Mark + # Tibetan: + # TODO: These don't have UISC assigned in Unicode 11.0, but have UIPC + if 0x0F18 <= U <= 0x0F19 or 0x0F3E <= U <= 0x0F3F: UISC = Vowel_Dependent + if 0x0F86 <= U <= 0x0F87: UISC = Tone_Mark + # Overrides to allow NFC order matching syllable + # https://github.com/harfbuzz/harfbuzz/issues/1012 + if UBlock == 'Tibetan' and is_VOWEL (U, UISC, UGC): + if UIPC == Top: + UIPC = Bottom + + # TODO: https://github.com/harfbuzz/harfbuzz/pull/982 + # also https://github.com/harfbuzz/harfbuzz/issues/1012 + if UBlock == 'Chakma' and is_VOWEL (U, UISC, UGC): + if UIPC == Top: + UIPC = Bottom + elif UIPC == Bottom: + UIPC = Top + # TODO: https://github.com/harfbuzz/harfbuzz/pull/627 if 0x1BF2 <= U <= 0x1BF3: UISC = Nukta; UIPC = Bottom @@ -359,13 +376,6 @@ def map_to_use(data): # https://github.com/roozbehp/unicode-data/issues/8 if U == 0x0A51: UIPC = Bottom - # TODO: https://github.com/harfbuzz/harfbuzz/pull/982 - if UBlock == 'Chakma' and is_VOWEL (U, UISC, UGC): - if UIPC == Top: - UIPC = Bottom - elif UIPC == Bottom: - UIPC = Top - assert (UIPC in [Not_Applicable, Visual_Order_Left] or USE in use_positions), "%s %s %s %s %s" % (hex(U), UIPC, USE, UISC, UGC) diff --git a/src/hb-ot-shape-complex-use-table.cc b/src/hb-ot-shape-complex-use-table.cc index d4237b0a1..e9d969fb3 100644 --- a/src/hb-ot-shape-complex-use-table.cc +++ b/src/hb-ot-shape-complex-use-table.cc @@ -194,7 +194,24 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0DE0 */ O, O, O, O, O, O, B, B, B, B, B, B, B, B, B, B, /* 0DF0 */ O, O, VPst, VPst, O, O, O, O, -#define use_offset_0x1000u 1360 +#define use_offset_0x0f18u 1360 + + + /* Tibetan */ + VBlw, VBlw, O, O, O, O, O, O, + /* 0F20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 0F30 */ B, B, B, B, O, FM, O, FM, O, CMAbv, O, O, O, O, VPst, VPre, + /* 0F40 */ B, B, B, B, B, B, B, B, O, B, B, B, B, B, B, B, + /* 0F50 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, + /* 0F60 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, + /* 0F70 */ O, VBlw, VBlw, VAbv, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VMAbv, VMPst, + /* 0F80 */ VBlw, VAbv, VMAbv, VMAbv, VBlw, IND, VMAbv, VMAbv, B, B, B, B, B, SUB, SUB, SUB, + /* 0F90 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, + /* 0FA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, + /* 0FB0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, O, O, + /* 0FC0 */ O, O, O, O, O, O, FM, O, + +#define use_offset_0x1000u 1536 /* Myanmar */ @@ -210,7 +227,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1080 */ B, B, MBlw, VPst, VPre, VAbv, VAbv, VMPst, VMPst, VMPst, VMPst, VMPst, VMPst, VMBlw, B, VMPst, /* 1090 */ B, B, B, B, B, B, B, B, B, B, VMPst, VMPst, VPst, VAbv, O, O, -#define use_offset_0x1700u 1520 +#define use_offset_0x1700u 1696 /* Tagalog */ @@ -243,7 +260,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 17D0 */ FM, VAbv, H, FM, O, O, O, O, O, O, O, O, B, VAbv, O, O, /* 17E0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x1900u 1760 +#define use_offset_0x1900u 1936 /* Limbu */ @@ -287,7 +304,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1A80 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, /* 1A90 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x1b00u 2176 +#define use_offset_0x1b00u 2352 /* Balinese */ @@ -323,7 +340,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1C30 */ FAbv, FAbv, FAbv, FAbv, VMPre, VMPre, FM, CMBlw, O, O, O, O, O, O, O, O, /* 1C40 */ B, B, B, B, B, B, B, B, B, B, O, O, O, B, B, B, -#define use_offset_0x1cd0u 2512 +#define use_offset_0x1cd0u 2688 /* Vedic Extensions */ @@ -332,20 +349,20 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1CE0 */ VMAbv, VMPst, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, O, O, O, O, VMBlw, O, O, /* 1CF0 */ O, O, VMPst, VMPst, VMAbv, CS, CS, VMPst, VMAbv, VMAbv, O, O, O, O, O, O, -#define use_offset_0x1df8u 2560 +#define use_offset_0x1df8u 2736 /* Combining Diacritical Marks Supplement */ O, O, O, FM, O, O, O, O, -#define use_offset_0x2008u 2568 +#define use_offset_0x2008u 2744 /* General Punctuation */ O, O, O, O, ZWNJ, ZWJ, O, O, /* 2010 */ GB, GB, GB, GB, GB, O, O, O, -#define use_offset_0x2060u 2584 +#define use_offset_0x2060u 2760 /* 2060 */ WJ, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, @@ -354,20 +371,20 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 2070 */ O, O, O, O, FM, O, O, O, O, O, O, O, O, O, O, O, /* 2080 */ O, O, FM, FM, FM, O, O, O, -#define use_offset_0x20f0u 2624 +#define use_offset_0x20f0u 2800 /* Combining Diacritical Marks for Symbols */ /* 20F0 */ VMAbv, O, O, O, O, O, O, O, -#define use_offset_0x25c8u 2632 +#define use_offset_0x25c8u 2808 /* Geometric Shapes */ O, O, O, O, GB, O, O, O, -#define use_offset_0xa800u 2640 +#define use_offset_0xa800u 2816 /* Syloti Nagri */ @@ -454,7 +471,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* AAE0 */ B, B, B, B, B, B, B, B, B, B, B, VPre, VBlw, VAbv, VPre, VPst, /* AAF0 */ O, O, O, O, O, VMPst, H, O, -#define use_offset_0xabc0u 3400 +#define use_offset_0xabc0u 3576 /* Meetei Mayek */ @@ -464,14 +481,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* ABE0 */ B, B, B, VPst, VPst, VAbv, VPst, VPst, VBlw, VPst, VPst, O, VMPst, VBlw, O, O, /* ABF0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0xfe00u 3464 +#define use_offset_0xfe00u 3640 /* Variation Selectors */ /* FE00 */ VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, -#define use_offset_0x10a00u 3480 +#define use_offset_0x10a00u 3656 /* Kharoshthi */ @@ -482,7 +499,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 10A30 */ B, B, B, B, B, B, O, O, CMAbv, CMBlw, CMBlw, O, O, O, O, H, /* 10A40 */ B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, O, -#define use_offset_0x11000u 3560 +#define use_offset_0x11000u 3736 /* Brahmi */ @@ -503,7 +520,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 110A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 110B0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VPst, VPst, H, CMBlw, O, O, O, O, O, -#define use_offset_0x11100u 3752 +#define use_offset_0x11100u 3928 /* Chakma */ @@ -511,7 +528,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11100 */ VMAbv, VMAbv, VMAbv, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11110 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11120 */ B, B, B, B, B, B, B, VBlw, VBlw, VBlw, VAbv, VAbv, VPre, VBlw, VAbv, VAbv, - /* 11130 */ VBlw, VAbv, VAbv, H, CMAbv, O, B, B, B, B, B, B, B, B, B, B, + /* 11130 */ VBlw, VAbv, VAbv, H, CMBlw, O, B, B, B, B, B, B, B, B, B, B, /* 11140 */ O, O, O, O, B, VPst, VPst, O, O, O, O, O, O, O, O, O, /* Mahajani */ @@ -541,7 +558,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11220 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VBlw, /* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv, O, O, O, O, O, O, VMAbv, O, -#define use_offset_0x11280u 4072 +#define use_offset_0x11280u 4248 /* Multani */ @@ -569,7 +586,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11360 */ B, B, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, /* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, -#define use_offset_0x11400u 4320 +#define use_offset_0x11400u 4496 /* Newa */ @@ -592,7 +609,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 114C0 */ VMAbv, VMPst, H, CMBlw, B, O, O, O, O, O, O, O, O, O, O, O, /* 114D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x11580u 4544 +#define use_offset_0x11580u 4720 /* Siddham */ @@ -635,7 +652,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11720 */ VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VBlw, VAbv, VAbv, VAbv, O, O, O, O, /* 11730 */ B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, -#define use_offset_0x11800u 4992 +#define use_offset_0x11800u 5168 /* Dogra */ @@ -645,7 +662,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11820 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPre, VPst, VBlw, /* 11830 */ VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, VMAbv, VMPst, H, CMBlw, O, O, O, O, O, -#define use_offset_0x11a00u 5056 +#define use_offset_0x11a00u 5232 /* Zanabazar Square */ @@ -664,7 +681,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11A80 */ B, B, B, B, O, O, R, R, R, R, FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, /* 11A90 */ FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, VMAbv, VMPst, CMAbv, H, O, O, O, B, O, O, -#define use_offset_0x11c00u 5216 +#define use_offset_0x11c00u 5392 /* Bhaiksuki */ @@ -685,7 +702,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11CA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, /* 11CB0 */ VBlw, VPre, VBlw, VAbv, VPst, VMAbv, VMAbv, O, -#define use_offset_0x11d00u 5400 +#define use_offset_0x11d00u 5576 /* Masaram Gondi */ @@ -705,7 +722,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11D90 */ VAbv, VAbv, O, VPst, VPst, VMAbv, VMPst, H, O, O, O, O, O, O, O, O, /* 11DA0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x11ee0u 5576 +#define use_offset_0x11ee0u 5752 /* Makasar */ @@ -713,7 +730,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11EE0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 11EF0 */ B, B, GB, VAbv, VBlw, VPre, VPst, O, -}; /* Table items: 5600; occupancy: 73% */ +}; /* Table items: 5776; occupancy: 74% */ USE_TABLE_ELEMENT_TYPE hb_use_get_category (hb_codepoint_t u) @@ -725,6 +742,7 @@ hb_use_get_category (hb_codepoint_t u) if (hb_in_range (u, 0x00A0u, 0x00D7u)) return use_table[u - 0x00A0u + use_offset_0x00a0u]; if (hb_in_range (u, 0x0348u, 0x034Fu)) return use_table[u - 0x0348u + use_offset_0x0348u]; if (hb_in_range (u, 0x0900u, 0x0DF7u)) return use_table[u - 0x0900u + use_offset_0x0900u]; + if (hb_in_range (u, 0x0F18u, 0x0FC7u)) return use_table[u - 0x0F18u + use_offset_0x0f18u]; break; case 0x1u: diff --git a/src/hb-ot-shape-complex.hh b/src/hb-ot-shape-complex.hh index c18f1b96c..ce0191e8b 100644 --- a/src/hb-ot-shape-complex.hh +++ b/src/hb-ot-shape-complex.hh @@ -232,12 +232,6 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner) return &_hb_ot_complex_shaper_hangul; - /* Unicode-2.0 additions */ - case HB_SCRIPT_TIBETAN: - - return &_hb_ot_complex_shaper_tibetan; - - /* Unicode-1.1 additions */ case HB_SCRIPT_HEBREW: @@ -289,7 +283,7 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner) /* Unicode-2.0 additions */ - //case HB_SCRIPT_TIBETAN: + case HB_SCRIPT_TIBETAN: /* Unicode-3.0 additions */ //case HB_SCRIPT_MONGOLIAN: From fef7af1e22efb399517137b35d0ba9f307411ca3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 18:46:13 +0200 Subject: [PATCH 28/30] [tibetan] Remove unused Tibetan shaper --- src/Makefile.sources | 1 - src/hb-ot-shape-complex-tibetan.cc | 63 ------------------------------ src/hb-ot-shape-complex.hh | 1 - 3 files changed, 65 deletions(-) delete mode 100644 src/hb-ot-shape-complex-tibetan.cc diff --git a/src/Makefile.sources b/src/Makefile.sources index 46af3ae57..69ab155a6 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -137,7 +137,6 @@ HB_OT_sources = \ hb-ot-shape-complex-myanmar.hh \ hb-ot-shape-complex-myanmar.cc \ hb-ot-shape-complex-thai.cc \ - hb-ot-shape-complex-tibetan.cc \ hb-ot-shape-complex-use.cc \ hb-ot-shape-complex-use.hh \ hb-ot-shape-complex-use-table.cc \ diff --git a/src/hb-ot-shape-complex-tibetan.cc b/src/hb-ot-shape-complex-tibetan.cc deleted file mode 100644 index 5d6dfeae4..000000000 --- a/src/hb-ot-shape-complex-tibetan.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright © 2010,2012 Google, Inc. - * - * This is part of HarfBuzz, a text shaping library. - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. - * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * Google Author(s): Behdad Esfahbod - */ - -#include "hb-ot-shape-complex.hh" - - -static const hb_tag_t tibetan_features[] = -{ - HB_TAG('a','b','v','s'), - HB_TAG('b','l','w','s'), - HB_TAG('a','b','v','m'), - HB_TAG('b','l','w','m'), - HB_TAG_NONE -}; - -static void -collect_features_tibetan (hb_ot_shape_planner_t *plan) -{ - for (const hb_tag_t *script_features = tibetan_features; script_features && *script_features; script_features++) - plan->map.enable_feature (*script_features); -} - - -const hb_ot_complex_shaper_t _hb_ot_complex_shaper_tibetan = -{ - collect_features_tibetan, - nullptr, /* override_features */ - nullptr, /* data_create */ - nullptr, /* data_destroy */ - nullptr, /* preprocess_text */ - nullptr, /* postprocess_glyphs */ - HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, - nullptr, /* decompose */ - nullptr, /* compose */ - nullptr, /* setup_masks */ - HB_TAG_NONE, /* gpos_tag */ - nullptr, /* reorder_marks */ - HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, - true, /* fallback_position */ -}; diff --git a/src/hb-ot-shape-complex.hh b/src/hb-ot-shape-complex.hh index ce0191e8b..36b5b22e7 100644 --- a/src/hb-ot-shape-complex.hh +++ b/src/hb-ot-shape-complex.hh @@ -59,7 +59,6 @@ enum hb_ot_shape_zero_width_marks_type_t { HB_COMPLEX_SHAPER_IMPLEMENT (myanmar) \ HB_COMPLEX_SHAPER_IMPLEMENT (myanmar_old) \ HB_COMPLEX_SHAPER_IMPLEMENT (thai) \ - HB_COMPLEX_SHAPER_IMPLEMENT (tibetan) \ HB_COMPLEX_SHAPER_IMPLEMENT (use) \ /* ^--- Add new shapers here */ From 9f1dee32fbad3b1486725c18570199156b57a94d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Oct 2018 18:56:20 +0200 Subject: [PATCH 29/30] [tests] Allow test-runner to ignore shaping output Fixes https://github.com/harfbuzz/harfbuzz/issues/1212 --- test/shaping/data/in-house/tests/fuzzed.tests | 46 +++++++++---------- test/shaping/run-tests.py | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/test/shaping/data/in-house/tests/fuzzed.tests b/test/shaping/data/in-house/tests/fuzzed.tests index a6ce93d02..ff0a09782 100644 --- a/test/shaping/data/in-house/tests/fuzzed.tests +++ b/test/shaping/data/in-house/tests/fuzzed.tests @@ -1,23 +1,23 @@ -../fonts/1a6f1687b7a221f9f2c834b0b360d3c8463b6daf.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/5a5daf5eb5a4db77a2baa3ad9c7a6ed6e0655fa8.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/0509e80afb379d16560e9e47bdd7d888bebdebc6.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/641bd9db850193064d17575053ae2bf8ec149ddc.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/375d6ae32a3cbe52fbf81a4e5777e3377675d5a3.ttf:--font-funcs=ot:U+0041:[gid0=0+4352] -../fonts/8240789f6d12d4cfc4b5e8e6f246c3701bcf861f.ttf:--font-funcs=ot:U+0041:[gid0=0+1024] -../fonts/b9e2aaa0d75fcef6971ec3a96d806ba4a6b31fe2.ttf:--font-funcs=ot:U+0041:[gid0=0+1000|gid1=0+1000|gid8=0+1000|gid3=0+1000|gid0=0+1000|gid1=0+1000|gid1=0+1000|gid8=0+1000|gid3=0+1000|gid0=0+1000|gid1=0+1000|gid8=0+1000|gid3=0+1000|gid0=0+1000|gid1=0+1000|gid1=0+1000] -../fonts/43979b90b2dd929723cf4fe1715990bcb9c9a56b.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/3511ff5c1647150595846ac414c595cccac34f18.ttf:--font-funcs=ot --no-positions --no-clusters --no-glyph-names:U+0041:[0|512|15104|11004|3408|18244|17872|17961|0|992|15616|0|14151|20559|20992|5440|256|0|10|8960|256|1024|1490|0|768|4096|256|2216|0|256|256|0|768|10752|11004|3408|18244|17734|53248|256|0|512|14848|10793|57344|768|18227|20285|20480|0|256|0|810|0|11004|3408|18244|17734|53289|57344|768|15667|71|0|20559|21248|256|0|2816|2776|0|51516|0|32|26209|28005|65249|29690|0|51548|0|2454|28783|29556|1291|3458|80|0|2804|210|28786|25968|45763|50546|0|59136|0|38144|256|0|2560|30208|52224|580|17996|21504|6734|108|116|24846|1024|0|255|65280|256|0|8704|1345|23109|8192|10823|21076|8192|12877|20300|8192|6738|20301|8192|16980|21067|8251|18944|255|65280|15360|256|255|65280|256|768|255|65280|256|768|255|65280|256|1024|12|65280|256|1280|255|65280|256|1536|1899|25970|110|11264|27502|29285|12907|25974|28160|14443|25970|28288|3|118|18259|21826|45716|46369|0|0|1|16|17|256|4|16|18244|17734|28|12|0|284|0|28|18256|20307|45114|47616|226|10296|0|57927|1|0|0|21248|5440|256|0|10|768|256|1024|512|0|297|16|24833|28774|10794|2304|29|32|42|64515|42|42|64525|20551|17477|18128|10720|3|61|3408|18244|17734|53289|57344|768|15616|512|55|10576|20307|0|255|56063|53504|42|42|64525|12288|18176|80|20307|1|0|62] -../fonts/fab39d60d758cb586db5a504f218442cd1395725.ttf:--font-funcs=ot:U+0041,U+0041:[gid0=0+1000|gid0=1+1000] -../fonts/205edd09bd3d141cc9580f650109556cc28b22cb.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/217a934cfe15c548b572c203dceb2befdf026462.ttf:--font-funcs=ot:U+0061,U+0061,U+0061:[] -../fonts/558661aa659912f4d30ecd27bd09835171a8e2b0.ttf:--font-funcs=ot:U+FFFD,U+E0100,U+FFFD,U+E0010:[gid3584=0+1000|gid1024=0+1000|gid1=0+1000|gid8=0+1000|gid3=0+1000|gid0=0+1000|gid1=0+1000|gid3584=0+1000|gid3584=2+1000|gid1024=2+1000|gid1=2+1000|gid8=2+1000|gid3=2+1000|gid0=2+1000|gid1=2+1000|gid3584=2+1000] -../fonts/a34a9191d9376bda419836effeef7e75c1386016.ttf:--font-funcs=ot:U+0041:[] -../fonts/a69118c2c2ada48ff803d9149daa54c9ebdae30e.ttf:--font-funcs=ot:U+0041:[gid0=0+1229] -../fonts/b6acef662e0beb8d5fcf5b61c6b0ca69537b7402.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/e88c339237f52d21e01c55f01b9c1b4cc14a0467.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/243798dd281c1c77c065958e1ff467420faa9bde.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/dd9f0c7c7c36f75a18be0cab1cddf8f3ab0f366b.ttf:--font-funcs=ot --no-positions --no-clusters --no-glyph-names:U+0041:[0|0|2|0|0|2|0|0|2|0|0|2|0|0|2|0|0|2|0|0|0|2|0|0|0|2|0|0|2|0|0|2|0|0|2|0|0|2|0|0|0|2|0|0|2|0|0|2|0|0|2|0] -../fonts/ef2511f215aa3ca847cbfffbf861793b42170875.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/9d8a94a67932a3ab75a596fc8b5c6d0392ca9e49.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/bbf4a308c402f0678c3e82844892a4da2ebe598f.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] -../fonts/233c1e252e737ca79e03a9fd56b71aaa4a230f2b.ttf:--font-funcs=ot:U+0041:[gid0=0+1000] +../fonts/1a6f1687b7a221f9f2c834b0b360d3c8463b6daf.ttf:--font-funcs=ot:U+0041:* +../fonts/5a5daf5eb5a4db77a2baa3ad9c7a6ed6e0655fa8.ttf:--font-funcs=ot:U+0041:* +../fonts/0509e80afb379d16560e9e47bdd7d888bebdebc6.ttf:--font-funcs=ot:U+0041:* +../fonts/641bd9db850193064d17575053ae2bf8ec149ddc.ttf:--font-funcs=ot:U+0041:* +../fonts/375d6ae32a3cbe52fbf81a4e5777e3377675d5a3.ttf:--font-funcs=ot:U+0041:* +../fonts/8240789f6d12d4cfc4b5e8e6f246c3701bcf861f.ttf:--font-funcs=ot:U+0041:* +../fonts/b9e2aaa0d75fcef6971ec3a96d806ba4a6b31fe2.ttf:--font-funcs=ot:U+0041:* +../fonts/43979b90b2dd929723cf4fe1715990bcb9c9a56b.ttf:--font-funcs=ot:U+0041:* +../fonts/3511ff5c1647150595846ac414c595cccac34f18.ttf:--font-funcs=ot --no-positions --no-clusters --no-glyph-names:U+0041:* +../fonts/fab39d60d758cb586db5a504f218442cd1395725.ttf:--font-funcs=ot:U+0041,U+0041:* +../fonts/205edd09bd3d141cc9580f650109556cc28b22cb.ttf:--font-funcs=ot:U+0041:* +../fonts/217a934cfe15c548b572c203dceb2befdf026462.ttf:--font-funcs=ot:U+0061,U+0061,U+0061:* +../fonts/558661aa659912f4d30ecd27bd09835171a8e2b0.ttf:--font-funcs=ot:U+FFFD,U+E0100,U+FFFD,U+E0010:* +../fonts/a34a9191d9376bda419836effeef7e75c1386016.ttf:--font-funcs=ot:U+0041:* +../fonts/a69118c2c2ada48ff803d9149daa54c9ebdae30e.ttf:--font-funcs=ot:U+0041:* +../fonts/b6acef662e0beb8d5fcf5b61c6b0ca69537b7402.ttf:--font-funcs=ot:U+0041:* +../fonts/e88c339237f52d21e01c55f01b9c1b4cc14a0467.ttf:--font-funcs=ot:U+0041:* +../fonts/243798dd281c1c77c065958e1ff467420faa9bde.ttf:--font-funcs=ot:U+0041:* +../fonts/dd9f0c7c7c36f75a18be0cab1cddf8f3ab0f366b.ttf:--font-funcs=ot --no-positions --no-clusters --no-glyph-names:U+0041:* +../fonts/ef2511f215aa3ca847cbfffbf861793b42170875.ttf:--font-funcs=ot:U+0041:* +../fonts/9d8a94a67932a3ab75a596fc8b5c6d0392ca9e49.ttf:--font-funcs=ot:U+0041:* +../fonts/bbf4a308c402f0678c3e82844892a4da2ebe598f.ttf:--font-funcs=ot:U+0041:* +../fonts/233c1e252e737ca79e03a9fd56b71aaa4a230f2b.ttf:--font-funcs=ot:U+0041:* diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py index 915536b97..ffe622a2b 100755 --- a/test/shaping/run-tests.py +++ b/test/shaping/run-tests.py @@ -84,7 +84,7 @@ for filename in args: print (":".join ([fontfile, options, unicodes, glyphs1])) continue - if glyphs1.strip() != glyphs_expected.strip(): + if glyphs1.strip() != glyphs_expected.strip() and glyphs_expected.strip() != '*': print ("Actual: " + glyphs1) # file=sys.stderr print ("Expected: " + glyphs_expected) # file=sys.stderr fails = fails + 1 From 6353cc1f83c862910860976411a1157f7ed571bc Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 2 Oct 2018 21:39:19 +0330 Subject: [PATCH 30/30] [circleci] Fix some of warnings from clang-everything bot (#1211) * -Wshift-sign-overflow * -Wmissing-prototypes --- .circleci/config.yml | 4 ++-- src/dump-emoji.cc | 19 ++++++++++--------- src/hb-ucdn.cc | 3 +++ src/test-unicode-ranges.cc | 4 ++-- test/fuzzing/hb-subset-fuzzer.cc | 32 +++++++++++++++++--------------- util/ansi-print.cc | 4 ++-- 6 files changed, 36 insertions(+), 30 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 670efa5ad..3696d2889 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,9 +89,9 @@ jobs: - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list - run: apt update || true - - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libfontconfig1-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro" CXXFLAGS="-Weverything -Wno-undef -Wno-deprecated-declarations -Wno-weak-vtables -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CFLAGS="-Weverything -Wno-reserved-id-macro -Wno-conversion -Wno-padded -Wno-sign-conversion -Wno-cast-qual -Wno-documentation -Wno-documentation-unknown-command" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-c++98-compat -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-sign-conversion -Wno-padded -Wno-shorten-64-to-32 -Wno-extra-semi -Wno-reserved-id-macro -Wno-float-conversion -Wno-format-pedantic -Wno-shadow -Wno-conversion -Wno-zero-as-null-pointer-constant -Wno-missing-field-initializers -Wno-double-promotion -Wno-used-but-marked-unused -Wno-unused-macros -Wno-comma -Wno-float-equal -Wno-disabled-macro-expansion -Wno-weak-vtables -Wno-unused-parameter -Wno-covered-switch-default -Wno-unreachable-code -Wno-deprecated-declarations" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 --with-fontconfig - run: make -j32 CPPFLAGS="-Werror" - run: make check CPPFLAGS="-Werror" || .ci/fail.sh diff --git a/src/dump-emoji.cc b/src/dump-emoji.cc index 65214692f..3e0d668fb 100644 --- a/src/dump-emoji.cc +++ b/src/dump-emoji.cc @@ -45,8 +45,8 @@ #include #include -void cbdt_callback (const uint8_t* data, unsigned int length, - unsigned int group, unsigned int gid) +static void cbdt_callback (const uint8_t* data, unsigned int length, + unsigned int group, unsigned int gid) { char output_path[255]; sprintf (output_path, "out/cbdt-%d-%d.png", group, gid); @@ -55,8 +55,8 @@ void cbdt_callback (const uint8_t* data, unsigned int length, fclose (f); } -void sbix_callback (const uint8_t* data, unsigned int length, - unsigned int group, unsigned int gid) +static void sbix_callback (const uint8_t* data, unsigned int length, + unsigned int group, unsigned int gid) { char output_path[255]; sprintf (output_path, "out/sbix-%d-%d.png", group, gid); @@ -65,8 +65,8 @@ void sbix_callback (const uint8_t* data, unsigned int length, fclose (f); } -void svg_callback (const uint8_t* data, unsigned int length, - unsigned int start_glyph, unsigned int end_glyph) +static void svg_callback (const uint8_t* data, unsigned int length, + unsigned int start_glyph, unsigned int end_glyph) { char output_path[255]; if (start_glyph == end_glyph) @@ -83,8 +83,8 @@ void svg_callback (const uint8_t* data, unsigned int length, fclose (f); } -void colr_cpal_rendering (cairo_font_face_t *cairo_face, unsigned int upem, unsigned int num_glyphs, - const OT::COLR *colr, const OT::CPAL *cpal) +static void colr_cpal_rendering (cairo_font_face_t *cairo_face, unsigned int upem, unsigned int num_glyphs, + const OT::COLR *colr, const OT::CPAL *cpal) { for (unsigned int i = 0; i < num_glyphs; ++i) { @@ -162,7 +162,8 @@ void colr_cpal_rendering (cairo_font_face_t *cairo_face, unsigned int upem, unsi } } -void dump_glyphs (cairo_font_face_t *cairo_face, unsigned int upem, unsigned int num_glyphs) +static void dump_glyphs (cairo_font_face_t *cairo_face, unsigned int upem, + unsigned int num_glyphs) { // Dump every glyph available on the font return; // disabled for now diff --git a/src/hb-ucdn.cc b/src/hb-ucdn.cc index fe45e8f92..41be586c8 100644 --- a/src/hb-ucdn.cc +++ b/src/hb-ucdn.cc @@ -274,6 +274,9 @@ void free_static_ucdn_funcs (void) #endif extern "C" HB_INTERNAL +hb_unicode_funcs_t * +hb_ucdn_get_unicode_funcs (void); + hb_unicode_funcs_t * hb_ucdn_get_unicode_funcs (void) { diff --git a/src/test-unicode-ranges.cc b/src/test-unicode-ranges.cc index 1334ea030..02d12710f 100644 --- a/src/test-unicode-ranges.cc +++ b/src/test-unicode-ranges.cc @@ -28,7 +28,7 @@ #include "hb-ot-os2-unicode-ranges.hh" -void +static void test (hb_codepoint_t cp, unsigned int bit) { if (OT::hb_get_unicode_range_bit (cp) != bit) @@ -41,7 +41,7 @@ test (hb_codepoint_t cp, unsigned int bit) } } -void +static void test_get_unicode_range_bit (void) { test (0x0000, 0); diff --git a/test/fuzzing/hb-subset-fuzzer.cc b/test/fuzzing/hb-subset-fuzzer.cc index 9e4aafca7..649722ce6 100644 --- a/test/fuzzing/hb-subset-fuzzer.cc +++ b/test/fuzzing/hb-subset-fuzzer.cc @@ -6,11 +6,12 @@ #include "hb-subset.h" -void trySubset (hb_face_t *face, - const hb_codepoint_t text[], - int text_length, - bool drop_hints, - bool drop_layout) +static void +trySubset (hb_face_t *face, + const hb_codepoint_t text[], + int text_length, + bool drop_hints, + bool drop_layout) { hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_set_drop_hints (input, drop_hints); @@ -28,16 +29,17 @@ void trySubset (hb_face_t *face, hb_subset_input_destroy (input); } -void trySubset (hb_face_t *face, - const hb_codepoint_t text[], - int text_length) +static void +trySubset (hb_face_t *face, + const hb_codepoint_t text[], + int text_length) { for (unsigned int drop_hints = 0; drop_hints < 2; drop_hints++) { for (unsigned int drop_layout = 0; drop_layout < 2; drop_layout++) { trySubset (face, text, text_length, - (bool) drop_hints, (bool) drop_layout); + (bool) drop_hints, (bool) drop_layout); } } } @@ -45,22 +47,22 @@ void trySubset (hb_face_t *face, extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { hb_blob_t *blob = hb_blob_create ((const char *)data, size, - HB_MEMORY_MODE_READONLY, NULL, NULL); + HB_MEMORY_MODE_READONLY, NULL, NULL); hb_face_t *face = hb_face_create (blob, 0); const hb_codepoint_t text[] = { - 'A', 'B', 'C', 'D', 'E', 'X', 'Y', 'Z', '1', '2', - '3', '@', '_', '%', '&', ')', '*', '$', '!' + 'A', 'B', 'C', 'D', 'E', 'X', 'Y', 'Z', '1', '2', + '3', '@', '_', '%', '&', ')', '*', '$', '!' }; trySubset (face, text, sizeof (text) / sizeof (hb_codepoint_t)); hb_codepoint_t text_from_data[16]; if (size > sizeof(text_from_data)) { - memcpy(text_from_data, - data + size - sizeof(text_from_data), - sizeof(text_from_data)); + memcpy (text_from_data, + data + size - sizeof(text_from_data), + sizeof(text_from_data)); unsigned int text_size = sizeof (text_from_data) / sizeof (hb_codepoint_t); trySubset (face, text_from_data, text_size); } diff --git a/util/ansi-print.cc b/util/ansi-print.cc index 0daee1f02..5e2845cf1 100644 --- a/util/ansi-print.cc +++ b/util/ansi-print.cc @@ -71,7 +71,7 @@ struct color_t { static color_t from_ansi (unsigned int x) { - color_t c = {(0xFF<<24) | ((0xFF*(x&1))<<16) | ((0xFF*((x >> 1)&1))<<8) | (0xFF*((x >> 2)&1))}; + color_t c = {(0xFFu<<24) | ((0xFFu*(x&1))<<16) | ((0xFFu*((x >> 1)&1))<<8) | (0xFFu*((x >> 2)&1))}; return c; } unsigned int to_ansi (void) @@ -223,7 +223,7 @@ struct biimage_t uint8_t * const data; }; -const char * +static const char * block_best (const biimage_t &bi, bool *inverse) { assert (bi.width <= CELL_W);