GNOME Bugzilla – Bug 761286
librsvg detects wrong dimension on rotated rectangle
Last modified: 2017-08-29 22:43:34 UTC
Another inconsistent response of rsvg_handle_get_(position|dimensions)_sub() (see also bug 761264 and bug 760112 for other similar cases). Steps: 1/ Create a rectangle in Inkscape on a blank page. For instance, I made a 200x50 rectangle. 2/ Inspect with rsvg API, it returns me dimension 200x49 and position (174, 235), which is nearly OK (the ordinate is not the same as Inkscape, but it seems this is because Inkscape shows coordinates from bottom left corner instead of top left). The width though is 1 pixel off. Which is already annoying, especially since the rectangle is exactly 50 pixels wide. No approximation should lead to losing a pixel. Here is the SVG code (there is no transformation made on parent nodes): <rect style="opacity:0.38500001;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.214;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="rect7381" width="200" height="50" x="174.28572" y="235.21936" /> 3/ Now I apply a rotation. According to Inkscape, I should get a box 177x177 (cf. screenshot). 4/ Check again with libsrvg API, I get a 353x353 box at position (97, 83). Both dimensions and positions are completely wrong. The SVG code is: <rect style="opacity:0.38500001;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.214;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="rect7381" width="200" height="50" x="-90.053581" y="352.95218" transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,0,0)" /> There is still no transformation on any parent node of this rectangle.
Also tested and issue confirmed on git master from today.
Created attachment 320027 [details] Rotated rectangle in Inkscape. Oups I forgot to attach my screenshot earlier. It just shows the rectangle in Inkscape, and the expected box size.
*** This bug has been marked as a duplicate of bug 760112 ***