[varLib.merger] avoid reusing the same Class2Record (mutable) objects
Class2Record is mutable, hence doing `[rec2] * l.Class2Count` produces a list containing multiple references to the same instance. When later on we do the interpolation, modifying one would modify them all.
We need to instantiate distinct objects.
See 6f41c2ab53 (commitcomment-21310803)
This commit is contained in:
parent
d83c2fb209
commit
e6125b353e
@ -379,11 +379,13 @@ def _PairPosFormat2_merge(self, lst, merger):
|
||||
exemplarGlyph = next(iter(classSet))
|
||||
if exemplarGlyph not in coverage:
|
||||
if nullRow is None:
|
||||
nullRow = ot.Class1Record()
|
||||
class2records = nullRow.Class2Record = []
|
||||
for _ in range(l.Class2Count):
|
||||
rec2 = ot.Class2Record()
|
||||
rec2.Value1 = otBase.ValueRecord(l.ValueFormat1) if l.ValueFormat1 else None
|
||||
rec2.Value2 = otBase.ValueRecord(l.ValueFormat2) if l.ValueFormat2 else None
|
||||
nullRow = ot.Class1Record()
|
||||
nullRow.Class2Record = [rec2] * l.Class2Count
|
||||
class2records.append(rec2)
|
||||
rec1 = nullRow
|
||||
else:
|
||||
klass = classDef1.get(exemplarGlyph, 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user