download_font: Download font files

Description Usage Arguments Value Examples

View source: R/api.R

Description

Download font files

Usage

1
download_font(id, output_dir, variants = NULL, ..., http_options = list())

Arguments

id

Id of the font, correspond to column id from get_all_fonts.

output_dir

Output directory where to save font files.

variants

Variant(s) to download, default is to includes all available ones.

...

Additional parameters to API query.

http_options

Arguments passed to crul::HttpClient$new.

Value

a character vector of the filepaths extracted to, invisibly.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if (interactive()) {

# For example, we use a temporary directory
path_to_dir <- tempfile()
dir.create(path_to_dir)

# Download Roboto font
download_font(
  id = "roboto",
  output_dir = path_to_dir
)

# Get only regular, italic and bold
download_font(
  id = "roboto",
  output_dir = path_to_dir,
  variants = c("regular", "300italic", "700")
)

# Clean up
unlink(path_to_dir, recursive = TRUE)

}

gfonts documentation built on Jan. 13, 2021, 4:35 a.m.