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):
try: shouldDecompose = self.name == comp.glyphName
pen.addVarComponent(
comp.glyphName, transform, self.glyphSet.rawLocation if not shouldDecompose:
) try:
except AttributeError: pen.addVarComponent(
comp.glyphName, transform, self.glyphSet.rawLocation
)
except AttributeError:
shouldDecompose = True
if shouldDecompose:
t = transform.toTransform() t = transform.toTransform()
compGlyphSet = ( compGlyphSet = (
self.glyphSet self.glyphSet