[symfont] Add endPath()

This commit is contained in:
Behdad Esfahbod 2017-02-20 17:28:19 -06:00
parent d8e8a657fa
commit 621759b3a8
2 changed files with 20 additions and 1 deletions

View File

@ -22,6 +22,12 @@ class MomentsPen(BasePen):
if p0 != self.__startPoint:
self._lineTo(self.__startPoint)
def _endPath(self):
p0 = self._getCurrentPoint()
if p0 != self.__startPoint:
# Green theorem is not defined on open contours.
raise NotImplementedError
def _lineTo(self, p1):
x0,y0 = self._getCurrentPoint()
x1,y1 = p1

View File

@ -66,7 +66,14 @@ class %s(BasePen):
def _closePath(self):
p0 = self._getCurrentPoint()
if p0 != self.__startPoint:
self._lineTo(self.__startPoint)''', file=file)
self._lineTo(self.__startPoint)
def _endPath(self):
p0 = self._getCurrentPoint()
if p0 != self.__startPoint:
# Green theorem is not defined on open contours.
raise NotImplementedError
''', end='', file=file)
for n in (1, 2, 3):
@ -143,6 +150,12 @@ class GreenPen(BasePen):
if p0 != self.__startPoint:
self._lineTo(self.__startPoint)
def _endPath(self):
p0 = self._getCurrentPoint()
if p0 != self.__startPoint:
# Green theorem is not defined on open contours.
raise NotImplementedError
def _lineTo(self, p1):
p0 = self._getCurrentPoint()
self.value += self._funcs[1](p0, p1)