Reputation: 63
Is there a way to directly access and implement free fonts (like Google Fonts) with R for graphs (ggplot2
), without having them installed on my PC or Mac?
Upvotes: 6
Views: 2179
Reputation: 467
The solution has changed a bit in these years. font_add_google()
was moved to the sysfonts
package. You also need to activate showtext
.
To the beginning of your script or your Quarto file add:
sysfonts::font_add_google(name = "Amatic SC", family = "amatic-sc")
showtext::showtext_auto()
Upvotes: 6
Reputation: 1202
I think if I were you, I'd use this showtext
package that seems to have a function that looks like this :
library(showtext)
font_add_google(name = "Amatic SC", family = "amatic-sc")
I bet this could solve your problem
You can maybe find more documentation on the package page directly (update --> link in the comment of your question, thanks Stefan) but I found all of this on this page
https://www.r-bloggers.com/2019/03/adding-custom-fonts-to-ggplot-in-r/
Upvotes: 5