Skip to content
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

Remove internal quotes in "url('#id')" #4

Closed
dmi3kno opened this issue Feb 12, 2020 · 3 comments
Closed

Remove internal quotes in "url('#id')" #4

dmi3kno opened this issue Feb 12, 2020 · 3 comments

Comments

@dmi3kno
Copy link
Contributor

dmi3kno commented Feb 12, 2020

Apparently librsvg (which is an underlying C library behind rsvg and also base svg rendering library in GNOME e.g. also in GIMP and Inkscape) does not allow hashtagged identifiers inside url() call to be quoted.

library(minisvg)

doc <- svg_doc(width = 300, height = 30)
pat  <- stag$defs()$pattern(id = 'motif', width=60, height=30, 
                            patternUnits = 'userSpaceOnUse')
pat$add('rect', x = 0, y=0, width = 30, height = 30, fill='black')
doc$append(pat)
doc$rect(x=0, y=0, width="100%", height="100%", fill=pat) 
doc$show()
doc
#> <?xml version="1.0" encoding="UTF-8"?>
#> <svg width="300" height="30" viewBox="0 0 300 30" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
#>   <pattern id="motif" width="60" height="30" patternUnits="userSpaceOnUse">
#>     <rect x="0" y="0" width="30" height="30" fill="black" />
#>   </pattern>
#>   <rect fill="url('#motif')" x="0" y="0" width="100%" height="100%" />
#> </svg>

The last line before closing tag should instead read

#> <rect fill="url(#motif)" x="0" y="0" width="100%" height="100%" />

Then the document will be valid and can be rendered by librsvg, i.e. read by rsvg, magick and the like

@coolbutuseless
Copy link
Owner

Thanks for the bug report (and all the other testing you're doing!)

I will fix this for the next release.

@coolbutuseless
Copy link
Owner

Fixed in ab5237f

@dmi3kno
Copy link
Contributor Author

dmi3kno commented Feb 13, 2020

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants