Skip to content

Instantly share code, notes, and snippets.

@line0
Created January 9, 2015 22:09
Show Gist options
  • Save line0/717d0229b9f604a0c9bf to your computer and use it in GitHub Desktop.
Save line0/717d0229b9f604a0c9bf to your computer and use it in GitHub Desktop.
fontlab macro: apply texture
def process(f, g, t, index):
fl.SetUndo(index)
upm = f.upm
g.RemoveOverlap()
outlines = Glyph(g)
g.Distance(upm/100, upm/100, 1)
g.RemoveOverlap()
outlines.Bsubtract(t)
g.Bsubtract(outlines)
fl.UpdateGlyph(index)
return 1
texture = next(glyph for glyph in fl.font.glyphs if glyph.name == "texture")
glyphs = fl.font.glyphs
for index in range(len(glyphs)):
if fl.Selected(index) and index != fl.iglyph :
process(fl.font, glyphs[index], texture, index)
fl.UpdateGlyph(index)
process(fl.font, glyphs[fl.iglyph], texture, fl.iglyph)
fl.UpdateGlyph()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment