edrlab / thorium-reader

A cross platform desktop reading app, based on the Readium Desktop toolkit
https://www.edrlab.org/software/thorium-reader/
BSD 3-Clause "New" or "Revised" License
1.85k stars 157 forks source link

SVG image not respecting height / width constraints #2056

Open clapierre opened 10 months ago

clapierre commented 10 months ago

I have a publisher file here of an SVG speaker icon for playing audio, but the SVG is displayed very large in Thorium but small in other reading systems.

Here is the code and SVG image code itself. It should limit the size of the SVG to the requested width and height, in the content document.

<img alt="icon: speaker" src="../Images/Speaker_Icon.svg" width="16" height="16"/>

However, this width and height are not being honored.

If I add the width="16" height="16" directly to the SVG image file itself, it is sized correctly.

Here is the original SVG image code.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns=http://www.w3.org/2000/svg version="1.0" max-width="10" max-height="10" viewBox="0 0 75 75">
<path d="M39.389,13.769 L22.235,28.606 L6,28.606 L6,47.699 L21.989,47.699 L39.389,62.75 L39.389,13.769z"
style="stroke:#111;stroke-width:5;stroke-linejoin:round;fill:#111;"
/>
<path d="M48,27.6a19.5,19.5 0 0 1 0,21.4M55.1,20.5a30,30 0 0 1 0,35.6M61.6,14a38.8,38.8 0 0 1 0,48.6"
 style="fill:none;stroke:#111;stroke-width:5;stroke-linecap:round"/>
</svg>

I would think that adding the width and height to the element should be honored but it seems this is not the case. I am using Thorium v2.3.0 on a PC.

danielweck commented 6 months ago

@JayPanoz it would be interesting to know if this is something ReadiumCSS is responsible for. If so, let's move the issue to the repository and let's try to reproduce the bug with a sample EPUB.