summaryrefslogtreecommitdiff
path: root/scripts/lib/fontbuild
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/fontbuild')
-rw-r--r--scripts/lib/fontbuild/Build.py17
-rw-r--r--scripts/lib/fontbuild/saveOTF.py7
2 files changed, 13 insertions, 11 deletions
diff --git a/scripts/lib/fontbuild/Build.py b/scripts/lib/fontbuild/Build.py
index 0f398ca..7cb4963 100644
--- a/scripts/lib/fontbuild/Build.py
+++ b/scripts/lib/fontbuild/Build.py
@@ -164,15 +164,20 @@ class FontProject:
newFont = OpenFont(ufoName)
conformToAGL(newFont, self.adobeGlyphList)
otfName = self.generateOutputPath(f, "otf")
- saveOTF(newFont, otfName, checkOutlines=self.checkOTFOutlines,
- autohint=self.autohintOTF)
+ saveOTF(newFont, otfName, autohint=self.autohintOTF)
- if self.buildTTF:
- log(">> Generating TTF file")
+ if self.checkOTFOutlines or self.buildTTF:
import fontforge
- ttfName = self.generateOutputPath(f, "ttf")
otFont = fontforge.open(otfName)
- otFont.generate(ttfName)
+
+ if self.checkOTFOutlines:
+ for glyphName in otFont:
+ otFont[glyphName].removeOverlap()
+ otFont.generate(otfName)
+
+ if self.buildTTF:
+ log(">> Generating TTF file")
+ otFont.generate(self.generateOutputPath(f, "ttf"))
if self.buildFEA:
log(">> Generating FEA files")
diff --git a/scripts/lib/fontbuild/saveOTF.py b/scripts/lib/fontbuild/saveOTF.py
index d150f51..3f03127 100644
--- a/scripts/lib/fontbuild/saveOTF.py
+++ b/scripts/lib/fontbuild/saveOTF.py
@@ -6,15 +6,12 @@ from ufo2fdk.makeotfParts import MakeOTFPartsCompiler
from ufo2fdk.outlineOTF import OutlineOTFCompiler
-def saveOTF(font, destFile, checkOutlines=False, autohint=False):
+def saveOTF(font, destFile, autohint=False):
"""Save a RoboFab font as an OTF binary using ufo2fdk."""
compiler = OTFCompiler(partsCompilerClass=_PartsCompilerCustomGlyphOrder,
outlineCompilerClass=_OutlineCompilerFormat12)
- reports = compiler.compile(font, destFile, checkOutlines=checkOutlines,
- autohint=autohint)
- if checkOutlines:
- print reports["checkOutlines"]
+ reports = compiler.compile(font, destFile, autohint=autohint)
if autohint:
print reports["autohint"]
print reports["makeotf"]