dompdf / php-svg-lib

SVG file parsing / rendering library
GNU Lesser General Public License v3.0
1.4k stars 77 forks source link

Improve parsing of arc segments #66

Closed helmutschneider closed 2 years ago

helmutschneider commented 3 years ago

Fixes #11 and dompdf/dompdf#1301. The logic is borrowed from fabric.js.

liam-milbel commented 3 years ago

While this fixed the issue I was initially having, it causes a few SVGs to render incorrectly.

Take these two SVGs as an example: car.txt people.txt

Here's what the people one should look like image And here's what it renders as with these changes image

helmutschneider commented 3 years ago

Interesting that it's specifically the top-left arc that is drawn incorrectly. Are both examples rendered using this library?

liam-milbel commented 3 years ago

Interesting that it's specifically the top-left arc that is drawn incorrectly. Are both examples rendered using this library?

Through dompdf, yes. Without this PR I was getting the same error as was mentioned in #11 on one of my SVGs, but with it, so far three of my SVGs have been drawn incorrectly.

Update: I have since found a couple more SVGs that break. key.txt camera.txt

Both of these seem to behave differently from the last two. image image

helmutschneider commented 3 years ago

Thanks - that is good news because we're probably looking at another parsing incompatibility. I will look into it during the weekend.

helmutschneider commented 3 years ago

@liam-milbel Ok, have another go now

liam-milbel commented 3 years ago

@liam-milbel Ok, have another go now

Looks good!

nfreear commented 3 years ago

Hi @helmutschneider, @liam-milbel,

Thank you for this pull request!

Does it provide a fix or partial fix for #62 please?

Best wishes, Nick

helmutschneider commented 3 years ago

@nfreear I don't know, feel free to test it.