Created
June 11, 2015 22:04
-
-
Save benkiel/1dd89c4781f0a2ca060b to your computer and use it in GitHub Desktop.
Walks all open fonts and looks for a component that is a reference of another component. Is dumb and assumes that there is only one component the reference. Good for quickly cleaning up UFOs before importing into FontLab, where this sort of thing isn't allowed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment