fonts_as_import | R Documentation |
If you create content in a text-based format such as HTML or SVG you need to
make sure that the font is available on the computer where it is viewed. This
can be achieved through the use of stylesheets that can either be added with
a <link>
tag or inserted with an @import
statement. This function
facilitates the creation of either of these (or the bare URL to the
stylesheet). It can rely on the Google Fonts or Font Library repository for
serving the fonts. If the requested font is not found it can optionally hard
code the data into the stylesheet.
fonts_as_import(
family,
italic = NULL,
weight = NULL,
width = NULL,
...,
type = c("url", "import", "link"),
may_embed = TRUE,
repositories = c("Google Fonts", "Font Library")
)
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 ( |
... |
Additional arguments passed on to the specific functions for the repositories. Currently:
|
type |
The type of return value. |
may_embed |
Logical. Should fonts that can't be found in the provided
repositories be embedded as data-URLs. This is only possible if the font is
available locally and in a |
repositories |
The repositories to try looking for the font. Currently
|
A character vector with stylesheet specifications according to type
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.