.onAttach <- function(libname, pkgname) {
# adapted from hrbrthemes
# Suggestion by @alexwhan
if (.Platform$OS.type == "windows") { # nocov start
# fix as per https://github.com/wch/extrafont/issues/44#issue-comment-box
windowsFonts <- grDevices::windowsFonts
if (interactive()) packageStartupMessage("Registering Windows fonts with R")
extrafont::loadfonts("win", quiet = TRUE)
}
if (getOption("reschola.loadfonts", default = FALSE)) {
if (interactive()) packageStartupMessage("Registering PDF & PostScript fonts with R")
# fix as per https://github.com/wch/extrafont/issues/44#issue-comment-box
pdfFonts <- grDevices::pdfFonts
postscriptFonts <- grDevices::postscriptFonts
extrafont::loadfonts("pdf", quiet = TRUE)
extrafont::loadfonts("postscript", quiet = TRUE)
}
fnt <- extrafont::fonttable()
if (!any(grepl("Roboto|Roboto[ ]Condensed", fnt$FamilyName))) {
packageStartupMessage("NOTE: Roboto and Roboto Condensed fonts are required for the default setting of theme_mt() to work.")
packageStartupMessage(" Please use mt::import_fonts() to install Roboto and Roboto Condensed")
} # nocov end
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.