wrapped some long lines

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@411 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
jvr 2003-08-23 20:24:42 +00:00
parent b369ef33fc
commit 82ef2a52c9
2 changed files with 12 additions and 7 deletions

View File

@ -170,7 +170,8 @@ class BasePen(AbstractPen):
if pt2 is None:
pt2 = temp
else:
pt3 = (0.5 * (pt2[0] + temp[0]), 0.5 * (pt2[1] + temp[1]))
pt3 = (0.5 * (pt2[0] + temp[0]),
0.5 * (pt2[1] + temp[1]))
self._curveToOne(pt1, pt2, pt3)
pt1, pt2, pt3 = temp, None, None
self._curveToOne(pt1, points[-2], points[-1])
@ -186,9 +187,10 @@ class BasePen(AbstractPen):
n = len(points) - 1 # 'n' is the number of control points
assert n >= 0
if n > 0:
# Split the string of points into discrete quadratic curve segments.
# Between any two consecutive off-curve points there's an implied
# on-curve point exactly in the middle. This is where the segment splits.
# Split the string of points into discrete quadratic curve
# segments. Between any two consecutive off-curve points
# there's an implied on-curve point exactly in the middle.
# This is where the segment splits.
_qCurveToOne = self._qCurveToOne
for i in range(len(points) - 2):
x, y = points[i]
@ -208,7 +210,8 @@ class _TestPen(BasePen):
def _lineTo(self, pt):
print "%s %s lineto" % (pt[0], pt[1])
def _curveToOne(self, bcp1, bcp2, pt):
print "%s %s %s %s %s %s curveto" % (bcp1[0], bcp1[1], bcp2[0], bcp2[1], pt[0], pt[1])
print "%s %s %s %s %s %s curveto" % (bcp1[0], bcp1[1],
bcp2[0], bcp2[1], pt[0], pt[1])
def _closePath(self):
print "closepath"

View File

@ -63,14 +63,16 @@ class BoundsPen(ControlBoundsPen):
bounds = self.bounds
bounds = updateBounds(bounds, pt)
if not pointInRect(bcp1, bounds) or not pointInRect(bcp2, bounds):
bounds = unionRect(bounds, calcCubicBounds(self._getCurrentPoint(), bcp1, bcp2, pt))
bounds = unionRect(bounds, calcCubicBounds(
self._getCurrentPoint(), bcp1, bcp2, pt))
self.bounds = bounds
def _qCurveToOne(self, bcp, pt):
bounds = self.bounds
bounds = updateBounds(bounds, pt)
if not pointInRect(bcp, bounds):
bounds = unionRect(bounds, calcQuadraticBounds(self._getCurrentPoint(), bcp, pt))
bounds = unionRect(bounds, calcQuadraticBounds(
self._getCurrentPoint(), bcp, pt))
self.bounds = bounds