Skip to contents

Re-runs the font discovery process using the current value of getOption("ksTFL.font_dirs"). This is useful after installing new fonts or after changing the ksTFL.font_dirs option.

Usage

tfl_rescan_fonts()

Value

Invisibly returns the font scan report (a list with resolutions and dirs_scanned).

Details

To point ksTFL at a custom TTF folder, set the ksTFL.font_dirs option before or during your session, then call tfl_rescan_fonts():


options(ksTFL.font_dirs = "/path/to/your/fonts")
tfl_rescan_fonts()

Multiple directories are supported:


options(ksTFL.font_dirs = c("/path/to/fonts1", "/path/to/fonts2"))
tfl_rescan_fonts()

The package's own bundled fonts directory is always scanned automatically; ksTFL.font_dirs only adds extra directories on top of that. To make the setting persistent across sessions, add the options() call to your ~/.Rprofile.

See also

tfl_font_status() to print the cached report without rescanning.

Examples

# Rescan after installing new fonts (prints the resolution summary)
tfl_rescan_fonts()
#> ksTFL font scan: 0 target(s) resolved, 6 using fallback
#>   [fallback] Arial                -> Liberation Sans
#>   [fallback] Times New Roman      -> Liberation Serif
#>   [fallback] Courier New          -> Liberation Mono
#>   [fallback] Georgia              -> Liberation Serif
#>   [fallback] Verdana              -> Liberation Sans
#>   [fallback] Trebuchet MS         -> Liberation Sans
#>   Scanned 12 directories

if (FALSE) { # \dontrun{
# Point to a custom font directory, then rescan
options(ksTFL.font_dirs = c("/usr/share/fonts/custom"))
tfl_rescan_fonts()
} # }