dompdf / php-svg-lib

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

viewbox is not correctly mapped to SVG viewport #93

Open bsweeney opened 2 years ago

bsweeney commented 2 years ago

Per the SVG spec the viewBox "(specifes) a rectangle in user space that should be mapped to the bounds of the SVG viewport established by the given element, taking into account the preserveAspectRatio attribute. The presence of the viewBox attribute results in a transformation being applied to the viewport coordinate system."

Essentially, when the viewBox doesn't match the viewport a transformation is applied. While the x/y values are correctly applied, the width/height do not define a transformation to the viewport. https://svgwg.org/svg2-draft/coords.html