2 Commits

Author SHA1 Message Date
Cosimo Lupo
e201ea9891 [reverseContourPen] don't imply closing lineTo when same as moveTo
Previously, for closed paths, we were always dropping a lineTo segment
that followed moveTo, because after reversing the contour this lineTo
would become the last segment, and in the Pen protocol a closePath
always implies a line to the fist point.

This is OK when the move point and the following lineTo oncurve point
(which becomes last after reversal) don't overlap.

However, if they do, we ended up dropping the duplicate point.

This cu2qu issue exemplify the problem (cu2qu actually uses the
ReverseContourPointPen wrapped by ufoLib's converter pens, but
fontTools' ReverseContourPen does exactly the same):

https://github.com/googlei18n/cu2qu/issues/51

With this patch, the ReverseContourPen now emits the last lineTo
when it is the same as moveTo.
2017-10-24 19:04:38 +01:00
Cosimo Lupo
021de9963b [reverseContourPen] add ReverseContourPen
A filter pen that passes outline data to another pen, but reversing
the winding direction of all contours.

Like ufoLib's ReverseContourPointPen, but using segment-wise pen
interface, without additional point/segment converters, and without
ufoLib.

627f997ddb/Lib/ufoLib/pointPen.py (L327-L406)
2017-10-11 21:13:23 +01:00