| match_fonts {systemfonts} | R Documentation |
Find a system font by name and style
Description
This function locates the font file (and index) best matching a name and
optional style. A font file will be returned even if a perfect match
isn't found, but it is not necessarily similar to the requested family and
it should not be relied on for font substitution. The aliases "sans",
"serif", "mono", "symbol", and "emoji" match to their respective
system defaults ("" is equivalent to "sans"). match_font() has been
deprecated in favour of match_fonts() which provides vectorisation, as well
as querying for different weights (rather than just "normal" and "bold") as
well as different widths.
Usage
match_fonts(family, italic = FALSE, weight = "normal", width = "undefined")
match_font(family, italic = FALSE, bold = FALSE)
Arguments
family |
The name of the font families to match |
italic |
logical indicating the font slant |
weight |
The weight to query for, either in numbers ( |
width |
The width to query for either in numbers ( |
bold |
logical indicating whether the font weight |
Value
A list containing the paths locating the font files, the 0-based index of the font in the files and the features for the font in case a registered font was located.
Examples
# Get the system default sans-serif font in italic
match_fonts('sans', italic = TRUE)
# Try to match it to a thin variant
match_fonts(c('sans', 'serif'), weight = "thin")