This repository has been archived by the owner on Aug 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
ReverseContourPen drops points #51
Comments
Ouch. Does it happen with the ReverseContourPointPen as well? |
This one passes, so it must not be the original class TestCu2QuReverseContourPointPen(unittest.TestCase):
def _draw_test_contour(self, pen):
pen.beginPath()
pen.addPoint((848, 348), segmentType='line')
pen.addPoint((848, 348), segmentType='line')
pen.addPoint((848, 526))
pen.addPoint((649, 704))
pen.addPoint((449, 704), segmentType='qcurve')
pen.addPoint((449, 704))
pen.addPoint((248, 704))
pen.addPoint((50, 526))
pen.addPoint((50, 348), segmentType='qcurve')
pen.addPoint((50, 348), segmentType='line')
pen.addPoint((50, 348))
pen.addPoint((50, 171))
pen.addPoint((248, -3))
pen.addPoint((449, -3), segmentType='qcurve')
pen.addPoint((449, -3))
pen.addPoint((649, -3))
pen.addPoint((848, 171))
pen.addPoint((848, 348), segmentType='qcurve')
pen.endPath()
def test_duplicate_points_remain(self):
pen1 = DummyPointPen()
pen2 = DummyPointPen()
self._draw_test_contour(pen1)
self._draw_test_contour(ReverseContourPointPen(pen2))
self.assertEqual(
len(pen1.commands), len(pen2.commands),
'\n%s\nreversed to:\n%s;\nsome points dropped.' % (pen1, pen2)) |
anthrotype
added a commit
to anthrotype/fonttools
that referenced
this issue
Oct 24, 2017
anthrotype
added a commit
to anthrotype/fonttools
that referenced
this issue
Oct 24, 2017
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): googlefonts/cu2qu#51 With this patch, the ReverseContourPen now emits the last lineTo when it is the same as moveTo.
anthrotype
added a commit
to anthrotype/fonttools
that referenced
this issue
Oct 24, 2017
One way to work around googlefonts/cu2qu#51 when using the ufoLib's ReverseConturPointPen via the converter pens would be to pass the outputImpliedClosingLine=True argument (False by default) to the PointToSegmentPen. This way, all the final lineTos are explicitly outputted, even when they are redundant and could be implied (i.e. when they are not duplicate points). Note that this test is skipped by the CI, because ufoLib is not a dependency of fonttools; you can run locally if you wish.
It turns out it was the |
not so fast. let's keep this open until we update cu2qu's fonttools requirement. |
anthrotype
added a commit
to anthrotype/cu2qu
that referenced
this issue
Oct 30, 2017
we need that for the bugfix in ReverseContourPen googlefonts#51 also bump ufoLib to >= 2.1.1, just because.
anthrotype
added a commit
to anthrotype/cu2qu
that referenced
this issue
Oct 30, 2017
This was referenced Nov 6, 2017
This was referenced Nov 13, 2017
This was referenced Jan 29, 2018
This was referenced Feb 5, 2018
This was referenced Feb 12, 2018
This was referenced Feb 19, 2018
This was referenced Feb 26, 2018
This was referenced Mar 5, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The following test will fail:
The text was updated successfully, but these errors were encountered: