[feaLib] Do not emit empty GSUB and GPOS tables

The AFDKO `makeotf` tool does not emit empty tables, either.
This commit is contained in:
Sascha Brawer 2015-12-07 21:37:42 +01:00
parent 3433f363e7
commit bdc72e1198
13 changed files with 8 additions and 158 deletions

View File

@ -32,8 +32,14 @@ class Builder(object):
parsetree = Parser(self.featurefile_path).parse()
parsetree.build(self)
for tag in ('GPOS', 'GSUB'):
fontTable = self.font[tag] = getTableClass(tag)()
fontTable.table = self.makeTable(tag)
table = self.makeTable(tag)
if (table.ScriptList.ScriptCount > 0 or
table.FeatureList.FeatureCount > 0 or
table.LookupList.LookupCount > 0):
fontTable = self.font[tag] = getTableClass(tag)()
fontTable.table = table
elif self.font.has_key(tag):
del self.font[tag]
def get_lookup_(self, location, builder_class):
if (self.cur_lookup_ and

View File

@ -1,19 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont>
<GSUB>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>

View File

@ -1,19 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont>
<GSUB>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>

View File

@ -50,17 +50,4 @@
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GPOS>
</ttFont>

View File

@ -59,17 +59,4 @@
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GPOS>
</ttFont>

View File

@ -126,17 +126,4 @@
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GPOS>
</ttFont>

View File

@ -136,17 +136,4 @@
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GPOS>
</ttFont>

View File

@ -59,17 +59,4 @@
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GPOS>
</ttFont>

View File

@ -151,17 +151,4 @@
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GPOS>
</ttFont>

View File

@ -59,17 +59,4 @@
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GPOS>
</ttFont>

View File

@ -55,17 +55,4 @@
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GPOS>
</ttFont>

View File

@ -119,17 +119,4 @@
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GPOS>
</ttFont>

View File

@ -51,17 +51,4 @@
</LookupList>
</GSUB>
<GPOS>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GPOS>
</ttFont>