summaryrefslogtreecommitdiff
path: root/scripts/lib/fontbuild/Build.py
diff options
context:
space:
mode:
authorJames Godfrey-Kittle <jamesgk@google.com>2015-02-12 16:32:01 -0800
committerJames Godfrey-Kittle <jamesgk@google.com>2015-04-16 12:16:29 -0700
commit0d2e8746cf7cc98efd117f2a462211bd6ceddc94 (patch)
treeda0f8c3cb110a022fda9a41975e1e2e7409ef434 /scripts/lib/fontbuild/Build.py
parentb07c28c166c41252047cfbbb44525bb9bd834c93 (diff)
Use FontForge for overlap removal.
This is an alternative to the closed source AFDKO checkOutlines tool. Again, we could potentially do our own overlap removal if time permits.
Diffstat (limited to 'scripts/lib/fontbuild/Build.py')
-rw-r--r--scripts/lib/fontbuild/Build.py17
1 files changed, 11 insertions, 6 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")