示例#1
0
	def _curveToOne(self, bcp1, bcp2, pt):
		self._addMoveTo()
		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))
		self.bounds = bounds
示例#2
0
	def _curveToOne(self, bcp1, bcp2, pt):
		self._addMoveTo()
		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))
		self.bounds = bounds
示例#3
0
 def _globalExtremumTest(self, p1, p2, p3, p4):
     myRect = CurrentGlyph().box
     if not (pointInRect(p2, myRect) and pointInRect(p3, myRect)):
         points = getExtremaForCubic(p1, p2, p3, p4, h=True, v=True)
         for p in points:
             if p in self.errors:
                 self.errors[p].extend([RedArrowError(p4, "Bounding box extremum")])
             else:
                 self.errors[p] = [RedArrowError(p4, "Bounding box extremum")]
示例#4
0
 def _localExtremumTest(self, p1, p2, p3, p4):
     myRect = normRect((p1[0], p1[1], p4[0], p4[1]))
     if not (pointInRect(p2, myRect) and pointInRect(p3, myRect)):
         points = getExtremaForCubic(p1, p2, p3, p4)
         for p in points:
             if p in self.errors:
                 self.errors[p].extend([RedArrowError(p4, "Local extremum")])
             else:
                 self.errors[p] = [RedArrowError(p4, "Local extremum")]
示例#5
0
 def _localExtremumTest(self, p1, p2, p3, p4):
     myRect = normRect((p1[0], p1[1], p4[0], p4[1]))
     if not (pointInRect(p2, myRect) and pointInRect(p3, myRect)):
         points = getExtremaForCubic(p1, p2, p3, p4)
         for p in points:
             if p in self.errors:
                 self.errors[p].extend(
                     [RedArrowError(p4, "Local extremum")])
             else:
                 self.errors[p] = [RedArrowError(p4, "Local extremum")]
示例#6
0
 def _globalExtremumTest(self, p1, p2, p3, p4):
     myRect = CurrentGlyph().box
     if not (pointInRect(p2, myRect) and pointInRect(p3, myRect)):
         points = getExtremaForCubic(p1, p2, p3, p4, h=True, v=True)
         for p in points:
             if p in self.errors:
                 self.errors[p].extend(
                     [RedArrowError(p4, "Bounding box extremum")])
             else:
                 self.errors[p] = [
                     RedArrowError(p4, "Bounding box extremum")
                 ]
示例#7
0
	def _qCurveToOne(self, bcp, pt):
		self._addMoveTo()
		bounds = self.bounds
		bounds = updateBounds(bounds, pt)
		if not pointInRect(bcp, bounds):
			bounds = unionRect(bounds, calcQuadraticBounds(
					self._getCurrentPoint(), bcp, pt))
		self.bounds = bounds
示例#8
0
	def _qCurveToOne(self, bcp, pt):
		self._addMoveTo()
		bounds = self.bounds
		bounds = updateBounds(bounds, pt)
		if not pointInRect(bcp, bounds):
			bounds = unionRect(bounds, calcQuadraticBounds(
					self._getCurrentPoint(), bcp, pt))
		self.bounds = bounds
示例#9
0
 def _checkBbox(self, pointToCheck, boxPoint):
     # boxPoint is the final point of the current node,
     # the other bbox point is the previous final point
     myRect = normRect((self._prev[0], self._prev[1], boxPoint[0], boxPoint[1]))
     if not pointInRect(pointToCheck, myRect):
         if self.calculateBadness:
             badness = self._getBadness(pointToCheck, myRect)
             if badness >= self.ignoreBelow:
                 self.errors.append(RedArrowError(pointToCheck, "Extremum (badness %i units)" % badness, badness))
         else:
             self.errors.append(RedArrowError(pointToCheck, "Extremum"))
示例#10
0
 def _checkBbox(self, pointToCheck, boxPoint):
     # boxPoint is the final point of the current node,
     # the other bbox point is the previous final point
     myRect = normRect(
         (self._prev[0], self._prev[1], boxPoint[0], boxPoint[1]))
     if not pointInRect(pointToCheck, myRect):
         if self.calculateBadness:
             badness = self._getBadness(pointToCheck, myRect)
             if badness >= self.ignoreBelow:
                 self.errors.append(
                     RedArrowError(pointToCheck,
                                   "Extremum (badness %i units)" % badness,
                                   badness))
         else:
             self.errors.append(RedArrowError(pointToCheck, "Extremum"))