Initialize or remove font directory used to store downloaded font files.
This directory is managed by R function R_user_dir()
but can also
be defined in a non-user location by setting ENV variable GDTOOLS_CACHE_DIR
or by setting R option GDTOOLS_CACHE_DIR
.
Its value can be read with the fonts_cache_dir()
function.
The directory can be deleted with rm_fonts_cache()
and
created with init_fonts_cache()
.
See also
Other functions for font management:
addGFontHtmlDependency()
,
gfontHtmlDependency()
,
install_gfont_script()
,
installed_gfonts()
,
liberationsansHtmlDependency()
,
register_gfont()
,
register_liberationsans()
Examples
fonts_cache_dir()
#> [1] "/home/runner/.local/share/R/gdtools"
options(GDTOOLS_CACHE_DIR = tempdir())
fonts_cache_dir()
#> [1] "/tmp/Rtmp8abAvb"
options(GDTOOLS_CACHE_DIR = NULL)
Sys.setenv(GDTOOLS_CACHE_DIR = tempdir())
fonts_cache_dir()
#> [1] "/tmp/Rtmp8abAvb"
Sys.setenv(GDTOOLS_CACHE_DIR = "")
init_fonts_cache()
#> [1] "/home/runner/.local/share/R/gdtools"
dir.exists(fonts_cache_dir())
#> [1] TRUE
rm_fonts_cache()
dir.exists(fonts_cache_dir())
#> [1] FALSE