Skip to contents

Registers a font family for use in ggplot2 plots and updates the default font for text and label geoms. Three font families are bundled with the package for offline use: "Open Sans", "Lato", and "Source Sans 3". Any Google Font can be loaded when an internet connection is available.

Usage

set_fonts(base_family = "Open Sans")

Arguments

base_family

Character. Font family name. Default is "Open Sans". Bundled options: "Open Sans", "Lato", "Source Sans 3".

Value

Invisible NULL. Called for its side effects of registering fonts and enabling automatic rendering.

Details

Font rendering uses showtext (via sysfonts). Bundled fonts are loaded from TTF files in inst/fonts/; other fonts are fetched via font_add_google.

See also

Examples

if (FALSE) { # \dontrun{
# Use bundled Open Sans (no internet needed)
set_fonts(base_family = "Open Sans")

# Use bundled Lato
set_fonts(base_family = "Lato")

# Use a Google Font (requires internet)
set_fonts(base_family = "Roboto")
} # }