Chlumsky / msdfgen

Multi-channel signed distance field generator
MIT License
3.91k stars 404 forks source link

I convert an svg to msdf image, but the result is not correct! is this a bug? #87

Closed iomeone closed 4 years ago

iomeone commented 4 years ago

the svg file is: <svg width="33" height="194" > <path d="M20.9390126953125,123.33496984863282c0,13.808 -5.38,27.258 -5.38,40.17c0,7.173 1.793,13.808 7.173,18.829c0.18,0.179 0.18,0.538 0.18,0.717c0,0.538 -0.359,0.897 -0.897,0.897c-0.179,0 -0.538,-0.179 -0.717,-0.359c-7.353,-6.994 -9.863,-16.498 -9.863,-26.54c0,-13.988 5.917,-27.617 5.917,-40.887c0,-7.173 -1.793,-13.808 -7.173,-18.829c-0.179,-0.18 -0.179,-0.18 -0.179,-0.359c0,-0.179 0,-0.179 0.179,-0.359c5.38,-5.021 7.173,-11.656 7.173,-18.829c0,-13.27 -5.917,-26.899 -5.917,-40.887c0,-10.042 2.51,-19.546 9.863,-26.54c0.179,-0.179 0.538,-0.359 0.717,-0.359c0.538,0 0.897,0.359 0.897,0.897c0,0.179 0,0.538 -0.18,0.717c-5.38,5.021 -7.173,11.656 -7.173,18.83c0,12.911 5.38,26.361 5.38,40.169c0,10.042 -2.511,19.367 -9.504,26.361c6.993,6.994 9.504,16.319 9.504,26.361Z" > </path> </svg>

the converted png is : 22 the render result is 22Render the command I used is : msdfgen.exe msdf -svg test.svg -o test.png -autoframe -size 13 174 -testrender testrender.png 13 174

I 've tried lots of different size args (make it bigger or different scale), but have no luck! So is there something wrong with my command args or is this a bug?

Chlumsky commented 4 years ago

This is a bug in the scanline pass. I will try to fix ASAP. For now, use -noscanline -guessorder.

Chlumsky commented 4 years ago

Alright, this turned out to be a weird floating point error specific to the exact values of the coordinates of this shape. I fixed it in b1c9f28 by improving the detection of "almost zero" values in the equation solver.

iomeone commented 4 years ago

That's very nice of you to solve this problem so quickly, Thank you very much!