Skip to content

Commit

Permalink
Don't emit addVarComponent() if the component references the parent g…
Browse files Browse the repository at this point in the history
…lyph (special case)
  • Loading branch information
justvanrossum committed Apr 23, 2024
1 parent 7193680 commit 040f333
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Lib/fontTools/ttLib/ttGlyphSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,17 @@ def _draw(self, pen, isPointPen):
reset = comp.flags & VarComponentFlags.RESET_UNSPECIFIED_AXES
with self.glyphSet.glyphSet.pushLocation(location, reset):
with self.glyphSet.pushLocation(location, reset):
try:
pen.addVarComponent(
comp.glyphName, transform, self.glyphSet.rawLocation
)
except AttributeError:
shouldDecompose = self.name == comp.glyphName

if not shouldDecompose:
try:
pen.addVarComponent(
comp.glyphName, transform, self.glyphSet.rawLocation
)
except AttributeError:
shouldDecompose = True

if shouldDecompose:
t = transform.toTransform()
compGlyphSet = (
self.glyphSet
Expand Down

0 comments on commit 040f333

Please sign in to comment.