Closed abey79 closed 3 years ago
https://www.w3.org/TR/SVG11/struct.html#SVGElementWidthAttribute
A negative value is an error (see Error processing). A value of zero disables rendering of the element.
Disabled rendering of elements happens elsewhere and those elements are not parsed. If width or height is zero for the SVG the correct action is to stop parsing and pretend the entire document is basically blank. Elements with visibility='hidden' just get the fact that their .values['visibility'] == 'hidden'
here we're disabling rendering so zero there means there is no there there.
I'll correct it shortly, soon SVGs that would display nothing and lead to an error, will display nothing without error.
Thanks!
As it turns out, this test SVG was generated with vpype (max(width, 1)
is in order somewhere in my code.
Yeah, point to point without any consideration of the linewidth gets you a 0 width svg. But, the spec is clear, I don't render anything if the width is zero. It does mean checking it on your side when I could do it on mine, but my side says to just stop trying so that the solution. Though it doesn't help you any since checking it on your side would have the exact same result, and zero still isn't a useful width. Just less crashy.
1.3.2 is up on pypi. (had neglected to upload it til now)
The following SVG crashes upon parsing:
Backtrace: