Chlumsky / msdfgen

Multi-channel signed distance field generator
MIT License
3.97k stars 412 forks source link

SVG file #116

Closed nautist closed 3 years ago

nautist commented 3 years ago

It does not seem to work if one curve is created inside of the other as a hole. A shape read from a font that looks like an 'O' is perfectly fine, but if a similar shape is read as a path from an SVG file, it looks like a filled circle. Is that a problem with winding? Thanks

Chlumsky commented 3 years ago

Can you post the file?

nautist commented 3 years ago

Sure (hope this works)

svgtest4.zip

Chlumsky commented 3 years ago

Yes, it seems like a winding issue. Also, there is some weird stuff in the top left corner. In any case, Skia interprets the shape in this format as filled, so I would lean towards not a bug.

nautist commented 3 years ago

I made this shape as a test in Affinity Designer (using two rounded rectangles and a boolean operation and exported it in svg. In Designer and in several different browsers, the inner curve is interpreted as a hole inside the outer curve. Maybe they don't care about winding.

nautist commented 3 years ago

I think I got it. This svg file is saved using fill-rule=evenodd, and every other contour has to be reversed to get the hole inside the outer contour.