Subject: bug#64908: 29.1; svg parse failure

From: Alan Third <[email-masked]>
Date: Sat, 5 Aug 2023 16:14:19 +0100

On Sat, Aug 05, 2023 at 02:32:07PM +0200, David Ponce wrote:
> On 05/08/2023 11:58, Alan Third wrote:
> I did test your V2 patch, and it seems to work well.
> I tend to agree with your reasoning, even if I am not enough a
> librsvg expert to fully understand all the details.

Thanks!

> One case however is not working, when the svg image just specify
> percentage for width and height without a viewbox, like this:
> 
> '(image :type svg :data
>      "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\">
>   <defs id=\"defs3051\">
>     <style type=\"text/css\" id=\"current-color-scheme\">
>       .ColorScheme-Text {
>         color:#232629;
>       }
>       </style>
>   </defs>
>  <path
>     style=\"fill:currentColor;fill-opacity:1;stroke:none\"
>     d=\"m7.707031 3l-.707031.707031 6.125 6.125 1.167969 1.167969-1.167969 1.167969-6.125 6.125.707031.707031 6.125-6.125 1.875-1.875-1.875-1.875-6.125-6.125\"
>     class=\"ColorScheme-Text\"
>     />
> </svg>"
>      :scale 1)
> 
> I can display a such image in firefox, gwenview, or inkscape, but not in Emacs.
> I guess it works in applications that provide a default viewbox when not defined.
> And it is failing in Emacs because no default viewbox is provided.

Very strange, it works here. rsvg_handle_get_geometry_for_layer should
handle this fine. I wonder if something subtle has changed with
2.56... I can't fine anything in the documentation to say this has
changed...

We can always provide an absolute fallback of 100x100 or something. I
think that's what we used to do. But it would be good to know if
something is actually broken here. Are you able to check the return
value of rsvg_handle_get_geometry_for_layer and see if it's throwing
up an error?
-- 
Alan Third