Get the fix we want

This commit is contained in:
Martin Hosken 2018-09-07 15:37:33 +07:00
parent 299ae2fb0b
commit 59a4e934ee
7 changed files with 308 additions and 15 deletions

View File

@ -706,7 +706,7 @@ class Builder(object):
key = (self.script_, language, self.cur_feature_name_)
lookups = self.features_.get((key[0], 'dflt', key[2]))
if language != 'dflt' and include_default and lookups:
if (language == 'dflt' or include_default) and lookups:
self.features_[key] = lookups[:]
else:
self.features_[key] = []

View File

@ -65,7 +65,7 @@ class BuilderTest(unittest.TestCase):
spec9a spec9b spec9c1 spec9c2 spec9c3 spec9d spec9e spec9f spec9g
spec10
bug453 bug457 bug463 bug501 bug502 bug504 bug505 bug506 bug509
bug512 bug514 bug568 bug633
bug512 bug514 bug568 bug633 bug1307
name size size2 multiple_feature_blocks omitted_GlyphClassDef
ZeroValue_SinglePos_horizontal ZeroValue_SinglePos_vertical
ZeroValue_PairPos_horizontal ZeroValue_PairPos_vertical

View File

@ -0,0 +1,65 @@
# Test of features and languagesystems
lookup a {
sub a by A;
} a;
lookup b {
sub b by B;
} b;
lookup c {
sub c by C;
} c;
lookup d {
sub d by D;
} d;
lookup e {
sub e by E;
} e;
lookup f {
sub f by F;
} f;
lookup g {
sub g by G;
} g;
lookup h {
sub h by H;
} h;
lookup i {
sub i by I;
} i;
languagesystem DFLT dflt;
languagesystem DFLT FRE;
languagesystem DFLT ABC;
languagesystem latn dflt;
languagesystem latn ABC;
feature smcp {
lookup a;
} smcp;
feature liga {
lookup b;
script DFLT;
lookup c;
language dflt;
lookup d;
language FRE;
lookup e;
script latn;
lookup f;
language dflt;
lookup g;
language FRE;
lookup h;
language DEF exclude_dflt;
lookup i;
} liga;

View File

@ -0,0 +1,215 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont>
<GSUB>
<Version value="0x00010000"/>
<ScriptList>
<!-- ScriptCount=2 -->
<ScriptRecord index="0">
<ScriptTag value="DFLT"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=2 -->
<FeatureIndex index="0" value="4"/>
<FeatureIndex index="1" value="6"/>
</DefaultLangSys>
<!-- LangSysCount=2 -->
<LangSysRecord index="0">
<LangSysTag value="ABC "/>
<LangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=2 -->
<FeatureIndex index="0" value="0"/>
<FeatureIndex index="1" value="6"/>
</LangSys>
</LangSysRecord>
<LangSysRecord index="1">
<LangSysTag value="FRE "/>
<LangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=2 -->
<FeatureIndex index="0" value="2"/>
<FeatureIndex index="1" value="6"/>
</LangSys>
</LangSysRecord>
</Script>
</ScriptRecord>
<ScriptRecord index="1">
<ScriptTag value="latn"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=2 -->
<FeatureIndex index="0" value="5"/>
<FeatureIndex index="1" value="6"/>
</DefaultLangSys>
<!-- LangSysCount=3 -->
<LangSysRecord index="0">
<LangSysTag value="ABC "/>
<LangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=2 -->
<FeatureIndex index="0" value="0"/>
<FeatureIndex index="1" value="6"/>
</LangSys>
</LangSysRecord>
<LangSysRecord index="1">
<LangSysTag value="DEF "/>
<LangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="1"/>
</LangSys>
</LangSysRecord>
<LangSysRecord index="2">
<LangSysTag value="FRE "/>
<LangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="3"/>
</LangSys>
</LangSysRecord>
</Script>
</ScriptRecord>
</ScriptList>
<FeatureList>
<!-- FeatureCount=7 -->
<FeatureRecord index="0">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="1"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="1">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="8"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="2">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=4 -->
<LookupListIndex index="0" value="1"/>
<LookupListIndex index="1" value="2"/>
<LookupListIndex index="2" value="3"/>
<LookupListIndex index="3" value="4"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="3">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=4 -->
<LookupListIndex index="0" value="1"/>
<LookupListIndex index="1" value="5"/>
<LookupListIndex index="2" value="6"/>
<LookupListIndex index="3" value="7"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="4">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=3 -->
<LookupListIndex index="0" value="1"/>
<LookupListIndex index="1" value="2"/>
<LookupListIndex index="2" value="3"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="5">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=3 -->
<LookupListIndex index="0" value="1"/>
<LookupListIndex index="1" value="5"/>
<LookupListIndex index="2" value="6"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="6">
<FeatureTag value="smcp"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
</Feature>
</FeatureRecord>
</FeatureList>
<LookupList>
<!-- LookupCount=9 -->
<Lookup index="0">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="a" out="A"/>
</SingleSubst>
</Lookup>
<Lookup index="1">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="b" out="B"/>
</SingleSubst>
</Lookup>
<Lookup index="2">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="c" out="C"/>
</SingleSubst>
</Lookup>
<Lookup index="3">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="d" out="D"/>
</SingleSubst>
</Lookup>
<Lookup index="4">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="e" out="E"/>
</SingleSubst>
</Lookup>
<Lookup index="5">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="f" out="F"/>
</SingleSubst>
</Lookup>
<Lookup index="6">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="g" out="G"/>
</SingleSubst>
</Lookup>
<Lookup index="7">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="h" out="H"/>
</SingleSubst>
</Lookup>
<Lookup index="8">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="i" out="I"/>
</SingleSubst>
</Lookup>
</LookupList>
</GSUB>
</ttFont>

View File

@ -22,7 +22,7 @@
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="0"/>
<FeatureIndex index="0" value="1"/>
</DefaultLangSys>
<!-- LangSysCount=1 -->
<LangSysRecord index="0">

View File

@ -65,16 +65,18 @@
<FeatureRecord index="0">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=2 -->
<LookupListIndex index="0" value="2"/>
<LookupListIndex index="1" value="3"/>
<!-- LookupCount=3 -->
<LookupListIndex index="0" value="1"/>
<LookupListIndex index="1" value="2"/>
<LookupListIndex index="2" value="3"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="1">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="2"/>
<!-- LookupCount=2 -->
<LookupListIndex index="0" value="1"/>
<LookupListIndex index="1" value="2"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="2">

View File

@ -19,6 +19,11 @@
<ScriptRecord index="1">
<ScriptTag value="cyrl"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="3"/>
</DefaultLangSys>
<!-- LangSysCount=1 -->
<LangSysRecord index="0">
<LangSysTag value="SRB "/>
@ -74,16 +79,20 @@
<FeatureRecord index="0">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=2 -->
<LookupListIndex index="0" value="2"/>
<LookupListIndex index="1" value="3"/>
<!-- LookupCount=4 -->
<LookupListIndex index="0" value="0"/>
<LookupListIndex index="1" value="1"/>
<LookupListIndex index="2" value="2"/>
<LookupListIndex index="3" value="3"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="1">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="4"/>
<!-- LookupCount=3 -->
<LookupListIndex index="0" value="0"/>
<LookupListIndex index="1" value="1"/>
<LookupListIndex index="2" value="4"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="2">
@ -104,8 +113,10 @@
<FeatureRecord index="4">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="2"/>
<!-- LookupCount=3 -->
<LookupListIndex index="0" value="0"/>
<LookupListIndex index="1" value="1"/>
<LookupListIndex index="2" value="2"/>
</Feature>
</FeatureRecord>
</FeatureList>