match_fonts | R Documentation |
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.
match_fonts(family, italic = FALSE, weight = "normal", width = "undefined")
match_font(family, italic = FALSE, bold = FALSE)
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 |
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.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.