[otBase] Delete .Format if was introduced by .preWrite()
https://github.com/fonttools/fonttools/pull/2238#issuecomment-805192631
This commit is contained in:
parent
2a483f9856
commit
6243a24a09
@ -654,9 +654,15 @@ class BaseTable(object):
|
||||
|
||||
def compile(self, writer, font):
|
||||
self.ensureDecompiled()
|
||||
# TODO Following hack to be removed by rewriting how FormatSwitching tables
|
||||
# are handled.
|
||||
# https://github.com/fonttools/fonttools/pull/2238#issuecomment-805192631
|
||||
if hasattr(self, 'preWrite'):
|
||||
deleteFormat = not hasattr(self, 'Format')
|
||||
table = self.preWrite(font)
|
||||
deleteFormat = deleteFormat and hasattr(self, 'Format')
|
||||
else:
|
||||
deleteFormat = False
|
||||
table = self.__dict__.copy()
|
||||
|
||||
# some count references may have been initialized in a custom preWrite; we set
|
||||
@ -740,6 +746,9 @@ class BaseTable(object):
|
||||
if conv.isPropagated:
|
||||
writer[conv.name] = value
|
||||
|
||||
if deleteFormat:
|
||||
del self.Format
|
||||
|
||||
def readFormat(self, reader):
|
||||
pass
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user