Quantcast
Viewing all articles
Browse latest Browse all 20084

This will ask you for a

In reply to Question: Batch import EPS in Fontlab:

This will ask you for a folder, find all ".eps" files in it and import them sequentially into the current font, using the basename of each file (without the ".eps" extension) as the glyph name. Should be enough to get you started, I hope.

#FLM: Import EPS glyphs from folder
import os.path, glob
f = fl.font
folder = fl.GetPathName("Choose folder with EPS files...")
pathmask = "*.eps"
paths = []
for globmask in [pathmask, pathmask.upper()]: 
  paths += glob.glob(os.path.join(folder, globmask))
paths = sorted(list(set(paths)))
print "Importing EPS files from %s..." % (folder)
for path in paths: 
  basename = os.path.splitext(os.path.split(path)[1])[0]
  try: 
    g = Glyph()
    g = g.LoadEPS(path)
    g.name = basename
    g.mark = 33
    f.glyphs.append(g)
    print "%s.eps imported" % (basename)
  except: 
    print "%s.eps IGNORED" % (basename)
fl.UpdateFont(fl.ifont)
print "Finished."

Viewing all articles
Browse latest Browse all 20084

Trending Articles