[feaLib] Reverse lookup order for chained alternate substitutions

For this construct, makeotf throws an error: "Contextual alternate
rule not yet supported". If it had been implemented, we speculate
that the ordering would likely be the same as with other contextual
substitutions (the chain comes before, not after, the dependent lookup).

https://github.com/behdad/fonttools/issues/507
This commit is contained in:
Sascha Brawer 2016-02-04 14:34:45 +01:00
parent e8a4b341f3
commit 7574260bed
2 changed files with 14 additions and 14 deletions

View File

@ -493,8 +493,8 @@ class Builder(object):
alts.update(replacement)
return
if prefix or suffix:
lookup = self.get_chained_lookup_(location, AlternateSubstBuilder)
chain = self.get_lookup_(location, ChainContextSubstBuilder)
lookup = self.get_chained_lookup_(location, AlternateSubstBuilder)
chain.substitutions.append((prefix, [glyph], suffix, [lookup]))
else:
lookup = self.get_lookup_(location, AlternateSubstBuilder)

View File

@ -25,7 +25,7 @@
<!-- LookupCount=5 -->
<LookupListIndex index="0" value="1"/>
<LookupListIndex index="1" value="4"/>
<LookupListIndex index="2" value="6"/>
<LookupListIndex index="2" value="5"/>
<LookupListIndex index="3" value="7"/>
<LookupListIndex index="4" value="9"/>
</Feature>
@ -155,17 +155,6 @@
</ChainContextSubst>
</Lookup>
<Lookup index="5">
<!-- LookupType=3 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<AlternateSubst index="0">
<AlternateSet glyph="e">
<Alternate glyph="e"/>
<Alternate glyph="e.begin"/>
</AlternateSet>
</AlternateSubst>
</Lookup>
<Lookup index="6">
<!-- LookupType=6 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
@ -184,10 +173,21 @@
<!-- SubstCount=1 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="5"/>
<LookupListIndex value="6"/>
</SubstLookupRecord>
</ChainContextSubst>
</Lookup>
<Lookup index="6">
<!-- LookupType=3 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<AlternateSubst index="0">
<AlternateSet glyph="e">
<Alternate glyph="e"/>
<Alternate glyph="e.begin"/>
</AlternateSet>
</AlternateSubst>
</Lookup>
<Lookup index="7">
<!-- LookupType=6 -->
<LookupFlag value="0"/>