Created
September 10, 2014 09:51
-
-
Save line0/52514b260c78b35eae30 to your computer and use it in GitHub Desktop.
Fontlab script: adds texture to selected glyphs by intersecting them with a glyph named "texture"
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
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