[StatisticsControlPen] Fix uninitialized variable
An open contour was hitting this because _startingPoint wasn't set. Fixes https://github.com/fonttools/fonttools/issues/3527
This commit is contained in:
parent
1773f7b0ad
commit
d533e8bd39
@ -106,6 +106,7 @@ class StatisticsControlPen(StatisticsBase, BasePen):
|
|||||||
|
|
||||||
def _moveTo(self, pt):
|
def _moveTo(self, pt):
|
||||||
self._nodes.append(complex(*pt))
|
self._nodes.append(complex(*pt))
|
||||||
|
self._startPoint = pt
|
||||||
|
|
||||||
def _lineTo(self, pt):
|
def _lineTo(self, pt):
|
||||||
self._nodes.append(complex(*pt))
|
self._nodes.append(complex(*pt))
|
||||||
@ -119,12 +120,16 @@ class StatisticsControlPen(StatisticsBase, BasePen):
|
|||||||
self._nodes.append(complex(*pt))
|
self._nodes.append(complex(*pt))
|
||||||
|
|
||||||
def _closePath(self):
|
def _closePath(self):
|
||||||
|
p0 = self._getCurrentPoint()
|
||||||
|
if p0 != self._startPoint:
|
||||||
|
self._lineTo(self._startPoint)
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
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.")
|
||||||
|
self._update()
|
||||||
|
|
||||||
def _update(self):
|
def _update(self):
|
||||||
nodes = self._nodes
|
nodes = self._nodes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user