Try to replace skia-pathops with linesweeper#2552
Conversation
Skia does too, the TrueType style spline with implied oncurves only exists in font-land. Skia-pathops pen protocol adapter cleans them up afterwards |
Similarly, that is also some extra code I added in the bindings, the underlying skia pathops module doesn't care about the starting points. |
|
Ok, so if indeed the following features are not in scope for linesweeper:
Then they could be a layer on top of linesweeper, or Fontra could deal with this itself (I'll check how skia-pathops does it). I don't think they should be part of a binding per se, because Fontra would need this functionality whether it is using it via Python or via JS/TS/WASM. Fontra could also deal with the desired winding direction. What remains is the "sometimes outputs cubics when feeding it quadratics" issue: IMO that is a bug, but I'm not sure this is caused by linesweeper itself or by linesweeper-py. Here's a reproducer for the cubic-for-quads problem: import linesweeper
from kurbopy import Point
from fontTools.pens.recordingPen import RecordingPen
path = linesweeper.BezPath()
path.move_to(Point(0, 0))
path.quad_to(Point(0, 30), Point(15, 60))
path.quad_to(Point(30, 93), Point(90, 90))
path.line_to
path.close_path()
simplifiedPaths = linesweeper.simplify([path])
pen = RecordingPen()
for path in simplifiedPaths:
path.draw(pen)
for command, args in pen.value:
print(command, args)This outputs: The I can't find the implementation of |
|
@anthrotype, @simoncozens, can either of you advise me on the quadratics issue described above? My main questions at this point are:
|
|
It looks like linesweeper does raise the order (quad to cubic) while adding paths to its "arena", so I guess this is considered deliberate, rather than a bug. |
|
@justvanrossum Could you summarize what issues remain? We could ask @jneem to take a look. |
|
I'm not sure there are any real issues, except that I'm missing some functionality that seems to be outside the scope of linesweeper. What I need can be implemented on top of linesweeper, but if I could ask for a single feature it would be "output quadratic segments for quadratic input segments instead of raising the order". |
That's definitely in-scope (I'll open an issue for it), but I don't have an ETA |
That's great! Thanks for the head-up. |
Trying to replace skia-pathops with linesweeper. This is an experiment, as I'm not sure we should switch to linesweeper without addressing the findings mentioned below.
This PR fixes #2551, but at a price:
(The latter two points may have to do with path conversion rather than with linesweeper itself?)
(The Fontra test cases are too minimal and don't fully reflect the findings above.)
References: