match_font: Find a system font by name and style

Description Usage Arguments Value Examples

View source: R/match_font.R

Description

This function locates the font file (and index) best matching a name and optional style (italic/bold). A font file will be returned even if a 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", and "mono" match to the system default sans-serif, serif, and mono fonts respectively ("" is equivalent to "sans").

Usage

1

Arguments

family

The name of the font family

italic, bold

logicals indicating the font style

Value

A list containing the path locating the font file and the 0-based index of the font in the file.

Examples

1
2
# Get the system default sans-serif font in italic
match_font('sans', italic = TRUE)

systemfonts documentation built on Oct. 23, 2020, 8 p.m.