Svgo: feature request: tool to convert paths with fill-rule="evenodd" to fill-rule="nonzero"

Created on 27 Mar 2019  路  4Comments  路  Source: svg/svgo

So I have an interesting case where I'm having issues with fill-rule="evenodd" not working properly with compound shapes (inner holes) and I'm wondering if svgo could have a plugin to convert these paths to fill-rule="nonzero" in a similar method as FontForge's "Correct Direction" tool (source here: https://github.com/fontforge/fontforge/blob/ae2f40b2f213b2d645d5a9f1e7a55475cbfe84ea/fontforge/scripting.c#L5505) which would essentially re-wind the points of internal paths.

Thoughts?

Most helpful comment

I had a problem and can fix it in Inkscape. In Inkscape you can turn on show direction of paths.

The path of the hole on the left is in the opposite direction to the one on the right
image
which causes the icon to be rendered as follows
image

To fix this I just need to select the hole on the right and reverse the path direction. What would be nice is if we had a svgo plugin that could do this automatically. I'm not sure how it will know which direction the line should be though. SVG rendering programs seem to render this with two holes, it's only when I try to convert it to a font that I see the issue.

All 4 comments

@jwilson8767 hi, are you solved this problem?
I am using Workshape/icon-font-generator and my icons also has fill-rule="evenodd" so I have filled inner holes in my font-icons
So now I'm looking for a solution to solve it

This would make it easier to export custom icons from various design tools into a custom FontAwesome package via a plugin. Their system relies on the default fill-rule="nonzero".

@eli-crow Check out https://github.com/nfroidure/svgicons2svgfont/issues/62 where more discussion was done on this.

I had a problem and can fix it in Inkscape. In Inkscape you can turn on show direction of paths.

The path of the hole on the left is in the opposite direction to the one on the right
image
which causes the icon to be rendered as follows
image

To fix this I just need to select the hole on the right and reverse the path direction. What would be nice is if we had a svgo plugin that could do this automatically. I'm not sure how it will know which direction the line should be though. SVG rendering programs seem to render this with two holes, it's only when I try to convert it to a font that I see the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

happyPanghu picture happyPanghu  路  3Comments

gregberge picture gregberge  路  3Comments

pixelass picture pixelass  路  6Comments

bmcminn picture bmcminn  路  4Comments

bdkjones picture bdkjones  路  3Comments