Skip to content

Instantly share code, notes, and snippets.

@benkiel
Created June 11, 2015 22:04

Revisions

  1. benkiel created this gist Jun 11, 2015.
    17 changes: 17 additions & 0 deletions simplify_components.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    fonts = AllFonts()
    for font in fonts:
    for g in font:
    if len(g.components) != 0:

    for c in g.components:
    b = font[c.baseGlyph]
    if len(b.components) != 0:
    e = b.components[0]
    eb = e.baseGlyph
    bx, by = c.offset
    ex, ey = e.offset
    g.removeComponent(c)
    nx = ex + bx
    ny = ey + by
    g.appendComponent(eb, (nx, ny))
    g.mark = (1,0,0,1)