[ttLib] Add Value.getEffectiveFormat()
This ignores 0/None values that don't need to be encoded.
This commit is contained in:
parent
8ab6af03c8
commit
830cff6253
@ -970,6 +970,13 @@ class ValueRecord(object):
|
|||||||
format = format | valueRecordFormatDict[name][0]
|
format = format | valueRecordFormatDict[name][0]
|
||||||
return format
|
return format
|
||||||
|
|
||||||
|
def getEffectiveFormat(self):
|
||||||
|
format = 0
|
||||||
|
for name,value in self.__dict__.items():
|
||||||
|
if value:
|
||||||
|
format = format | valueRecordFormatDict[name][0]
|
||||||
|
return format
|
||||||
|
|
||||||
def toXML(self, xmlWriter, font, valueName, attrs=None):
|
def toXML(self, xmlWriter, font, valueName, attrs=None):
|
||||||
if attrs is None:
|
if attrs is None:
|
||||||
simpleItems = []
|
simpleItems = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user