fonttools / skia-pathops

Python bindings for the Skia library's Path Ops
https://skia.org/docs/dev/present/pathops/
BSD 3-Clause "New" or "Revised" License
47 stars 14 forks source link

pathops turns cubics into quadratics #72

Open simoncozens opened 1 year ago

simoncozens commented 1 year ago

Test case:

from ufoLib2.objects import Contour, Point, Glyph
from pathops import union
ufo_glyph = Glyph()
pen = ufo_glyph.getPen()
contours = [
   Contour(points=[
   Point(371, 515, type='curve'),
   Point(414, 515),
   Point(443, 490),
   Point(445, 434, type='curve'),
   Point(447, 379),
   Point(447, 323),
   Point(445, 266, type='curve'),
   Point(443, 210),
   Point(415, 185)])]
union(contours, pen)
print([node.type for node in ufo_glyph[0]])
# ['curve', None, None, 'curve', None, 'qcurve', None, None]
assert not any(node.type == "qcurve" for node in ufo_glyph[0])