[statisticsPen] Fix __start_point access
Fixes https://github.com/fonttools/fonttools/issues/3527
This commit is contained in:
parent
a531041f3e
commit
0bf67cc0c9
@ -76,16 +76,16 @@ class GreenPen(BasePen):
|
|||||||
self.value = 0
|
self.value = 0
|
||||||
|
|
||||||
def _moveTo(self, p0):
|
def _moveTo(self, p0):
|
||||||
self.__startPoint = p0
|
self._startPoint = p0
|
||||||
|
|
||||||
def _closePath(self):
|
def _closePath(self):
|
||||||
p0 = self._getCurrentPoint()
|
p0 = self._getCurrentPoint()
|
||||||
if p0 != self.__startPoint:
|
if p0 != self._startPoint:
|
||||||
self._lineTo(self.__startPoint)
|
self._lineTo(self._startPoint)
|
||||||
|
|
||||||
def _endPath(self):
|
def _endPath(self):
|
||||||
p0 = self._getCurrentPoint()
|
p0 = self._getCurrentPoint()
|
||||||
if p0 != self.__startPoint:
|
if p0 != self._startPoint:
|
||||||
# Green theorem is not defined on open contours.
|
# Green theorem is not defined on open contours.
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@ -145,19 +145,18 @@ class %s(BasePen):
|
|||||||
print(
|
print(
|
||||||
"""
|
"""
|
||||||
def _moveTo(self, p0):
|
def _moveTo(self, p0):
|
||||||
self.__startPoint = p0
|
self._startPoint = p0
|
||||||
|
|
||||||
def _closePath(self):
|
def _closePath(self):
|
||||||
p0 = self._getCurrentPoint()
|
p0 = self._getCurrentPoint()
|
||||||
if p0 != self.__startPoint:
|
if p0 != self._startPoint:
|
||||||
self._lineTo(self.__startPoint)
|
self._lineTo(self._startPoint)
|
||||||
|
|
||||||
def _endPath(self):
|
def _endPath(self):
|
||||||
p0 = self._getCurrentPoint()
|
p0 = self._getCurrentPoint()
|
||||||
if p0 != self.__startPoint:
|
if p0 != self._startPoint:
|
||||||
# Green theorem is not defined on open contours.
|
|
||||||
raise OpenContourError(
|
raise OpenContourError(
|
||||||
"Green theorem is not defined on open contours."
|
"Glyph statistics is not defined on open contours."
|
||||||
)
|
)
|
||||||
""",
|
""",
|
||||||
end="",
|
end="",
|
||||||
|
@ -15,6 +15,7 @@ __all__ = ["MomentsPen"]
|
|||||||
|
|
||||||
|
|
||||||
class MomentsPen(BasePen):
|
class MomentsPen(BasePen):
|
||||||
|
|
||||||
def __init__(self, glyphset=None):
|
def __init__(self, glyphset=None):
|
||||||
BasePen.__init__(self, glyphset)
|
BasePen.__init__(self, glyphset)
|
||||||
|
|
||||||
@ -26,17 +27,17 @@ class MomentsPen(BasePen):
|
|||||||
self.momentYY = 0
|
self.momentYY = 0
|
||||||
|
|
||||||
def _moveTo(self, p0):
|
def _moveTo(self, p0):
|
||||||
self.__startPoint = p0
|
self._startPoint = p0
|
||||||
|
|
||||||
def _closePath(self):
|
def _closePath(self):
|
||||||
p0 = self._getCurrentPoint()
|
p0 = self._getCurrentPoint()
|
||||||
if p0 != self.__startPoint:
|
if p0 != self._startPoint:
|
||||||
self._lineTo(self.__startPoint)
|
self._lineTo(self._startPoint)
|
||||||
|
|
||||||
def _endPath(self):
|
def _endPath(self):
|
||||||
p0 = self._getCurrentPoint()
|
p0 = self._getCurrentPoint()
|
||||||
if p0 != self.__startPoint:
|
if p0 != self._startPoint:
|
||||||
raise OpenContourError("Glyph statistics not defined on open contours.")
|
raise OpenContourError("Glyph statistics is not defined on open contours.")
|
||||||
|
|
||||||
@cython.locals(r0=cython.double)
|
@cython.locals(r0=cython.double)
|
||||||
@cython.locals(r1=cython.double)
|
@cython.locals(r1=cython.double)
|
||||||
|
@ -123,7 +123,7 @@ class StatisticsControlPen(StatisticsBase, BasePen):
|
|||||||
|
|
||||||
def _endPath(self):
|
def _endPath(self):
|
||||||
p0 = self._getCurrentPoint()
|
p0 = self._getCurrentPoint()
|
||||||
if p0 != self.__startPoint:
|
if p0 != self._startPoint:
|
||||||
raise OpenContourError("Glyph statistics not defined on open contours.")
|
raise OpenContourError("Glyph statistics not defined on open contours.")
|
||||||
|
|
||||||
def _update(self):
|
def _update(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user