Disable GSUB5 optimization (#2540)

* Disable GSUB5/GPOS7 optimization

* Revert "Fixup test expectations"

This reverts commit 7db13c9872884772312727e3478fb36ed9883004.

* Revert "Rename GPOS8->GPOS7"

This reverts commit 6d4c5fe31c9199e6d3e46cd0808e7640d1610e75.

* Revert "Fix varlib test expectations - now badly named."

This reverts commit 4adea942cc73b6afe58e00278da6cb3795935970.

* Allow GSUB5, disable GPOS7

* Revert "Revert "Fixup test expectations""

This reverts commit 42993ae6917f8f6e4c31f4be123caca24d27d2da.

* Fix up expectations
This commit is contained in:
Simon Cozens 2022-04-08 15:54:34 +01:00 committed by GitHub
parent 7ee2c9d891
commit 2d62a2ac9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 49 deletions

View File

@ -367,9 +367,15 @@ class ChainContextualBuilder(LookupBuilder):
contextual positioning lookup.
"""
subtables = []
chaining = False
rulesets = self.rulesets()
chaining = any(ruleset.hasPrefixOrSuffix for ruleset in rulesets)
# Unfortunately, as of 2022-03-07, Apple's CoreText renderer does not
# correctly process GPOS7 lookups, so for now we force contextual
# positioning lookups to be chaining (GPOS8).
if self.subtable_type == "Pos": # horrible separation of concerns breach
chaining = True
for ruleset in rulesets:
# Determine format strategy. We try to build formats 1, 2 and 3
# subtables and then work out which is best. candidates list holds

View File

@ -112,23 +112,25 @@
</MarkBasePos>
</Lookup>
<Lookup index="2">
<LookupType value="7"/>
<LookupType value="8"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<ContextPos index="0" Format="3">
<!-- GlyphCount=3 -->
<!-- PosCount=2 -->
<Coverage index="0">
<ChainContextPos index="0" Format="3">
<!-- BacktrackGlyphCount=0 -->
<!-- InputGlyphCount=3 -->
<InputCoverage index="0">
<Glyph value="T"/>
</Coverage>
<Coverage index="1">
</InputCoverage>
<InputCoverage index="1">
<Glyph value="c"/>
<Glyph value="o"/>
</Coverage>
<Coverage index="2">
</InputCoverage>
<InputCoverage index="2">
<Glyph value="grave"/>
<Glyph value="acute"/>
</Coverage>
</InputCoverage>
<!-- LookAheadGlyphCount=0 -->
<!-- PosCount=2 -->
<PosLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="0"/>
@ -137,7 +139,7 @@
<SequenceIndex value="2"/>
<LookupListIndex value="1"/>
</PosLookupRecord>
</ContextPos>
</ChainContextPos>
</Lookup>
</LookupList>
</GPOS>

View File

@ -30,23 +30,25 @@
<LookupList>
<!-- LookupCount=2 -->
<Lookup index="0">
<LookupType value="7"/>
<LookupType value="8"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<ContextPos index="0" Format="3">
<!-- GlyphCount=2 -->
<!-- PosCount=1 -->
<Coverage index="0">
<ChainContextPos index="0" Format="3">
<!-- BacktrackGlyphCount=0 -->
<!-- InputGlyphCount=2 -->
<InputCoverage index="0">
<Glyph value="L"/>
</Coverage>
<Coverage index="1">
</InputCoverage>
<InputCoverage index="1">
<Glyph value="quoteright"/>
</Coverage>
</InputCoverage>
<!-- LookAheadGlyphCount=0 -->
<!-- PosCount=1 -->
<PosLookupRecord index="0">
<SequenceIndex value="1"/>
<LookupListIndex value="1"/>
</PosLookupRecord>
</ContextPos>
</ChainContextPos>
</Lookup>
<Lookup index="1">
<LookupType value="1"/>

View File

@ -83,21 +83,23 @@
</MarkBasePos>
</Lookup>
<Lookup index="2">
<LookupType value="7"/>
<LookupType value="8"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<ContextPos index="0" Format="1">
<ChainContextPos index="0" Format="1">
<Coverage>
<Glyph value="A"/>
</Coverage>
<!-- PosRuleSetCount=1 -->
<PosRuleSet index="0">
<!-- PosRuleCount=1 -->
<PosRule index="0">
<!-- GlyphCount=3 -->
<!-- PosCount=2 -->
<!-- ChainPosRuleSetCount=1 -->
<ChainPosRuleSet index="0">
<!-- ChainPosRuleCount=1 -->
<ChainPosRule index="0">
<!-- BacktrackGlyphCount=0 -->
<!-- InputGlyphCount=3 -->
<Input index="0" value="a"/>
<Input index="1" value="uni0303"/>
<!-- LookAheadGlyphCount=0 -->
<!-- PosCount=2 -->
<PosLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="0"/>
@ -106,9 +108,9 @@
<SequenceIndex value="2"/>
<LookupListIndex value="1"/>
</PosLookupRecord>
</PosRule>
</PosRuleSet>
</ContextPos>
</ChainPosRule>
</ChainPosRuleSet>
</ChainContextPos>
</Lookup>
</LookupList>
</GPOS>

View File

@ -83,21 +83,23 @@
</MarkBasePos>
</Lookup>
<Lookup index="2">
<LookupType value="7"/>
<LookupType value="8"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<ContextPos index="0" Format="1">
<ChainContextPos index="0" Format="1">
<Coverage>
<Glyph value="A"/>
</Coverage>
<!-- PosRuleSetCount=1 -->
<PosRuleSet index="0">
<!-- PosRuleCount=1 -->
<PosRule index="0">
<!-- GlyphCount=3 -->
<!-- PosCount=2 -->
<!-- ChainPosRuleSetCount=1 -->
<ChainPosRuleSet index="0">
<!-- ChainPosRuleCount=1 -->
<ChainPosRule index="0">
<!-- BacktrackGlyphCount=0 -->
<!-- InputGlyphCount=3 -->
<Input index="0" value="a"/>
<Input index="1" value="uni0303"/>
<!-- LookAheadGlyphCount=0 -->
<!-- PosCount=2 -->
<PosLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="0"/>
@ -106,9 +108,9 @@
<SequenceIndex value="2"/>
<LookupListIndex value="1"/>
</PosLookupRecord>
</PosRule>
</PosRuleSet>
</ContextPos>
</ChainPosRule>
</ChainPosRuleSet>
</ChainContextPos>
</Lookup>
</LookupList>
</GPOS>

View File

@ -746,8 +746,8 @@ class InterpolateLayoutTest(unittest.TestCase):
self.check_ttx_dump(instfont, expected_ttx_path, tables, suffix)
def test_varlib_interpolate_layout_GPOS_only_LookupType_7_same_val_ttf(self):
"""Only GPOS; LookupType 7; same values in all masters.
def test_varlib_interpolate_layout_GPOS_only_LookupType_8_same_val_ttf(self):
"""Only GPOS; LookupType 8; same values in all masters.
"""
suffix = '.ttf'
ds_path = self.get_test_input('InterpolateLayout.designspace')
@ -779,13 +779,13 @@ class InterpolateLayoutTest(unittest.TestCase):
instfont = interpolate_layout(ds_path, {'weight': 500}, finder)
tables = ['GPOS']
expected_ttx_path = self.get_test_output('InterpolateLayoutGPOS_7_same.ttx')
expected_ttx_path = self.get_test_output('InterpolateLayoutGPOS_8_same.ttx')
self.expect_ttx(instfont, expected_ttx_path, tables)
self.check_ttx_dump(instfont, expected_ttx_path, tables, suffix)
def test_varlib_interpolate_layout_GPOS_only_LookupType_7_diff_val_ttf(self):
"""Only GPOS; LookupType 7; different values in each master.
def test_varlib_interpolate_layout_GPOS_only_LookupType_8_diff_val_ttf(self):
"""Only GPOS; LookupType 8; different values in each master.
"""
suffix = '.ttf'
ds_path = self.get_test_input('InterpolateLayout.designspace')
@ -831,7 +831,7 @@ class InterpolateLayoutTest(unittest.TestCase):
instfont = interpolate_layout(ds_path, {'weight': 500}, finder)
tables = ['GPOS']
expected_ttx_path = self.get_test_output('InterpolateLayoutGPOS_7_diff.ttx')
expected_ttx_path = self.get_test_output('InterpolateLayoutGPOS_8_diff.ttx')
self.expect_ttx(instfont, expected_ttx_path, tables)
self.check_ttx_dump(instfont, expected_ttx_path, tables, suffix)