summaryrefslogtreecommitdiff
path: root/scripts/lib/fontbuild
diff options
context:
space:
mode:
authorJames Godfrey-Kittle <jamesgk@google.com>2015-04-17 09:58:48 -0700
committerjamesgk <jamesgk19@gmail.com>2015-04-17 09:58:48 -0700
commit342ae3dc04b1c380c624d41cfdd6f9a53a5aadc5 (patch)
tree9cc374af4bbf10810e12265922da7e70a40c190a /scripts/lib/fontbuild
parent99700cf7a4d93bcd9f359f51b5a9538ea5865cf9 (diff)
Don't try generating TTF if OTF generation fails.
Closes #3
Diffstat (limited to 'scripts/lib/fontbuild')
-rw-r--r--scripts/lib/fontbuild/Build.py13
1 files 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"]