Keep GuessSmoothPointPen in sync with fontPens
Imported 9b7ecb4 from fontPens, which is the version modified to accept a parameterized tolerance. Recent changes in fontTools such as 2831096, 186e461 and 7d5530e were considered so that the diff will be minimal.
This commit is contained in:
parent
f64f0b42f2
commit
4c22d11aa7
@ -330,8 +330,9 @@ class GuessSmoothPointPen(AbstractPointPen):
|
||||
should be "smooth", ie. that it's a "tangent" point or a "curve" point.
|
||||
"""
|
||||
|
||||
def __init__(self, outPen):
|
||||
def __init__(self, outPen, error=0.05):
|
||||
self._outPen = outPen
|
||||
self._error = error
|
||||
self._points = None
|
||||
|
||||
def _flushContour(self):
|
||||
@ -368,7 +369,7 @@ class GuessSmoothPointPen(AbstractPointPen):
|
||||
dx2, dy2 = nextPt[0] - pt[0], nextPt[1] - pt[1]
|
||||
a1 = math.atan2(dx1, dy1)
|
||||
a2 = math.atan2(dx2, dy2)
|
||||
if abs(a1 - a2) < 0.05:
|
||||
if abs(a1 - a2) < self._error:
|
||||
points[i] = pt, segmentType, True, name, kwargs
|
||||
|
||||
for pt, segmentType, smooth, name, kwargs in points:
|
||||
|
Loading…
x
Reference in New Issue
Block a user