Created
May 10, 2012 21:28
-
-
Save charlesmchen/2656019 to your computer and use it in GitHub Desktop.
Robofab Write Otf Sample Logic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import robofab.world | |
from ufo2fdk import haveFDK | |
from ufo2fdk import OTFCompiler | |
font = robofab.world.OpenFont('<path to ufo file>') | |
font.update() | |
font.autoUnicodes() | |
font.update() | |
dstFolder = os.path.abspath(os.path.join('..', 'data', 'ufo-out')) | |
print 'dstFolder', dstFolder | |
if not os.path.exists(dstFolder): | |
os.mkdir(dstFolder) | |
filename = font.info.fullName | |
dstFile = os.path.join(dstFolder, filename + '.otf') | |
print 'dstFile', dstFile | |
if haveFDK(): | |
print "I found the FDK!" | |
else: | |
print "I'm sorry, I could not find the FDK." | |
compiler = OTFCompiler() | |
reports = compiler.compile(font, dstFile, checkOutlines=True, autohint=True) | |
print reports["checkOutlines"] | |
print reports["autohint"] | |
print reports["makeotf"] | |
font.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment