% Generated by roxygen2: do not edit by hand % Please edit documentation in R/fonts.R \name{civilytics_load_fonts} \alias{civilytics_load_fonts} \title{Load Civilytics brand fonts} \usage{ civilytics_load_fonts( force = FALSE, showtext = getOption("civilytics.showtext", TRUE) ) } \arguments{ \item{force}{Logical. If \code{TRUE}, reload fonts even if they were already loaded in this session. Default \code{FALSE}.} \item{showtext}{Logical. Turn on \code{showtext::showtext_auto()} after registering the fonts. Default is \code{getOption("civilytics.showtext", TRUE)}.} } \value{ Invisibly returns \code{TRUE} if fonts were loaded, \code{FALSE} if skipped (already loaded and \code{force = FALSE}). } \description{ Downloads Inter, Libre Franklin, Source Serif 4 and JetBrains Mono from Google Fonts via \code{sysfonts::font_add_google()}, then, unless \code{showtext = FALSE}, calls \code{showtext::showtext_auto()} so that all graphics devices render text with those fonts. This is called automatically when the package loads; use this function to retry if the initial load failed (e.g., the machine was offline at load time). } \details{ Subsequent calls within the same session are no-ops unless \code{force = TRUE}. \strong{Using ragg.} \code{showtext::showtext_auto()} draws text at 96 dpi whatever the device resolution, so on a \code{ragg::agg_png(res = 300)} device text comes out at about a third of its requested size. For ragg, set \code{options(civilytics.showtext = FALSE)} before loading the package, or call \code{showtext::showtext_auto(FALSE)} afterwards. The brand fonts must then be installed on the system, because ragg reads system fonts rather than the ones registered through sysfonts. } \examples{ \dontrun{ civilytics_load_fonts() # For ragg devices: register the fonts but leave showtext off civilytics_load_fonts(force = TRUE, showtext = FALSE) } }