-
Notifications
You must be signed in to change notification settings - Fork 39
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
Feature request: add a base64 argument to embed encoded web fonts #128
Comments
Hi, I appreciated embedding the preferred fonts in the image. Although it would be overkill regarding file size, to embedd in each and every image if there are many of them in a document. Wouldn't it be better to include svg inline and embedd fonts once in the html-doc? |
I think that the size is still manageable if the users only include the fonts they really need. Moreover, users could simply set the However, having the fonts embed would facilitate sharing the svg as a single self contained file (as one often wants to do with images) and would make the svg recognizable as images by search engines (which is not the case with inline svg or svg wrapped in an I think both options should be available for users easily, which would be the case with my feature suggestion. |
agreed, did you try svg-buddy? |
I did not, but it looks to do exactly what I'd like. Do you think it would be possible (and a good idea, of course) to wrap it inside |
Currently I do kind of postprocessing like this on debian-10: imagepath = '/Users/hp/Downloads/logo-left-black.svg' that'll do the job for me if you write an awesome package that certainly is appreciated, but obviously you will have to contact both developers of svglite and svg-buddy and mange any dependency ... |
As you probably know, when integrating
svg
files using<img>
tag inside anHTML
document, thesvg
won't be able to load external resources such as web fonts due to security reason. I'm really new to this, but I think that the workaround would be to include abase64
encoded version of the font instead of the link pointing to the external resource. The user could then trigger this behaviour by passingTRUE
to a newbase64
argument to be added in thefont_face()
function.The internal function
validate_web_fonts()
would have to be modified to include this new argument as well for users specifying an URL instead of using thefont_face()
function. We could then add a newweb_fonts_base64
argument to thesvglite()
function to trigger the behaviour.The preferred workflow to embed web fonts in an
svg
built withsvglite
in aknitr
chunk would then become something like this for a user havingOpen Sans
installed locally:Setup chunk making it easy to use
Open Sans
in any other chunk...
Chunk outputting a
ggplot
usingOpen Sans
in ansvg
Does that make any sense at all or am I totally missing something?
The text was updated successfully, but these errors were encountered: