diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index d749efa690321f9ff2fe566cef4aff9d7bd46d2a..f46b3782ec71218709eb73aee3eebbff02427f0b 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -261,7 +261,7 @@ struct hb_apply_context_t hb_buffer_t *buffer; hb_direction_t direction; hb_mask_t lookup_mask; - bool auto_joiners; + bool auto_zwj; recurse_func_t recurse_func; unsigned int nesting_level_left; unsigned int lookup_props; @@ -274,12 +274,12 @@ struct hb_apply_context_t hb_font_t *font_, hb_buffer_t *buffer_, hb_mask_t lookup_mask_, - bool auto_joiners_) : + bool auto_zwj_) : table_index (table_index_), font (font_), face (font->face), buffer (buffer_), direction (buffer_->props.direction), lookup_mask (lookup_mask_), - auto_joiners (auto_joiners_), + auto_zwj (auto_zwj_), recurse_func (NULL), nesting_level_left (MAX_NESTING_LEVEL), lookup_props (0), @@ -383,16 +383,12 @@ struct hb_apply_context_t end (c->buffer->len) { matcher.set_lookup_props (c->lookup_props); - if (c->auto_joiners) - { - /* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */ - matcher.set_ignore_zwnj (context_match || c->table_index == 1); - matcher.set_ignore_zwj (true); - } + /* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */ + matcher.set_ignore_zwnj (context_match || c->table_index == 1); + /* Ignore ZWJ if we are matching GSUB context, or matching GPOS, or if asked to. */ + matcher.set_ignore_zwj (context_match || c->table_index == 1 || c->auto_zwj); if (!context_match) - { matcher.set_mask (c->lookup_mask); - } matcher.set_syllable (start_index_ == c->buffer->idx ? c->buffer->cur().syllable () : 0); } inline void set_lookup_props (unsigned int lookup_props) { matcher.set_lookup_props (lookup_props); } @@ -457,16 +453,12 @@ struct hb_apply_context_t num_items (num_items_) { matcher.set_lookup_props (c->lookup_props); - if (c->auto_joiners) - { - /* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */ - matcher.set_ignore_zwnj (context_match || c->table_index == 1); - matcher.set_ignore_zwj (true); - } + /* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */ + matcher.set_ignore_zwnj (context_match || c->table_index == 1); + /* Ignore ZWJ if we are matching GSUB context, or matching GPOS, or if asked to. */ + matcher.set_ignore_zwj (context_match || c->table_index == 1 || c->auto_zwj); if (!context_match) - { matcher.set_mask (c->lookup_mask); - } matcher.set_syllable (start_index_ == c->buffer->idx ? c->buffer->cur().syllable () : 0); } inline void set_lookup_props (unsigned int lookup_props) { matcher.set_lookup_props (lookup_props); } diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index d826108c11b07714892033f8668f75f811e6c207..4866c41912530838e61bec0b056f45201679e708 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -207,7 +207,7 @@ hb_ot_layout_substitute_lookup (hb_font_t *font, hb_buffer_t *buffer, unsigned int lookup_index, hb_mask_t mask, - hb_bool_t auto_joiners); + hb_bool_t auto_zwj); /* Should be called after all the substitute_lookup's are done */ HB_INTERNAL void @@ -225,7 +225,7 @@ hb_ot_layout_position_lookup (hb_font_t *font, hb_buffer_t *buffer, unsigned int lookup_index, hb_mask_t mask, - hb_bool_t auto_joiners); + hb_bool_t auto_zwj); /* Should be called after all the position_lookup's are done */ HB_INTERNAL void diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 0349b328d2694b0f07704ab53a9546ba45f53750..8161ce3d9e29fdd248ebe96ebef2f4a5c0aea188 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -667,11 +667,11 @@ hb_ot_layout_substitute_lookup (hb_font_t *font, hb_buffer_t *buffer, unsigned int lookup_index, hb_mask_t mask, - hb_bool_t auto_joiners) + hb_bool_t auto_zwj) { if (unlikely (lookup_index >= hb_ot_layout_from_face (font->face)->gsub_lookup_count)) return false; - OT::hb_apply_context_t c (0, font, buffer, mask, auto_joiners); + OT::hb_apply_context_t c (0, font, buffer, mask, auto_zwj); const OT::SubstLookup& l = hb_ot_layout_from_face (font->face)->gsub->get_lookup (lookup_index); @@ -717,11 +717,11 @@ hb_ot_layout_position_lookup (hb_font_t *font, hb_buffer_t *buffer, unsigned int lookup_index, hb_mask_t mask, - hb_bool_t auto_joiners) + hb_bool_t auto_zwj) { if (unlikely (lookup_index >= hb_ot_layout_from_face (font->face)->gpos_lookup_count)) return false; - OT::hb_apply_context_t c (1, font, buffer, mask, auto_joiners); + OT::hb_apply_context_t c (1, font, buffer, mask, auto_zwj); const OT::PosLookup& l = hb_ot_layout_from_face (font->face)->gpos->get_lookup (lookup_index); diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh index bc825574189dea551f1916229475861c40980644..a679fb5990e99bdbff583f2909e903b758c07ff2 100644 --- a/src/hb-ot-map-private.hh +++ b/src/hb-ot-map-private.hh @@ -50,7 +50,7 @@ struct hb_ot_map_t hb_mask_t mask; hb_mask_t _1_mask; /* mask for value=1, for quick access */ unsigned int needs_fallback : 1; - unsigned int auto_joiners : 1; + unsigned int auto_zwj : 1; static int cmp (const feature_map_t *a, const feature_map_t *b) { return a->tag < b->tag ? -1 : a->tag > b->tag ? 1 : 0; } @@ -58,7 +58,7 @@ struct hb_ot_map_t struct lookup_map_t { unsigned short index; - unsigned short auto_joiners : 1; + unsigned short auto_zwj : 1; hb_mask_t mask; static int cmp (const lookup_map_t *a, const lookup_map_t *b) @@ -139,7 +139,7 @@ struct hb_ot_map_t unsigned int table_index, unsigned int feature_index, hb_mask_t mask, - bool auto_joiners); + bool auto_zwj); hb_mask_t global_mask; @@ -152,7 +152,7 @@ enum hb_ot_map_feature_flags_t { F_NONE = 0x0000, F_GLOBAL = 0x0001, F_HAS_FALLBACK = 0x0002, - F_MANUAL_JOINERS = 0x0004 + F_MANUAL_ZWJ = 0x0004 }; /* Macro version for where const is desired. */ #define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r))) diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc index 28a43a4dd2f8a99b8ebbdb7e92da7a7143c2c6e9..85e6e16375a301147d71998b209dded9b55c4d2f 100644 --- a/src/hb-ot-map.cc +++ b/src/hb-ot-map.cc @@ -34,7 +34,7 @@ hb_ot_map_t::add_lookups (hb_face_t *face, unsigned int table_index, unsigned int feature_index, hb_mask_t mask, - bool auto_joiners) + bool auto_zwj) { unsigned int lookup_indices[32]; unsigned int offset, len; @@ -54,7 +54,7 @@ hb_ot_map_t::add_lookups (hb_face_t *face, return; lookup->mask = mask; lookup->index = lookup_indices[i]; - lookup->auto_joiners = auto_joiners; + lookup->auto_zwj = auto_zwj; } offset += len; @@ -113,7 +113,7 @@ void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, h hb_ot_layout_substitute_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask, - lookups[table_index][i].auto_joiners); + lookups[table_index][i].auto_zwj); buffer->clear_output (); @@ -124,7 +124,7 @@ void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, h for (; i < lookups[table_index].len; i++) hb_ot_layout_substitute_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask, - lookups[table_index][i].auto_joiners); + lookups[table_index][i].auto_zwj); } void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const @@ -137,7 +137,7 @@ void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_ for (; i < pause->num_lookups; i++) hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask, - lookups[table_index][i].auto_joiners); + lookups[table_index][i].auto_zwj); if (pause->callback) pause->callback (plan, font, buffer); @@ -146,7 +146,7 @@ void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_ for (; i < lookups[table_index].len; i++) hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask, - lookups[table_index][i].auto_joiners); + lookups[table_index][i].auto_zwj); } void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const @@ -243,7 +243,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m) map->index[1] = feature_index[1]; map->stage[0] = info->stage[0]; map->stage[1] = info->stage[1]; - map->auto_joiners = !(info->flags & F_MANUAL_JOINERS); + map->auto_zwj = !(info->flags & F_MANUAL_ZWJ); if ((info->flags & F_GLOBAL) && info->max_value == 1) { /* Uses the global bit */ map->shift = 0; @@ -286,7 +286,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m) m.add_lookups (face, table_index, m.features[i].index[table_index], m.features[i].mask, - m.features[i].auto_joiners); + m.features[i].auto_zwj); /* Sort lookups and merge duplicates */ if (last_num_lookups < m.lookups[table_index].len) @@ -300,7 +300,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m) else { m.lookups[table_index][j].mask |= m.lookups[table_index][i].mask; - m.lookups[table_index][j].auto_joiners &= m.lookups[table_index][i].auto_joiners; + m.lookups[table_index][j].auto_zwj &= m.lookups[table_index][i].auto_zwj; } m.lookups[table_index].shrink (j + 1); } diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh index 6f8e9510fe33202d1c6e99163a09125a33d9f481..5e151f757042564afe524e50ba7c280e5816903e 100644 --- a/src/hb-ot-shape-complex-arabic-fallback.hh +++ b/src/hb-ot-shape-complex-arabic-fallback.hh @@ -244,7 +244,7 @@ arabic_fallback_plan_shape (arabic_fallback_plan_t *fallback_plan, { for (unsigned int i = 0; i < ARABIC_NUM_FALLBACK_FEATURES; i++) if (fallback_plan->lookup_array[i]) { - OT::hb_apply_context_t c (0, font, buffer, fallback_plan->mask_array[i], true/*auto_joiners*/); + OT::hb_apply_context_t c (0, font, buffer, fallback_plan->mask_array[i], true/*auto_zwj*/); fallback_plan->lookup_array[i]->apply_string (&c, &fallback_plan->digest_array[i]); } } diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index ddb18390faab9c0b175c6ce32e6d0e64dff3c92d..eb1e0be9defec9fe889967910650a7cbf8c04f4a 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -339,18 +339,18 @@ indic_features[] = * Basic features. * These features are applied in order, one at a time, after initial_reordering. */ - {HB_TAG('n','u','k','t'), F_COMBINE (F_MANUAL_JOINERS, F_GLOBAL)}, - {HB_TAG('a','k','h','n'), F_COMBINE (F_MANUAL_JOINERS, F_GLOBAL)}, - {HB_TAG('r','p','h','f'), F_COMBINE (F_MANUAL_JOINERS, F_NONE )}, - {HB_TAG('r','k','r','f'), F_COMBINE (F_MANUAL_JOINERS, F_GLOBAL)}, - {HB_TAG('p','r','e','f'), F_COMBINE (F_MANUAL_JOINERS, F_NONE )}, - {HB_TAG('b','l','w','f'), F_COMBINE (F_MANUAL_JOINERS, F_NONE )}, - {HB_TAG('h','a','l','f'), F_COMBINE (F_MANUAL_JOINERS, F_NONE )}, - {HB_TAG('a','b','v','f'), F_COMBINE (F_MANUAL_JOINERS, F_NONE )}, - {HB_TAG('p','s','t','f'), F_COMBINE (F_MANUAL_JOINERS, F_NONE )}, - {HB_TAG('c','f','a','r'), F_COMBINE (F_MANUAL_JOINERS, F_NONE )}, - {HB_TAG('v','a','t','u'), F_COMBINE (F_MANUAL_JOINERS, F_GLOBAL)}, - {HB_TAG('c','j','c','t'), F_COMBINE (F_MANUAL_JOINERS, F_GLOBAL)}, + {HB_TAG('n','u','k','t'), F_GLOBAL}, + {HB_TAG('a','k','h','n'), F_GLOBAL}, + {HB_TAG('r','p','h','f'), F_NONE}, + {HB_TAG('r','k','r','f'), F_GLOBAL}, + {HB_TAG('p','r','e','f'), F_NONE}, + {HB_TAG('b','l','w','f'), F_NONE}, + {HB_TAG('h','a','l','f'), F_NONE}, + {HB_TAG('a','b','v','f'), F_NONE}, + {HB_TAG('p','s','t','f'), F_NONE}, + {HB_TAG('c','f','a','r'), F_NONE}, + {HB_TAG('v','a','t','u'), F_GLOBAL}, + {HB_TAG('c','j','c','t'), F_GLOBAL}, /* * Other features. * These features are applied all at once, after final_reordering. @@ -428,12 +428,12 @@ collect_features_indic (hb_ot_shape_planner_t *plan) unsigned int i = 0; map->add_gsub_pause (initial_reordering); for (; i < INDIC_BASIC_FEATURES; i++) { - map->add_feature (indic_features[i].tag, 1, indic_features[i].flags); + map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ); map->add_gsub_pause (NULL); } map->add_gsub_pause (final_reordering); for (; i < INDIC_NUM_FEATURES; i++) { - map->add_feature (indic_features[i].tag, 1, indic_features[i].flags); + map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ); } } @@ -1021,7 +1021,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, /* ZWJ/ZWNJ should disable CJCT. They do that by simply * being there, since we don't skip them for the CJCT - * feature (ie. F_MANUAL_JOINERS) */ + * feature (ie. F_MANUAL_ZWJ) */ /* A ZWNJ disables HALF. */ if (non_joiner) diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index 8491047b71262ca0fb8547ffdd481ff29de78573..ff13bdd1ebe2d16540aa01a5a7c60168a2a02768 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -92,12 +92,12 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan) map->add_gsub_pause (initial_reordering); for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) { - map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_JOINERS); + map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ); map->add_gsub_pause (NULL); } map->add_gsub_pause (final_reordering); for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) - map->add_feature (other_features[i], 1, F_GLOBAL); + map->add_feature (other_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ); } static void diff --git a/src/hb-ot-shape-complex-sea.cc b/src/hb-ot-shape-complex-sea.cc index 94386588f70e3376bc34e88b5cef7c570d03be47..9c0c303e3dfa1a7ff480c5c64047f58954a88469 100644 --- a/src/hb-ot-shape-complex-sea.cc +++ b/src/hb-ot-shape-complex-sea.cc @@ -93,12 +93,12 @@ collect_features_sea (hb_ot_shape_planner_t *plan) map->add_gsub_pause (initial_reordering); for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++) { - map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_JOINERS); + map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ); map->add_gsub_pause (NULL); } map->add_gsub_pause (final_reordering); for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++) - map->add_feature (other_features[i], 1, F_GLOBAL); + map->add_feature (other_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ); } static void diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index afe0f392cc73f4e136bc58280c63587ab76d8df4..3341825449bd38274e6536f02a119901594c5eb9 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -420,7 +420,7 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, hb_mask_t kern_mask = plan->map.get_1_mask (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction) ? HB_TAG ('k','e','r','n') : HB_TAG ('v','k','r','n')); - OT::hb_apply_context_t c (1, font, buffer, kern_mask, true/*auto_joiners*/); + OT::hb_apply_context_t c (1, font, buffer, kern_mask, true/*auto_zwj*/); c.set_lookup_props (OT::LookupFlag::IgnoreMarks); for (buffer->idx = 0; buffer->idx < count;) diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt index 35ce9521e3517642511f6cd6f711e80ebfad798b..aa435908612003f635256426f7a386676b128432 100644 --- a/test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt +++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-bengali/misc/misc.txt @@ -50,3 +50,4 @@ ন্ত্র ত্যু চ্য্র +ক্‍ষ diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt index 78fdeb858a451878a52844ad2e533ca332a76bfa..c5144f0fa7fc115c8240aea345321a1a101c9b5b 100644 --- a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt +++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt @@ -61,3 +61,4 @@ ല്‍പ്പേ ശിം‌ കോം‌ +യ‍്യ