Revert "[ttGlyphSet] Must deep copy var components when instantiating"
This reverts commit fe6f5bd14386d0a1f546d079f1ec38e4d2414fbf. Better fix.
This commit is contained in:
parent
fe6f5bd143
commit
51d7524a23
@ -2010,6 +2010,7 @@ class GlyphVarComponent(object):
|
||||
i += 1
|
||||
self.location = newLocation
|
||||
|
||||
self.transform = DecomposedTransform()
|
||||
if self.flags & (
|
||||
VarComponentFlags.HAVE_TRANSLATE_X | VarComponentFlags.HAVE_TRANSLATE_Y
|
||||
):
|
||||
|
@ -3,7 +3,7 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from collections.abc import Mapping
|
||||
from contextlib import contextmanager
|
||||
from copy import copy, deepcopy
|
||||
from copy import copy
|
||||
from types import SimpleNamespace
|
||||
from fontTools.misc.fixedTools import otRound
|
||||
from fontTools.misc.loggingTools import deprecateFunction
|
||||
@ -288,14 +288,12 @@ def _setCoordinates(glyph, coord, glyfTable):
|
||||
|
||||
if glyph.isComposite():
|
||||
assert len(coord) == len(glyph.components)
|
||||
# Shallow copy is enough: all attributes that we change are scalars
|
||||
glyph.components = [copy(comp) for comp in glyph.components]
|
||||
glyph.components = [copy(comp) for comp in glyph.components] # Shallow copy
|
||||
for p, comp in zip(coord, glyph.components):
|
||||
if hasattr(comp, "x"):
|
||||
comp.x, comp.y = p
|
||||
elif glyph.isVarComposite():
|
||||
# Deep copy needed because we mutate comp.transform and comp.location
|
||||
glyph.components = [deepcopy(comp) for comp in glyph.components]
|
||||
glyph.components = [copy(comp) for comp in glyph.components] # Shallow copy
|
||||
for comp in glyph.components:
|
||||
coord = comp.setCoordinates(coord)
|
||||
assert not coord
|
||||
|
Loading…
x
Reference in New Issue
Block a user