Typophile

Question: Batch import EPS in Fontlab

Hi everybody,
Is there a Python script that can batch import multiple EPS files in Fontlab. Searched all over the internet, and found nothing. I need just basic functionality - start from a new empty typeface and import EPS files in sequential mode, no encoding just in index mode. Any ideas! Thank you in advance!

Not sure exactly how your EPS files are set up, but ScanFont works great for moving art from .ai or .eps files into FontLab. Unfortunately, it doesn't work on Mac running Lion or Mountain Lion yet. They do have options for those in that boat, though.

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."

Thank you Adam! You are great! I will test it right away!

Oh it works like charm! Thank you again!

Vassil,

You needn't add to Adam's sense of self-worth: the jaunty hat says it all…

Oh Nick,
very deep inside, I am...
;)

twardoch,
Can you explain how to use the script you posted? I want to batch import a bunch of eps files into fontlab, but I'm not sure how to use that script. Thanks for any direction you can give.

frankrolf the link is broken :(

Mark Simonson Scanfont runs as a WINE version, but I've tried several different EPS files and none seem to be able to import into the program.

all you need to do is paste Adam's code into a macro window and hit the "run" button.
There's some instruction on basic script use in the manual, I believe.

Jason C

Thanks Jason, I got it to work.

Captured from commoncrawl.org on 25 Apr 2015. original URL