Right now, by default, we always set the outermost contours' direction to counter-clockwise (i.e. whenever fix_winding=True, which is the default).
There is no way in the public pathops Python API to set the inverse clockwise direction.
winding_from_even_odd function (called when fix_winding is True) has a truetype=False parameter (that would make it use clockwise as the desired result's direction), however that option is not exposed at the top-level (e.g. in simplify or op methods).
I am adding a removeOverlaps module to fontTools to merge overlapping paths from TTFs (to be used as an optional feature of the varLib.instancer). TrueType fonts usually use clockwise as the outermost (black) path direction. I don't want to change all glyphs when removing overlaps just because pathops doesn't let me choose the result's direction.
Ideally, in all the public methods where we have a fix_winding option (ie. simplify, op, and the various named boolean ops), before we run the underlying Skia operation, we save the current path's direction (it's clockwise if path.area < 0), and then pass that one to winding_from_even_odd.
This way, skia-pathops would "remember" and keep the current path direction, instead of always setting the result's direction to counter-clockwise as it does now.
This would be a breaking change however, which is why I am opening this issue to gather comments before I go on and apply this change.
Another solution would be to expose a way to set the destination path's direction (make that truetype parameter settable from the public methods somehow, maybe as a new direction parameter), so the client can choose which direction (whether CW, CCW or whatever the original direction was).
Right now, by default, we always set the outermost contours' direction to counter-clockwise (i.e. whenever fix_winding=True, which is the default). There is no way in the public pathops Python API to set the inverse clockwise direction.
winding_from_even_odd
function (called when fix_winding is True) has atruetype=False
parameter (that would make it use clockwise as the desired result's direction), however that option is not exposed at the top-level (e.g. insimplify
orop
methods).I am adding a removeOverlaps module to fontTools to merge overlapping paths from TTFs (to be used as an optional feature of the varLib.instancer). TrueType fonts usually use clockwise as the outermost (black) path direction. I don't want to change all glyphs when removing overlaps just because pathops doesn't let me choose the result's direction.
Ideally, in all the public methods where we have a
fix_winding
option (ie. simplify, op, and the various named boolean ops), before we run the underlying Skia operation, we save the current path's direction (it's clockwise if path.area < 0), and then pass that one towinding_from_even_odd
.This way, skia-pathops would "remember" and keep the current path direction, instead of always setting the result's direction to counter-clockwise as it does now.
This would be a breaking change however, which is why I am opening this issue to gather comments before I go on and apply this change.
Another solution would be to expose a way to set the destination path's direction (make that
truetype
parameter settable from the public methods somehow, maybe as a newdirection
parameter), so the client can choose which direction (whether CW, CCW or whatever the original direction was).