summaryrefslogtreecommitdiff
path: root/scripts/lib
diff options
context:
space:
mode:
authorJames Godfrey-Kittle <jamesgk@google.com>2015-11-19 15:23:24 -0800
committerJames Godfrey-Kittle <jamesgk@google.com>2015-11-19 15:23:50 -0800
commit8b5f2c40e043ac354b74481919d25b85f1136d41 (patch)
tree63798fc29bbeb9d007b32338fb3801bc63e49410 /scripts/lib
parentceb4ae1b523cb0160dbf2ac57b770db0761c68d9 (diff)
[italics] Work around RoboFab-related issues
This is (hopefully) a temporary hack until a more robust solution to the issue is found. Basically the problem is that RoboFab pens do float-to-float comparisons to decide whether to remove duplicate points from contours, and breaks with BooleanOperations output (which can include point coordinates with very small fractional components). The italicizing code assumes certain behavior from RoboFab pens and can't handle duplicate points being kept.
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/fontbuild/Build.py14
-rw-r--r--scripts/lib/fontbuild/curveFitPen.py8
2 files changed, 10 insertions, 12 deletions
diff --git a/scripts/lib/fontbuild/Build.py b/scripts/lib/fontbuild/Build.py
index d1e870a..5d92705 100644
--- a/scripts/lib/fontbuild/Build.py
+++ b/scripts/lib/fontbuild/Build.py
@@ -120,18 +120,8 @@ class FontProject:
if g.name == "uniFFFD":
continue
-
- # if i < 24:
- # continue
- # if i > 86:
- # for i,g in enumerate(fl.font.glyphs):
- # fl.UpdateGlyph(i)
- # # break
- # assert False
-
- # print g.name
- # if self.thinfont != None:
- # narrowFLGlyph(g,self.thinfont.getGlyph(g.name),factor=narrowAmmount)
+
+ removeGlyphOverlap(g)
if g.name in self.lessItalic:
italicizeGlyph(f, g, 9, stemWidth=stemWidth)
diff --git a/scripts/lib/fontbuild/curveFitPen.py b/scripts/lib/fontbuild/curveFitPen.py
index c2b90ac..f7c0cae 100644
--- a/scripts/lib/fontbuild/curveFitPen.py
+++ b/scripts/lib/fontbuild/curveFitPen.py
@@ -280,6 +280,14 @@ class SubsegmentPen(BasePen):
def _closePath(self):
if not (self.lastPoint[0] == self.startContour[0] and self.lastPoint[1] == self.startContour[1]):
self._lineTo(self.startContour)
+
+ # round values used by otherPen (a RoboFab SegmentToPointPen) to decide
+ # whether to delete duplicate points at start and end of contour
+ #TODO(jamesgk) figure out why we have to do this hack, then remove it
+ c = self.otherPen.contour
+ for i in [0, -1]:
+ c[i] = [[round(n, 5) for n in c[i][0]]] + list(c[i][1:])
+
self.otherPen.closePath()
def _endPath(self):