swhitty / SwiftDraw

Swift library and command line tool to convert SVGs into SFSymbol, PNG, PDF and Swift source code.
zlib License
326 stars 41 forks source link

Fix SFSymbol NonZero winding paths on macOS #33

Closed swhitty closed 7 months ago

swhitty commented 7 months ago

SFSymbols do not support the evenodd fill rule and are automatically converted to the nonzero winding rule by SwiftDraw.

SwiftDraw currently uses a primitive method to detect if a subpath is "inside" another path when winding that can cause issues when subpaths are positioned in close proximity:

image

This PR leverages CGPath.contains when available to fix the issue on Darwin platforms.

Resolves issue #32 on Darwin platforms falling back to CoreGraphics.