Compute correct LookupType when compiling font

Also ensures that all subtables of a lookup have the same
lookup type.
This commit is contained in:
Behdad Esfahbod 2013-12-17 02:42:18 -05:00
parent ea82d6dfd1
commit 5fec22bfcd
2 changed files with 8 additions and 0 deletions

View File

@ -568,6 +568,9 @@ class BaseTable(object):
if hasattr(self, 'sortCoverageLast'):
writer.sortCoverageLast = 1
if hasattr(self.__class__, 'LookupType'):
writer['LookupType'].setValue(self.__class__.LookupType)
self.writeFormat(writer)
for conv in self.getConverters():
value = table.get(conv.name)
@ -594,6 +597,10 @@ class BaseTable(object):
table[conv.name] = None
if conv.isPropagated:
writer[conv.name] = ref
elif conv.isLookupType:
ref = writer.writeCountReference(table, conv.name)
table[conv.name] = None
writer['LookupType'] = ref
else:
if conv.aux and not eval(conv.aux, None, table):
continue

View File

@ -61,6 +61,7 @@ class BaseConverter(object):
self.aux = aux
self.tableClass = tableClass
self.isCount = name.endswith("Count")
self.isLookupType = name.endswith("LookupType")
self.isPropagated = name in ["ClassCount", "Class2Count", "FeatureTag"]
def read(self, reader, font, tableDict):