Don't fail during ValueRecord copy if src has more items

We drop hinting by simply changing ValueFormat, without cleaning
up the actual ValueRecords. This was causing failure at this assert
if font was subsetted without hinting and then passed to mutator.
This commit is contained in:
Behdad Esfahbod 2018-03-26 12:53:21 -07:00
parent 3dbb7f763f
commit d3a6a4e9e4

View File

@ -894,7 +894,8 @@ class ValueRecord(object):
setattr(self, name, None if isDevice else 0) setattr(self, name, None if isDevice else 0)
if src is not None: if src is not None:
for key,val in src.__dict__.items(): for key,val in src.__dict__.items():
assert hasattr(self, key) if not hasattr(self, key):
continue
setattr(self, key, val) setattr(self, key, val)
elif src is not None: elif src is not None:
self.__dict__ = src.__dict__.copy() self.__dict__ = src.__dict__.copy()