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

svglite and showtext #164

Open
Spazio2001 opened this issue Feb 5, 2023 · 5 comments
Open

svglite and showtext #164

Spazio2001 opened this issue Feb 5, 2023 · 5 comments

Comments

@Spazio2001
Copy link

When I save a graphic as SVG and then edit it in Figma using svg(), it converts the text to vector for me. To fix I'm using the svglite library. This works, but only if I use Arial as the font.

I instead have my own font that I import into R with showtext specifying the path to the otf file (extrafont doesn't work), but if I use this then it becomes a vector again. How can I fix?

@trevorld
Copy link
Contributor

trevorld commented Feb 5, 2023

According to {showtext} intro vignette:

showtext renders text by converting it into color-filled polygonal outlines (for vector graphics) or raster images (for bitmap and on-screen graphics). Therefore, the rendered text has the same appearance under all platforms. People who view the graph do not need to install the font that creates the graph. Of course as a price, the actual text information is lost in this procedure.

Theoretically you should be able to directly use non-Arial fonts with svglite() using the typical methods in {ggplot2} / {grid} to specify fonts but your user needs to have them installed (or your website needs to serve them)...

@Spazio2001
Copy link
Author

On my pc the font is installed, but I can't use on Ggplot because when I use font_import I've always an error: No FontName. Skipping. This is why I use showtext. So the solution is to be able to correctly import the font with extrafont?

@trevorld
Copy link
Contributor

trevorld commented Feb 5, 2023

Did you read and follow: https://svglite.r-lib.org/articles/fonts.html ?

@Spazio2001
Copy link
Author

I tried all the proposed solutions, but none work. The result is always a vector and not a text

@thomasp85
Copy link
Member

svglite will never convert text to vector... svglite uses systemfonts and should have access to any fonts installed on your system. showtext should neither work nor be needed

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

3 participants