Skip to content

Instantly share code, notes, and snippets.

@okay-type
Created September 17, 2024 18:35
Show Gist options
  • Save okay-type/c8b09f538521d2accb287c1205162c92 to your computer and use it in GitHub Desktop.
Save okay-type/c8b09f538521d2accb287c1205162c92 to your computer and use it in GitHub Desktop.
Decomposed nested components one level. In robofont, obvs.
f = CurrentFont()
for g in f.selectedGlyphs:
if len(g.components) > 0:
with g.undo('Nested Decompose ' + g.name):
for component in g.components:
baseGlyph = f[component.baseGlyph]
if len(baseGlyph.components) > 0:
pen = g.getPointPen()
baseGlyph.drawPoints(pen)
g.removeComponent(component)
else:
component.decompose()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment