GNU bug report logs -
#40845
SVG rendering issues
Previous Next
Full log
View this message in rfc822 format
On Sun, Apr 26, 2020 at 06:48:09PM -0400, Clément Pit-Claudel wrote:
> On 26/04/2020 17.17, Alan Third wrote:
> > I’m happy to give this a go, but I’m not sure about base64 encoding.
> > Do we already have a way of doing that to a char buffer?
>
> We have base64-encode-region and base64-encode-string, which are
> both C functions — but why do we need to base64 encode?
I could be wrong, but in order to wrap the SVG file in another SVG, we
need to do something like:
<svg xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
width="100" height="100"
preserveAspectRatio="none"
viewBox="0 0 283.465 283.465">
<xi:include href="data:image/svg+xml;base64,<base64 encoded data>">
</xi:include>
</svg>
We can’t just put the contents in directly, like:
<svg xmlns:xlink="http://www.w3.org/1999/xlink"
width="100" height="100"
preserveAspectRatio="none"
viewBox="0 0 283.465 283.465">
<!-- file contents -->
<svg>
stuff
</svg>
<!-- end file contents -->
</svg>
as the file may (and probably should) have XML declarations at the
start which break the SVG file. We could strip them out but I’m not
sure that that’s better than base64 encoding, as it would mean
modifying the contents and I’m not sure that’s the only thing that
might cause problems.
We could also potentially just insert the file as‐is like so:
<svg xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
width="100" height="100"
preserveAspectRatio="none"
viewBox="0 0 283.465 283.465">
<xi:include href="data:image/svg+xml;utf8,<svg>stuff</svg>">
</xi:include>
</svg>
but I can’t make that work. I think we’d have to URL encode the angle
brackets and any quotes.
If there’s anything obvious I’ve missed, please let me know.
--
Alan Third
This bug report was last modified 4 years and 271 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.