-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering bug using {rsvg} and latest librsvg #30
Comments
There isn't anything we can do to control the rendering I think. You need to file this upstream for @federicomenaquintero in https://gitlab.gnome.org/GNOME/librsvg |
That the SVG renders OK in the command-line and incorrectly in {rsvg} had me thinking that maybe there's been an API change between versions. I.e. the command line I'm going to attempt to grok the source for |
library(rsvg)
#> Linking to librsvg 2.52.8
#> Linking to librsvg 2.52.8
# Twitter Icon
svg_text <- '<svg xmlns="http://www.w3.org/2000/svg"
aria-label="Twitter" role="img"
viewBox="0 0 512 512"><rect
width="512" height="512"
rx="75"
fill="#1da1f2"/><path fill="#fff" d="M437 152a72 72 0 01-40 12a72 72 0 0032-40a72 72 0 01-45 17a72 72 0 00-122 65a200 200 0 01-145-74a72 72 0 0022 94a72 72 0 01-32-7a72 72 0 0056 69a72 72 0 01-32 1a72 72 0 0067 50a200 200 0 01-105 29a200 200 0 00309-179a200 200 0 0035-37"/></svg>'
bitmap <- rsvg(charToRaw(svg_text))
im <- magick::image_read(bitmap)
grid::grid.newpage()
grid::grid.raster(im) Created on 2022-04-14 by the reprex package (v2.0.1) |
Found the issue! In I'll put together a PR on a better solution, but uncommenting the viewport.width/height lines and setting a manual value works for this particular SVG
|
Something in the rendering has changed between librsvg v2.48.4 (macOS version from CRAN), and librsvg v2.52.8 (latest version in Brew).
The twitter logo renders correctly in the version from CRAN, but lacks the rounded rectangle corners when compiled agains latest librsvg.
Using the latest
rsvg-convert
on the command line still produces the correct result. It is only when using{rsvg}
does it seem incorrect.Running rsvg from CRAN works fine - the twitter logo has rounded rect corners.
Created on 2022-04-14 by the reprex package (v2.0.1)
Now compiling on my macOS machine against librsvg 2.52.8, the twitter logo rounded corners are gone.
Note that using the command line 'rsvg-convert' correctly produces the rounded corners.
Created on 2022-04-14 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: