You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an SVG image has clipped elements in it, rst2pdf will scale that image based on the unclipped elements, not the final result. This results in a smaller and oddly positioned image.
Description of problem
Put the following SVG in a document. It will be scaled down, and be oddly aligned to the left:
<?xmlversion="1.0"encoding="UTF-8"standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svgwidth="1027"height="699"viewBox="0 0 271.72709 184.94375"version="1.1"id="svg5"xml:space="preserve"xmlns="http://www.w3.org/2000/svg"xmlns:svg="http://www.w3.org/2000/svg"><defsid="defs2"><clipPathclipPathUnits="userSpaceOnUse"id="clipPath742"><rectstyle="fill:#00ff00;stroke-width:0.396875;stroke-linecap:round;stroke-linejoin:round"id="rect744"width="272.52084"height="185.20833"x="23.010065"y="-40.970455"rx="1.3229169"ry="1.3229169" /></clipPath></defs><gid="layer1"transform="translate(-23.010065,40.970454)"><pathfill-rule="nonzero"fill="#ffffff"fill-opacity="1"d="M 23.010065,-40.970454 H 294.64896 V 143.8851 H 23.010065 Z m 0,0"id="path387"style="stroke-width:0.352778" /><rectstyle="fill:#ff0000;stroke-width:0.396875;stroke-linecap:round;stroke-linejoin:round"id="rect632"width="2815.1667"height="164.04167"x="33.593399"y="-30.387121"rx="1.3229167"ry="1.3229167"clip-path="url(#clipPath742)" /></g><rectstyle="fill:#00ff00;stroke-width:0.396875;stroke-linecap:round;stroke-linejoin:round"id="rect410"width="187.37076"height="110.43581"x="42.14032"y="38.162937"rx="1.3229169"ry="1.3229169" /></svg>
What is the expected output? What do you see instead?
The SVG is rendered just like in other applications, i.e. according to the width and height of the <svg>.
Additional information
I figured this might be a svglib issue, but some quick debugging suggests the issue is elsewhere. svglib returns a ReportLab Drawing with the correct dimensions. Not sure what happens after that that results in the bad scaling. Hence why I'm reporting the issue here.
The text was updated successfully, but these errors were encountered:
Thanks @CendioOssman, I don't think I've seen that before and I appreciate the detailed bug report. I don't use SVGs but I'm happy to test a patch if anyone does have a fix for this.
If an SVG image has clipped elements in it, rst2pdf will scale that image based on the unclipped elements, not the final result. This results in a smaller and oddly positioned image.
Description of problem
Put the following SVG in a document. It will be scaled down, and be oddly aligned to the left:
What is the expected output? What do you see instead?
The SVG is rendered just like in other applications, i.e. according to the width and height of the
<svg>
.🖥 Versions
Python 3.6.12
rst2pdf 0.98
reportlab 3.6.1
svglib 1.1.0
sphinx 4.2.0
Additional information
I figured this might be a svglib issue, but some quick debugging suggests the issue is elsewhere. svglib returns a ReportLab
Drawing
with the correct dimensions. Not sure what happens after that that results in the bad scaling. Hence why I'm reporting the issue here.The text was updated successfully, but these errors were encountered: