Closed StylianosGakis closed 4 months ago
So for us, I just run all of our icons again, all of them with the unoptimized script and then just did pathFillType = PathFillType.EvenOdd,
to all of them and now I seem to be getting the correct output from all of them.
Thanks so so much for this tool btw, this is amazing that it can do all this.
It would still be interesting to understand if I can use it in a different way so that I can still get the optimized versions and still be correct at the same time
Hello @StylianosGakis,
Thank you for bringing this issue to my attention and for providing the SVG file for testing, it really helps! I'm sorry to hear that you are experiencing this problem.
The issue you are encountering is actually a bug. It is occurring because the fill-rule
attribute in SVG is lowercase, while its corresponding attribute in AVG is camel case. When I added support for this attribute, I forgot to verify that they have the same values.
When I was working on another feature, I could reproduce this issue, so I created a fix addressing this issue in its branch (https://github.com/rafaeltonholo/svg-to-compose/commit/5204596b76434e38148db2dc6f23dbc5b4490baf). However, I haven't released the fix yet because I didn't have time to finalize the content of that feature.
Since you are being affected by this bug, I am considering doing a cherrypick in that branch and releasing a bugfix version. This will allow you to generate the icons properly.
Thank you for your feedback about the CLI. I'm glad to hear that it is helping you with your needs.
That sounds great Rafael! Thanks a lot for the quick response too. I will be happy to give the new release a try as soon as it's ready to confirm (or not) that this fix works! I'll try to follow the releases here to make sure to give it a try as soon as that happens and I find the time.
Come to think of it, can I just check out that branch myself and run the script locally with those code changes so that I can verify it myself before having to make a release on your end?
Come to think of it, can I just check out that branch myself and run the script locally with those code changes so that I can verify it myself before having to make a release on your end?
I wouldn't use the feat/handle-gradient-and-item-tags, at least not for now, since I don't remember if the head commit is properly working as I still have some local changes.
I have created a PR #29 by doing a cherry pick only on the changes that address that bug. I did some tests with the samples I have in this repository and looks like everything is fine with the changes.
I also tested the provided icon and looks like it is working with the changes.
If you want to test it on your end, I would recommend using the bugfix/compose-types-lowercase branch instead.
After checking out that branch, will it just work for me to use the s2c script, or does that need to be configured in some way to use the local code of that branch?
After checking out that branch, will it just work for me to use the s2c script, or does that need to be configured in some way to use the local code of that branch?
If you have cloned the repository, you can checkout the bugfix branch and run the s2c
script with the same command you were previously using. However, this time you need to add a --upgrade
flag before the path. Here's an example command that you can use:
./s2c -o <output-path> \
-p <package> \
--theme <theme> \
--upgrade \
<icon-paths>
Adding the --upgrade
flag will remove the binaries and build them again, allowing you to use a binary with the bug fix applied.
If you have just downloaded the s2c
script, please note that the s2c
script alone only looks for the latest Release. Hence, you will need to wait until I merge the PR, so it will generate a Release with new binaries with the bugfix. If that is the case, let me know, and I will merge it right away so you can test it.
For an svg like this
Which shows a circle with a exclamation mark in the middle, and should be rendered like this
When using this tool (with optimization = false) to generate a composable I get this
However this renders this:
Going in and adding this line
pathFillType = PathFillType.EvenOdd,
to the path() makes this work again, but I had to do it manually here.Note that when I use the optimized flag then it is not fixed even with changing this
pathFillType = PathFillType.EvenOdd
, which I suppose happens as the optimization does not take this into consideration so it breaks the svg in unexpected ways.I am not sure exactly which part it is that is failing here. Is the fill type not read from the svg file, or is our svg file somehow not compatible with what this tool can do, or what else could I do to encounter the correct behavior correctly?
Perhaps I could just run all the icons that it imports wrong though the non-optimized script and then go in an manually try to match the fill types as a workaround for now, but that can be quite some work.