Question: Batch import EPS in Fontlab

Primary tabs

13 posts / 0 new
Last post
Vassil Kateliev's picture
Offline
Joined: 5 Jun 2007 - 7:40am
Question: Batch import EPS in Fontlab
0

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!

Frank Grießhammer's picture
Joined: 18 Nov 2008 - 6:57am
0
Mark Simonson's picture
Offline
Joined: 3 Dec 2001 - 11:00am
0

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.

Adam Twardoch's picture
Offline
Joined: 3 Dec 2002 - 7:36pm
0

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

Vassil Kateliev's picture
Offline
Joined: 5 Jun 2007 - 7:40am
0

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

Vassil Kateliev's picture
Offline
Joined: 5 Jun 2007 - 7:40am
0

Oh it works like charm! Thank you again!

Nick Curtis's picture
Offline
Joined: 21 Apr 2005 - 8:16am
0

Vassil,

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

Adam Twardoch's picture
Offline
Joined: 3 Dec 2002 - 7:36pm
0

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

Ben Dunkle's picture
Offline
Joined: 13 Sep 2011 - 9:37pm
0

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.

Ben Dunkle's picture
Offline
Joined: 13 Sep 2011 - 9:37pm
0

frankrolf the link is broken :(

Ben Dunkle's picture
Offline
Joined: 13 Sep 2011 - 9:37pm
0

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.

Jason Campbell's picture
Offline
Joined: 8 Oct 2005 - 11:52am
0

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

Ben Dunkle's picture
Offline
Joined: 13 Sep 2011 - 9:37pm
0

Thanks Jason, I got it to work.