Don't emit addVarComponent() if the component references the parent glyph (special case)

This commit is contained in:
Just van Rossum 2024-04-23 08:51:01 +02:00 committed by Behdad Esfahbod
parent 973dc5c9a7
commit 77add05f7f

View File

@ -355,11 +355,17 @@ class _TTGlyphVARC(_TTGlyph):
reset = comp.flags & VarComponentFlags.RESET_UNSPECIFIED_AXES reset = comp.flags & VarComponentFlags.RESET_UNSPECIFIED_AXES
with self.glyphSet.glyphSet.pushLocation(location, reset): with self.glyphSet.glyphSet.pushLocation(location, reset):
with self.glyphSet.pushLocation(location, reset): with self.glyphSet.pushLocation(location, reset):
shouldDecompose = self.name == comp.glyphName
if not shouldDecompose:
try: try:
pen.addVarComponent( pen.addVarComponent(
comp.glyphName, transform, self.glyphSet.rawLocation comp.glyphName, transform, self.glyphSet.rawLocation
) )
except AttributeError: except AttributeError:
shouldDecompose = True
if shouldDecompose:
t = transform.toTransform() t = transform.toTransform()
compGlyphSet = ( compGlyphSet = (
self.glyphSet self.glyphSet