Why googlefontR?
Google Fonts is a really incredible resource, but adding Google Fonts to R generated HTML
can be a big pain. googlefontR
tries to ease the pain with some helper functions.
Install
Not on CRAN, so please install with devtools
.
devtools::install_github("timelyportfolio/googlefontR")
Examples
library("googlefontR")
library("htmltools")
browsable(
gf_add_font(
tags$h1("Baloo Paaji provided by googlefontR"),
"Baloo Paaji"
)
)
Note the style is automatically applied to body
. If you don't want this to happen, change addstyle=FALSE
.
browsable(
gf_add_font(
tag_list = tags$h1("Baloo Paaji provided by googlefontR"),
fontname = "Baloo Paaji",
addstyle = FALSE
)
)
with svglite
I think googlefontR
will work great with svglite
.
library(svglite)
library(htmltools)
library(googlefontR)
s<-svgstring(standalone=FALSE)
plot(cars)
dev.off()
gf_add_font(
HTML(
gsub(
x = s(),
pattern = "(font-family: Arial;)",
replacement = ""
)
),
"Architects Daughter"
)
Code of Conduct
I welcome contributions. Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.