From 342ae3dc04b1c380c624d41cfdd6f9a53a5aadc5 Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Fri, 17 Apr 2015 09:58:48 -0700 Subject: Don't try generating TTF if OTF generation fails. Closes #3 --- scripts/lib/fontbuild/Build.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/lib/fontbuild/Build.py b/scripts/lib/fontbuild/Build.py index 79171bd..da44109 100644 --- a/scripts/lib/fontbuild/Build.py +++ b/scripts/lib/fontbuild/Build.py @@ -183,9 +183,7 @@ class FontProject: log(">> Generating OTF file") newFont = OpenFont(ufoName) otfName = self.generateOutputPath(f, "otf") - saveOTF(newFont, otfName, autohint=self.autohintOTF) - - if self.buildTTF: + if saveOTF(newFont, otfName, autohint=self.autohintOTF) and self.buildTTF: log(">> Generating TTF file") import fontforge otFont = fontforge.open(otfName) @@ -275,7 +273,10 @@ def removeGlyphOverlap(glyph): def saveOTF(font, destFile, autohint=False): - """Save a RoboFab font as an OTF binary using ufo2fdk.""" + """Save a RoboFab font as an OTF binary using ufo2fdk. + + Returns True on success, False otherwise. + """ from ufo2fdk import OTFCompiler @@ -294,3 +295,7 @@ def saveOTF(font, destFile, autohint=False): if autohint: print reports["autohint"] print reports["makeotf"] + + successMsg = ("makeotfexe [NOTE] Wrote new font file '%s'." % + os.path.basename(destFile)) + return successMsg in reports["makeotf"] -- cgit v1.2.3