diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 298367fc5..25853c164 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -712,53 +712,60 @@ struct hb_ot_apply_context_t : return true; } - void _set_glyph_props (hb_codepoint_t glyph_index, + void _set_glyph_class (hb_codepoint_t glyph_index, unsigned int class_guess = 0, bool ligature = false, bool component = false) const { - unsigned int add_in = _hb_glyph_info_get_glyph_props (&buffer->cur()) & - HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE; - add_in |= HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED; + unsigned int props = _hb_glyph_info_get_glyph_props (&buffer->cur()); + props |= HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED; if (ligature) { - add_in |= HB_OT_LAYOUT_GLYPH_PROPS_LIGATED; + props |= HB_OT_LAYOUT_GLYPH_PROPS_LIGATED; /* In the only place that the MULTIPLIED bit is used, Uniscribe * seems to only care about the "last" transformation between * Ligature and Multiple substitutions. Ie. if you ligate, expand, * and ligate again, it forgives the multiplication and acts as * if only ligation happened. As such, clear MULTIPLIED bit. */ - add_in &= ~HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED; + props &= ~HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED; } if (component) - add_in |= HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED; + props |= HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED; if (likely (has_glyph_classes)) - _hb_glyph_info_set_glyph_props (&buffer->cur(), add_in | gdef.get_glyph_props (glyph_index)); + { + props &= HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE; + _hb_glyph_info_set_glyph_props (&buffer->cur(), props | gdef.get_glyph_props (glyph_index)); + } else if (class_guess) - _hb_glyph_info_set_glyph_props (&buffer->cur(), add_in | class_guess); + { + props &= HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE; + _hb_glyph_info_set_glyph_props (&buffer->cur(), props | class_guess); + } + else + _hb_glyph_info_set_glyph_props (&buffer->cur(), props); } void replace_glyph (hb_codepoint_t glyph_index) const { - _set_glyph_props (glyph_index); + _set_glyph_class (glyph_index); (void) buffer->replace_glyph (glyph_index); } void replace_glyph_inplace (hb_codepoint_t glyph_index) const { - _set_glyph_props (glyph_index); + _set_glyph_class (glyph_index); buffer->cur().codepoint = glyph_index; } void replace_glyph_with_ligature (hb_codepoint_t glyph_index, unsigned int class_guess) const { - _set_glyph_props (glyph_index, class_guess, true); + _set_glyph_class (glyph_index, class_guess, true); (void) buffer->replace_glyph (glyph_index); } void output_glyph_for_component (hb_codepoint_t glyph_index, unsigned int class_guess) const { - _set_glyph_props (glyph_index, class_guess, false, true); + _set_glyph_class (glyph_index, class_guess, false, true); (void) buffer->output_glyph (glyph_index); } }; diff --git a/test/shape/data/in-house/Makefile.sources b/test/shape/data/in-house/Makefile.sources index 2432d89fb..01047d548 100644 --- a/test/shape/data/in-house/Makefile.sources +++ b/test/shape/data/in-house/Makefile.sources @@ -19,6 +19,7 @@ TESTS = \ tests/emoji.tests \ tests/emoji-clusters.tests \ tests/fallback-positioning.tests \ + tests/glyph-props-no-gdef.tests \ tests/hangul-jamo.tests \ tests/hyphens.tests \ tests/indic-consonant-with-stacker.tests \ @@ -45,6 +46,7 @@ TESTS = \ tests/myanmar-misc.tests \ tests/myanmar-syllable.tests \ tests/myanmar-zawgyi.tests \ + tests/nested-mark-filtering-sets.tests \ tests/none-directional.tests \ tests/positioning-features.tests \ tests/rand.tests \ diff --git a/test/shape/data/in-house/fonts/FallbackPlus-Javanese-no-GDEF.otf b/test/shape/data/in-house/fonts/FallbackPlus-Javanese-no-GDEF.otf new file mode 100644 index 000000000..45896c104 Binary files /dev/null and b/test/shape/data/in-house/fonts/FallbackPlus-Javanese-no-GDEF.otf differ diff --git a/test/shape/data/in-house/fonts/NotoNastaliqUrdu-Regular.ttf b/test/shape/data/in-house/fonts/NotoNastaliqUrdu-Regular.ttf new file mode 100644 index 000000000..cd01de0d1 Binary files /dev/null and b/test/shape/data/in-house/fonts/NotoNastaliqUrdu-Regular.ttf differ diff --git a/test/shape/data/in-house/meson.build b/test/shape/data/in-house/meson.build index 121635ede..cda01d490 100644 --- a/test/shape/data/in-house/meson.build +++ b/test/shape/data/in-house/meson.build @@ -19,6 +19,7 @@ in_house_tests_base = [ 'emoji.tests', 'emoji-clusters.tests', 'fallback-positioning.tests', + 'glyph-props-no-gdef.tests', 'hangul-jamo.tests', 'hyphens.tests', 'indic-consonant-with-stacker.tests', @@ -45,6 +46,7 @@ in_house_tests_base = [ 'myanmar-misc.tests', 'myanmar-syllable.tests', 'myanmar-zawgyi.tests', + 'nested-mark-filtering-sets.tests', 'none-directional.tests', 'positioning-features.tests', 'rand.tests', diff --git a/test/shape/data/in-house/tests/glyph-props-no-gdef.tests b/test/shape/data/in-house/tests/glyph-props-no-gdef.tests new file mode 100644 index 000000000..27bcbd530 --- /dev/null +++ b/test/shape/data/in-house/tests/glyph-props-no-gdef.tests @@ -0,0 +1 @@ +../fonts/FallbackPlus-Javanese-no-GDEF.otf;;U+A995,U+A9BF;[glyph01=0+600|uniA995=0+600] diff --git a/test/shape/data/in-house/tests/nested-mark-filtering-sets.tests b/test/shape/data/in-house/tests/nested-mark-filtering-sets.tests new file mode 100644 index 000000000..7de938289 --- /dev/null +++ b/test/shape/data/in-house/tests/nested-mark-filtering-sets.tests @@ -0,0 +1,4 @@ +../fonts/NotoNastaliqUrdu-Regular.ttf;;U+0628,U+0628,U+6D2;[OneDotBelowYB=2@764,-183+0|YBc1=2@764,-282+0|YehBarreeFin_3=2+355|OneDotBelowNS=1@20,-120+0|BehxMed.inT2outD2YB=1@0,349+182|NullMk=0+0|sp10=0+0|BehxIni.outT2=0@0,406+766] +../fonts/NotoNastaliqUrdu-Regular.ttf;;U+0628,U+0628,U+0628,U+6D2;[OneDotBelowYB=3@764,-183+0|YBc1=3@764,-282+0|OneDotBelowYB=3@1098,-60+0|YBc2=3@1098,-159+0|YehBarreeFin_4=3+355|OneDotBelowNS=2@20,-120+0|BehxMed.inT2outD2YB=2@0,349+182|NullMk=1+0|BehxMed.inT1outT2=1@0,406+184|NullMk=0+0|sp5=0+0|BehxIni=0@0,471+541] +../fonts/NotoNastaliqUrdu-Regular.ttf;;U+0628,U+0628,U+0628,U+0628,U+6D2;[OneDotBelowYB=4@659,-192+0|YBc1=4@659,-291+0|OneDotBelowYB=4@966,-55+0|YBc2=4@966,-154+0|OneDotBelowYB=4@1274,-148+0|YBc3=4@1274,-247+0|YehBarreeFin_5=4+355|OneDotBelowNS=3@20,-120+0|BehxMed.inT2outD2YB=3@0,349+182|NullMk=2+0|BehxMed.inT1outT2=2@0,406+184|NullMk=1+0|BehxMed.inT2outT1=1@0,471+267|NullMk=0+0|sp0=0+0|BehxIni.outT2=0@0,616+156] +../fonts/NotoNastaliqUrdu-Regular.ttf;;U+0628,U+0628,U+0628,U+0628,U+0628,U+6D2;[OneDotBelowYB=5@659,-192+0|YBc1=5@659,-291+0|OneDotBelowYB=5@966,-55+0|YBc2=5@966,-154+0|OneDotBelowYB=5@1274,-148+0|YBc3=5@1274,-247+0|YehBarreeFin_5=5+355|OneDotBelowNS=4@20,-120+0|BehxMed.inT2outD2YB=4@0,349+182|NullMk=3+0|BehxMed.inT1outT2=3@0,406+184|NullMk=2+0|BehxMed.inT2outT1=2@0,471+267|NullMk=1+0|BehxMed.inT1outT2=1@0,616+184|OneDotBelowNS=0@73,516+0|sp0=0+0|BehxIni=0@0,681+236]