Sascha Brawer ec9077a566 [feaLib] Merge SingleSubst chain targets
This makes the output of feaLib more compact, using a similar technique
as seems to be used by makeotf.

After this change, feaLib generates output that more similar to makeotf:

* For the test cases in `bug512.fea` and `bug463.fea`, feaLib now
  generates the exact same output as makeotf v2.0.90.

* For the test cases in `GSUB_6.fea`, it is hard to say because makeotf
  crashes on the test file; our test contains language constructs that
  are valid according to the spec, but didn't yet get implemented by makeotf.
  When commenting out those constructs, feaLib generates the exact same
  output as makeotf v2.0.90.

* For the test cases in `feature_aalt.fea`, the output of feaLib is now
  structually the same as the output of makeotf v2.0.90.  However, two
  lookups are in different order. feaLib's ordering reflects the order
  of statements in the compiled input source; no idea why makeotf would
  want to reverse the ordering. Since this ordering difference only
  affects the _targets_ of chain substitutions, there is no semantic
  difference.

Resolves https://github.com/behdad/fonttools/issues/512.
2016-02-05 15:12:07 +01:00

268 lines
8.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<ttFont>
<GSUB>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=1 -->
<ScriptRecord index="0">
<ScriptTag value="DFLT"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="0"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
</ScriptList>
<FeatureList>
<!-- FeatureCount=1 -->
<FeatureRecord index="0">
<FeatureTag value="test"/>
<Feature>
<!-- LookupCount=5 -->
<LookupListIndex index="0" value="0"/>
<LookupListIndex index="1" value="2"/>
<LookupListIndex index="2" value="4"/>
<LookupListIndex index="3" value="6"/>
<LookupListIndex index="4" value="8"/>
</Feature>
</FeatureRecord>
</FeatureList>
<LookupList>
<!-- LookupCount=9 -->
<Lookup index="0">
<!-- LookupType=6 -->
<LookupFlag value="0"/>
<!-- SubTableCount=2 -->
<ChainContextSubst index="0" Format="3">
<!-- BacktrackGlyphCount=2 -->
<BacktrackCoverage index="0">
<Glyph value="three"/>
</BacktrackCoverage>
<BacktrackCoverage index="1">
<Glyph value="one"/>
<Glyph value="two"/>
</BacktrackCoverage>
<!-- InputGlyphCount=1 -->
<InputCoverage index="0">
<Glyph value="A"/>
</InputCoverage>
<!-- LookAheadGlyphCount=0 -->
<!-- SubstCount=1 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="1"/>
</SubstLookupRecord>
</ChainContextSubst>
<ChainContextSubst index="1" Format="3">
<!-- BacktrackGlyphCount=0 -->
<!-- InputGlyphCount=1 -->
<InputCoverage index="0">
<Glyph value="B"/>
<Glyph value="C"/>
<Glyph value="D"/>
</InputCoverage>
<!-- LookAheadGlyphCount=2 -->
<LookAheadCoverage index="0">
<Glyph value="seven"/>
</LookAheadCoverage>
<LookAheadCoverage index="1">
<Glyph value="eight"/>
<Glyph value="nine"/>
</LookAheadCoverage>
<!-- SubstCount=1 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="1"/>
</SubstLookupRecord>
</ChainContextSubst>
</Lookup>
<Lookup index="1">
<!-- LookupType=1 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="A" out="A.sc"/>
<Substitution in="B" out="B.sc"/>
<Substitution in="C" out="C.sc"/>
<Substitution in="D" out="D.sc"/>
</SingleSubst>
</Lookup>
<Lookup index="2">
<!-- LookupType=6 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<ChainContextSubst index="0" Format="3">
<!-- BacktrackGlyphCount=3 -->
<BacktrackCoverage index="0">
<Glyph value="E"/>
</BacktrackCoverage>
<BacktrackCoverage index="1">
<Glyph value="D"/>
<Glyph value="d"/>
</BacktrackCoverage>
<BacktrackCoverage index="2">
<Glyph value="A"/>
<Glyph value="B"/>
<Glyph value="C"/>
<Glyph value="a"/>
<Glyph value="b"/>
<Glyph value="c"/>
</BacktrackCoverage>
<!-- InputGlyphCount=1 -->
<InputCoverage index="0">
<Glyph value="c_t"/>
</InputCoverage>
<!-- LookAheadGlyphCount=3 -->
<LookAheadCoverage index="0">
<Glyph value="V"/>
</LookAheadCoverage>
<LookAheadCoverage index="1">
<Glyph value="W"/>
<Glyph value="w"/>
</LookAheadCoverage>
<LookAheadCoverage index="2">
<Glyph value="X"/>
<Glyph value="Y"/>
<Glyph value="Z"/>
<Glyph value="x"/>
<Glyph value="y"/>
<Glyph value="z"/>
</LookAheadCoverage>
<!-- SubstCount=1 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="3"/>
</SubstLookupRecord>
</ChainContextSubst>
</Lookup>
<Lookup index="3">
<!-- LookupType=2 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<MultipleSubst index="0">
<Substitution in="c_t" out="c,t"/>
</MultipleSubst>
</Lookup>
<Lookup index="4">
<!-- LookupType=6 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<ChainContextSubst index="0" Format="3">
<!-- BacktrackGlyphCount=1 -->
<BacktrackCoverage index="0">
<Glyph value="space"/>
<Glyph value="semicolon"/>
<Glyph value="comma"/>
</BacktrackCoverage>
<!-- InputGlyphCount=1 -->
<InputCoverage index="0">
<Glyph value="e"/>
</InputCoverage>
<!-- LookAheadGlyphCount=0 -->
<!-- SubstCount=1 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="5"/>
</SubstLookupRecord>
</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 -->
<ChainContextSubst index="0" Format="3">
<!-- BacktrackGlyphCount=1 -->
<BacktrackCoverage index="0">
<Glyph value="A"/>
</BacktrackCoverage>
<!-- InputGlyphCount=2 -->
<InputCoverage index="0">
<Glyph value="C"/>
<Glyph value="c"/>
</InputCoverage>
<InputCoverage index="1">
<Glyph value="T"/>
<Glyph value="t"/>
</InputCoverage>
<!-- LookAheadGlyphCount=1 -->
<LookAheadCoverage index="0">
<Glyph value="Z"/>
</LookAheadCoverage>
<!-- SubstCount=1 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="7"/>
</SubstLookupRecord>
</ChainContextSubst>
</Lookup>
<Lookup index="7">
<!-- LookupType=4 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<LigatureSubst index="0">
<LigatureSet glyph="C">
<Ligature components="T" glyph="c_t"/>
<Ligature components="t" glyph="c_t"/>
</LigatureSet>
<LigatureSet glyph="c">
<Ligature components="T" glyph="c_t"/>
<Ligature components="t" glyph="c_t"/>
</LigatureSet>
</LigatureSubst>
</Lookup>
<Lookup index="8">
<!-- LookupType=6 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<ChainContextSubst index="0" Format="3">
<!-- BacktrackGlyphCount=3 -->
<BacktrackCoverage index="0">
<Glyph value="E"/>
</BacktrackCoverage>
<BacktrackCoverage index="1">
<Glyph value="D"/>
</BacktrackCoverage>
<BacktrackCoverage index="2">
<Glyph value="A"/>
</BacktrackCoverage>
<!-- InputGlyphCount=1 -->
<InputCoverage index="0">
<Glyph value="c_t"/>
</InputCoverage>
<!-- LookAheadGlyphCount=3 -->
<LookAheadCoverage index="0">
<Glyph value="V"/>
</LookAheadCoverage>
<LookAheadCoverage index="1">
<Glyph value="W"/>
</LookAheadCoverage>
<LookAheadCoverage index="2">
<Glyph value="X"/>
</LookAheadCoverage>
<!-- SubstCount=1 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="2"/>
</SubstLookupRecord>
</ChainContextSubst>
</Lookup>
</LookupList>
</GSUB>
</ttFont>