Skip to content

Instantly share code, notes, and snippets.

from robofab.world import *
f = CurrentFont()
for i in f.selection:
if f[i].width == 1000:
f[i].mark = 10
f.update()
from robofab.world import *
f = CurrentFont()
for i in f.selection:
if f[i].box[0] < 40:
f[i].mark = 10
if f[i].box[0] > 960 :
f[i].mark[2] = 10
@marcdama
marcdama / Add Below Marks to selection
Last active August 29, 2015 14:19
Devanagari add dBottom to glyphs which do not have this anchor
from robofab.world import *
f = CurrentFont()
g_anc = {}
for i in f.selection:
g_anc[f[i].name] = []
for j in f[i].anchors:
g_anc[f[i].name].append(j.name)
@marcdama
marcdama / Add anchors to base
Last active August 29, 2015 14:19
add anchors to base glyph
from robofab.world import *
f = CurrentFont()
f['BASE'].appendAnchor('dTop',(311,591))
f['BASE'].appendAnchor('dCand',(311,631))
f['BASE'].appendAnchor('dBottom',(311,-20))
f['BASE'].appendAnchor('dNukta',(0,100))
f.update()
print 'done'
@marcdama
marcdama / gist:b765c7fcc7274239e6a5
Created April 19, 2015 14:09
From selected glyphs: Print individual glyphs components/order and structure to be remade with FL Generate glyph (CTRL+G)
from robofab.world import *
f = CurrentFont()
def flat_list(*n):
stringer = ''
if len(n) == 1:
stringer += str(n[0])
return stringer
@marcdama
marcdama / FL: From selected Glyphs: Highlight Component Glyphs used to build the selected glyphs
Last active August 29, 2015 14:19
FL: From selected Glyphs: Highlight Component Glyphs used to build the selected glyphs
from robofab.world import *
f = CurrentFont()
g = f.selection[0]
for i in f:
for j in i.components:
if j.baseGlyph == g:
i.mark = 1
from robofab.world import *
f = AllFonts()
unis = [i.unicode for i in f[0]]
for i in f[1]:
if i.unicode in unis:
i.mark = 1
@marcdama
marcdama / FL: For Selected Glyphs: intelligently make glyph fixed width
Created April 21, 2015 13:09
Convert glyphs to fixed width (1000) optically
from robofab.world import *
f = CurrentFont()
for i in f.selection:
w = 1000 - f[i].width
f[i].leftMargin += w/2
f[i].rightMargin += w/2
f.update()
@marcdama
marcdama / FL: All Glyphs: replace outline with advanced width square
Last active August 29, 2015 14:19
FL: All Glyphs: replace outline with advanced width square
from robofab.world import *
f=CurrentFont()
for i in f:
g = i.width
h = f.insertGlyph(i).getPen()
h.moveTo((0,0))
h.lineTo((g,0))
h.lineTo((g, 750))
@marcdama
marcdama / FL: for selected glyphs: Center glyph vertically, according to specified box
Created April 24, 2015 11:42
FL: for selected glyphs: Center glyph vertically, according to specified box
from robofab.world import *
f = CurrentFont()
top = 880
bottom = -120
for i in f.selection:
glyf_h = f[i].box[3]- f[i].box[1]
t_s = top - f[i].box[3] #distance from top of bbox