Merge pull request #3365 from harfbuzz/gdef-fix

GDEF fix
This commit is contained in:
Behdad Esfahbod 2022-01-19 06:56:05 -08:00 committed by GitHub
commit c8195dbc01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 13 deletions

View File

@ -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);
}
};

View File

@ -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 \

View File

@ -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',

View File

@ -0,0 +1 @@
../fonts/FallbackPlus-Javanese-no-GDEF.otf;;U+A995,U+A9BF;[glyph01=0+600|uniA995=0+600]

View File

@ -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]