Author Topic: so i was wandering...  (Read 2152 times)

inde

  • Full Member
  • ***
  • Posts: 2
so i was wandering...
« on: 2012-09-28, 17:20:41 »
Script to generate SALT classes according to marker color?

something like the logic bellow

if (markerColor == "blue"){
$ClassBlue.append(this.name)
}...else if ... red


Thank you for your ideas!

Eigi

  • Beta: FontLab Studio Mac
  • Hero Member
  • ***
  • Posts: 100
    • e-font
Re: so i was wandering...
« Reply #1 on: 2012-12-08, 12:14:40 »
Hello,

The folowing code creates or updates a class with all glyphs which share the same mark as the current glyph:
Code: [Select]
classDict = dict([(c.split(':',1)[0], c.split(':',1)[1].strip()) for c in fl.font.classes])
classDict['mark_%s' % fl.glyph.mark] = ' '.join([g.name for g in fl.font.glyphs if g.mark == fl.glyph.mark])
fl.font.classes = ['%s: %s' % (i[0], i[1]) for i in classDict.items()]
fl.UpdateFont(fl.ifont)