diff --git a/Lib/fontTools/ttLib/tables/_g_l_y_f.py b/Lib/fontTools/ttLib/tables/_g_l_y_f.py index eac773b4a..7689d9b12 100644 --- a/Lib/fontTools/ttLib/tables/_g_l_y_f.py +++ b/Lib/fontTools/ttLib/tables/_g_l_y_f.py @@ -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 ): diff --git a/Lib/fontTools/ttLib/ttGlyphSet.py b/Lib/fontTools/ttLib/ttGlyphSet.py index c2521dc51..12afd4cae 100644 --- a/Lib/fontTools/ttLib/ttGlyphSet.py +++ b/Lib/fontTools/ttLib/ttGlyphSet.py @@ -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