[feaLib] "subtable" in multiple substitutions
This commit is contained in:
parent
c87e5cf4ad
commit
d9893ab05a
@ -1345,8 +1345,19 @@ class MultipleSubstBuilder(LookupBuilder):
|
|||||||
self.mapping == other.mapping)
|
self.mapping == other.mapping)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
subtable = otl.buildMultipleSubstSubtable(self.mapping)
|
subtables = []
|
||||||
return self.buildLookup_([subtable])
|
mapping = {}
|
||||||
|
for key in self.mapping:
|
||||||
|
if key[0] == self.SUBTABLE_BREAK_:
|
||||||
|
subtables.append(otl.buildMultipleSubstSubtable(mapping))
|
||||||
|
mapping = {}
|
||||||
|
else:
|
||||||
|
mapping[key] = self.mapping[key]
|
||||||
|
subtables.append(otl.buildMultipleSubstSubtable(mapping))
|
||||||
|
return self.buildLookup_(subtables)
|
||||||
|
|
||||||
|
def add_subtable_break(self, location):
|
||||||
|
self.mapping[(self.SUBTABLE_BREAK_, location)] = self.SUBTABLE_BREAK_
|
||||||
|
|
||||||
|
|
||||||
class CursivePosBuilder(LookupBuilder):
|
class CursivePosBuilder(LookupBuilder):
|
||||||
|
@ -71,7 +71,7 @@ class BuilderTest(unittest.TestCase):
|
|||||||
ZeroValue_PairPos_horizontal ZeroValue_PairPos_vertical
|
ZeroValue_PairPos_horizontal ZeroValue_PairPos_vertical
|
||||||
ZeroValue_ChainSinglePos_horizontal ZeroValue_ChainSinglePos_vertical
|
ZeroValue_ChainSinglePos_horizontal ZeroValue_ChainSinglePos_vertical
|
||||||
PairPosSubtable ChainSubstSubtable ChainPosSubtable LigatureSubtable
|
PairPosSubtable ChainSubstSubtable ChainPosSubtable LigatureSubtable
|
||||||
AlternateSubtable
|
AlternateSubtable MultipleSubstSubtable
|
||||||
""".split()
|
""".split()
|
||||||
|
|
||||||
def __init__(self, methodName):
|
def __init__(self, methodName):
|
||||||
|
5
Tests/feaLib/data/MultipleSubstSubtable.fea
Normal file
5
Tests/feaLib/data/MultipleSubstSubtable.fea
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
feature test {
|
||||||
|
sub c_t by c t;
|
||||||
|
subtable;
|
||||||
|
sub f_i by f i;
|
||||||
|
} test;
|
46
Tests/feaLib/data/MultipleSubstSubtable.ttx
Normal file
46
Tests/feaLib/data/MultipleSubstSubtable.ttx
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ttFont>
|
||||||
|
|
||||||
|
<GSUB>
|
||||||
|
<Version value="0x00010000"/>
|
||||||
|
<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=1 -->
|
||||||
|
<LookupListIndex index="0" value="0"/>
|
||||||
|
</Feature>
|
||||||
|
</FeatureRecord>
|
||||||
|
</FeatureList>
|
||||||
|
<LookupList>
|
||||||
|
<!-- LookupCount=1 -->
|
||||||
|
<Lookup index="0">
|
||||||
|
<LookupType value="2"/>
|
||||||
|
<LookupFlag value="0"/>
|
||||||
|
<!-- SubTableCount=2 -->
|
||||||
|
<MultipleSubst index="0">
|
||||||
|
<Substitution in="c_t" out="c,t"/>
|
||||||
|
</MultipleSubst>
|
||||||
|
<MultipleSubst index="1">
|
||||||
|
<Substitution in="f_i" out="f,i"/>
|
||||||
|
</MultipleSubst>
|
||||||
|
</Lookup>
|
||||||
|
</LookupList>
|
||||||
|
</GSUB>
|
||||||
|
|
||||||
|
</ttFont>
|
Loading…
x
Reference in New Issue
Block a user