Command line/batch processing of UFO to OTF?

Primary tabs

6 posts / 0 new
Last post
Blank's picture
Offline
Joined: 25 Sep 2006 - 2:15pm
Command line/batch processing of UFO to OTF?
0

I’m getting really tired of waiting for Fontlab to open a batch of UFO files. Aside from Area 51 are there any apps/scripts that can quickly convert a batch of UFO files to OTF or some other format Fontlab reads natively? Can I do this from the command line with FontForge?

Tal Leming's picture
Offline
Joined: 6 Feb 2006 - 7:23pm
0

I don't think a command line tool has been created yet. You could make one easily using the ufo2fdk package that I released last week. In fact, the demo script from my presentation might be a good starting point for you. It is included below. (Replace the "...." with the appropriate white space.)

Alternatively, you could use the batch generator in Area51.


from robofab.world import OpenFont
import ufo2fdk
import glob
import os

# path to the fonts
directory = "/path/to/a/directory/containing/ufos"

# print a message if the FDK can't be found
if not ufo2fdk.haveFDK():
....print "I couldn't find the FDK :-(!"
# if the FDK is available
else:
....# start the compiler
....compiler = ufo2fdk.OTFCompiler()

....# for each UFO in the directory
....for ufoPath in glob.glob(os.path.join(directory, "*.ufo")):
........print "Compiling: %s..." % os.path.basename(ufoPath)
........# put the OTF next to the UFO
........otfPath = os.path.splitext(ufoPath)[0] + ".otf"
........# open the UFO
........font = OpenFont(ufoPath)
........# compile
........report = compiler.compile(font, otfPath)
........# print the makeotf report
........print report["makeotf"]

# done
print "Done!"

Blank's picture
Offline
Joined: 25 Sep 2006 - 2:15pm
0

Thanks, Tal. I’m actually planning to update to 10.5 this week just to use Area51 for batch UFO generation.

Nagar's picture
Offline
Joined: 4 Mar 2012 - 10:07am
0

I try to compile my UFO font to OTF as explained above but it doesn't work because my UFO font is not complete.

I'm working on a project where typography is gradually created. Thus, I don't have a complete UFO font but I have to create the OTF to display the progress…

Does anyone have an idea for this case?

Thank you very much.

Reynir Heiðberg Stefánsson's picture
Joined: 19 Nov 2010 - 11:15am
0

Can you do it with FontForge? Yes, I'm pretty sure you can. FF can read UFO, and it handles scripts, both Python and its own old scripting language.

Nagar's picture
Offline
Joined: 4 Mar 2012 - 10:07am
0

I work without FontForge. The project is a website and everything (all the process) must be launched online. Of course, it's very difficult to install FontForge on my webhosting…

Otherwise, you're right. Fontforge can do that.