R Sysfonts

The sysfonts package imports fonts from the system registry into R's registry.


Installation

Install the sysfonts package.


Usage

If a font must be downloaded from the internet, try:

download.file(uri, basename(uri))
untar(basename(uri), compressed = "gzip")

With the font file available locally, try:

sysfonts::font_add("myfont", r"(path/to/myfontdir/myfont.otf)")

Alternatively, add the font file to the search path so that it can be used without a path.

library(sysfonts)
font_paths("path/to/myfontdir")
font_add("myfont", regular = "myfont.otf")

In any case, it is likely necessary to now use showtext to rasterize the fonts added.


See also

sysfonts CRAN page


CategoryRicottone

R/Sysfonts (last edited 2023-06-15 13:59:20 by DominicRicottone)