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. contextual positioning lookup.
""" """
subtables = [] subtables = []
chaining = False
rulesets = self.rulesets() rulesets = self.rulesets()
chaining = any(ruleset.hasPrefixOrSuffix for ruleset in 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: for ruleset in rulesets:
# Determine format strategy. We try to build formats 1, 2 and 3 # Determine format strategy. We try to build formats 1, 2 and 3
# subtables and then work out which is best. candidates list holds # subtables and then work out which is best. candidates list holds

View File

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

View File

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

View File

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

View File

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

View File

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