Skip to contents

Sometimes, even when fonts are loaded on a computer, they are not immediately available for use in R. This function fixes that.

Usage

font_hoist(family_name, silent = FALSE)

Arguments

family_name

name of the font family.

silent

do you want to suppress the message?

Value

The function returns a message indicating whether the font was successfully loaded or not.

Details

See June Choe's blog post explaining this. This function requires the user to have already downloaded the font on their computer, and to have set up ragg as described in the blog post.

Examples

# load Roboto Condensed (must be loaded from Google Fonts on system already)
font_hoist("Roboto Condensed")
#> No fonts found for the family 'Roboto Condensed'. 
#> Make sure that the font is downloaded to your computer, and that you can find it using systemfonts::system_fonts(). If you are having trouble, check out June Choe's helpful blog post on setting up and debugging custom fonts: https://yjunechoe.github.io/posts/2021-06-24-setting-up-and-debugging-custom-fonts/
#> NULL

# Try loading a font not on your computer, or that doesn't exist.
# It will give an informative error message.
font_hoist("Lobster Monster")
#> No fonts found for the family 'Lobster Monster'. 
#> Make sure that the font is downloaded to your computer, and that you can find it using systemfonts::system_fonts(). If you are having trouble, check out June Choe's helpful blog post on setting up and debugging custom fonts: https://yjunechoe.github.io/posts/2021-06-24-setting-up-and-debugging-custom-fonts/
#> NULL