diff --git a/R/fonts.R b/R/fonts.R index 689ddf6..db91774 100644 --- a/R/fonts.R +++ b/R/fonts.R @@ -1,34 +1,34 @@ -#' Import and register Roboto font +#' Import and register Inter font #' -#' \code{import_roboto()} tests to see if Roboto is imported and registered. If -#' Roboto, isn't imported and registered, then \code{import_roboto()} imports and -#' registers Roboto with +#' \code{import_inter()} tests to see if Inter is imported and registered. If +#' Inter, isn't imported and registered, then \code{import_inter()} imports and +#' registers Inter with #' \href{https://github.com/wch/extrafont}{library(extrafont)}. #' -#' Note: Roboto must be installed on your computer for \code{import_roboto()} to -#' work. Roboto is Brooking's main font. To install, visit -#' \href{https://fonts.google.com/specimen/roboto}{Google fonts} and click +#' Note: Inter must be installed on your computer for \code{import_inter()} to +#' work. Inter is Brooking's main font. To install, visit +#' \href{https://fonts.google.com/specimen/Inter}{Google fonts} and click #' "Download family". Unzip and open each of the .ttf files and click install. #' #' #' @md #' @export -import_roboto <- function() { - if (sum(grepl("[Rr]oboto$", extrafont::fonts())) > 0) { - "Roboto is already imported and registered." +import_inter <- function() { + if (sum(grepl("[Ii]nter$", extrafont::fonts())) > 0) { + "Inter is already imported and registered." } else { # get a list of all fonts on the machine local_fonts <- systemfonts::system_fonts() - # subset the list to just roboto fonts - roboto_fonts <- local_fonts[grepl(pattern = "[Rr]oboto", x = local_fonts$family), ] + # subset the list to just inter fonts + inter_fonts <- local_fonts[grepl(pattern = "[Ii]nter", x = local_fonts$family), ] - # create a vector of directories where roboto fonts are located - roboto_directories <- unique(gsub("[Rr]oboto.*\\.ttf", "", roboto_fonts$path)) + # create a vector of directories where inter fonts are located + inter_directories <- unique(gsub("[Ii]nter.*\\.ttf", "", inter_fonts$path)) - # import the roboto fonts - extrafont::font_import(paths = roboto_directories, pattern = "[Rr]oboto") + # import the inter fonts + extrafont::font_import(paths = inter_directories, pattern = "[Ii]nter") # register the fonts extrafont::loadfonts()