ropensci / rsvg

SVG renderer for R based on librsvg2
Other
97 stars 1 forks source link

`rsvg_svg()` adds whitespace on the edges of rectangular svgs #44

Open willgearty opened 2 hours ago

willgearty commented 2 hours ago

When I use rsvg_svg() to process a square svg (like this one: 101-K-pre, the output svg looks the same as the input (101-K-post).

However, when I use rsvg_svg to process a rectangular svg (like this one: 435-K-pre), the output svg has extra white space on the left and right sides (435-K-post).

I noticed that the dimensions in the output files lack any decimals that the input dimensions had (as if floor() was called on them). Is this intentional? Or perhaps part of the CAIRO process/spec? Any way around this? I tried setting a width/height in rsvg_svg(), but that just seems to scale the dimensions after they are floor()ed. Any help would be appreciated.

willgearty commented 2 hours ago

(these are pretty small examples, but you can notice the white edges if you open the file in inkscape or the like)