Skip to content

Commit

Permalink
[cubic-glyf] Fix drawPoints() contour ending with cubic offCurve
Browse files Browse the repository at this point in the history
Fixes #3189
  • Loading branch information
behdad committed Jun 27, 2023
1 parent 1138e5b commit 82ee6dd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Lib/fontTools/ttLib/tables/_g_l_y_f.py
Original file line number Diff line number Diff line change
Expand Up @@ -1528,9 +1528,15 @@ def drawPoints(self, pen, glyfTable, offset=0):
start = end
pen.beginPath()
# Start with the appropriate segment type based on the final segment
segmentType = "line" if cFlags[-1] == 1 else "qcurve"

if cFlags[-1] & flagOnCurve:
segmentType = "line"
elif cFlags[-1] & flagCubic:
segmentType = "curve"

Check warning on line 1535 in Lib/fontTools/ttLib/tables/_g_l_y_f.py

View check run for this annotation

Codecov / codecov/patch

Lib/fontTools/ttLib/tables/_g_l_y_f.py#L1535

Added line #L1535 was not covered by tests
else:
segmentType = "qcurve"
for i, pt in enumerate(contour):
if cFlags[i] & flagOnCurve == 1:
if cFlags[i] & flagOnCurve:
pen.addPoint(pt, segmentType=segmentType)
segmentType = "line"
else:
Expand Down

0 comments on commit 82ee6dd

Please sign in to comment.