feaLib: ignore empty named lookup reference

Fixes #2276
This commit is contained in:
Cosimo Lupo 2021-04-22 13:11:57 +01:00
parent bd618d0117
commit 9b5bc9e18b
2 changed files with 61 additions and 1 deletions

View File

@ -1005,7 +1005,8 @@ class Builder(object):
assert lookup_name in self.named_lookups_, lookup_name assert lookup_name in self.named_lookups_, lookup_name
self.cur_lookup_ = None self.cur_lookup_ = None
lookup = self.named_lookups_[lookup_name] lookup = self.named_lookups_[lookup_name]
self.add_lookup_to_feature_(lookup, self.cur_feature_name_) if lookup is not None: # skip empty named lookup
self.add_lookup_to_feature_(lookup, self.cur_feature_name_)
def set_font_revision(self, location, revision): def set_font_revision(self, location, revision):
self.fontRevision_ = revision self.fontRevision_ = revision

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.22">
<GSUB>
<Version value="0x00010000"/>
<ScriptList>
<!-- ScriptCount=1 -->
<ScriptRecord index="0">
<ScriptTag value="DFLT"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=2 -->
<FeatureIndex index="0" value="0"/>
<FeatureIndex index="1" value="1"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
</ScriptList>
<FeatureList>
<!-- FeatureCount=2 -->
<FeatureRecord index="0">
<FeatureTag value="aalt"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="1">
<FeatureTag value="ss01"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="1"/>
</Feature>
</FeatureRecord>
</FeatureList>
<LookupList>
<!-- LookupCount=2 -->
<Lookup index="0">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="a" out="a.alt1"/>
</SingleSubst>
</Lookup>
<Lookup index="1">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="a" out="a.alt1"/>
</SingleSubst>
</Lookup>
</LookupList>
</GSUB>
</ttFont>