generate_css: Generate CSS to import fonts

Description Usage Arguments Value Examples

View source: R/css.R

Description

Generate CSS to import fonts

Usage

1
2
3
4
5
6
7
8
9
generate_css(
  id,
  variants = NULL,
  subsets = NULL,
  output = NULL,
  font_dir = "../fonts/",
  prefer_local_source = TRUE,
  ...
)

Arguments

id

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

variants

Variant of font to use.

subsets

Subsets to use.

output

Specifies path to output file for CSS generated.

font_dir

Fonts directory relative to ouput.

prefer_local_source

Generate CSS font-face rules in which user installed fonts are preferred. Use FALSE if you want to force the use of the downloaded font.

...

Arguments passed to crul::HttpClient$new.

Value

a character string with CSS code (invisibly).

Examples

1
2
3
4
5
6
if (interactive()) {

# Generate CSS code to use Roboto font
cat(generate_css("roboto", "regular"))

}

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