Skip to contents

Builds Google Fonts URL from family name. Extra weights are given in the ... parameters. Languages can be specified in languages and must one or more of the language codes as given by google_language_codes().

Usage

google_font(family, ..., languages = NULL)

Arguments

family

Font family

...

Font weights to include, example "400", "400i"

languages

Font languages to include (dependent on the font.) See google_language_codes().

Value

A "google_font" object.

Examples

google_font("Josefin Sans", "400", "400i", "600i", "700")
#> $family
#> [1] "Josefin Sans"
#> 
#> $weights
#> [1] "400,400i,600i,700"
#> 
#> $languages
#> NULL
#> 
#> $url
#> [1] "https://fonts.googleapis.com/css?family=Josefin+Sans:400,400i,600i,700&display=swap"
#> 
#> attr(,"class")
#> [1] "google_font"
google_font("Josefin Sans", languages = c("latin-ext", "vietnamese"))
#> $family
#> [1] "Josefin Sans"
#> 
#> $weights
#> NULL
#> 
#> $languages
#> [1] "latin-ext,vietnamese"
#> 
#> $url
#> [1] "https://fonts.googleapis.com/css?family=Josefin+Sans&subset=latin-ext,vietnamese&display=swap"
#> 
#> attr(,"class")
#> [1] "google_font"