Test if fonts are available on the system and import them in R

check_fonts_in_r(
  fonts = c("Marianne", "Spectral"),
  import = TRUE,
  verbose = TRUE
)

Arguments

fonts

Vector of fonts.

import

Logical. Whether to import ttf font files in R (otherwise just check).

verbose

List fonts to install if needed.

Details

For fonts to be used, they need to be installed on the machine.

Examples

if (FALSE) {
check_fonts_in_r(import = FALSE)

# Test if working
library(ggplot2)
ggplot(mtcars) + geom_point(aes(cyl, mpg)) + labs(title = "Mon titre avec Marianne",
    x = "lab X avec Spectral", y = "Lab Y avec Spectral") +
    theme(title = element_text(family = "Marianne"),
        axis.title.x = element_text(family = "Spectral"),
        axis.title.y = element_text(family = "Spectral"))
}