font_face | R Documentation |
Webfonts in SVG and HTML can either be specified manually using the
@font-face
at-rule, or imported from e.g. Google Fonts using the @import
at-rule. font_face()
helps you create a valid @font-face
block for the
web_fonts
argument in svglite()
and svgstring()
functions.
font_face(
family,
woff2 = NULL,
woff = NULL,
ttf = NULL,
otf = NULL,
eot = NULL,
svg = NULL,
local = NULL,
weight = NULL,
style = NULL,
range = NULL,
variant = NULL,
stretch = NULL,
feature_setting = NULL,
variation_setting = NULL
)
family |
The font family name this font should respond to. |
woff2 , woff , ttf , otf , eot , svg |
URLs to the font in different formats. At least one must be given. Best browser support is provided by the woff format. |
local |
One or more font names that local installations of the font may have. If a local font is found with either of the given names it will be used and no download will happen. |
weight |
An optional value for the |
style |
An optional value for the |
range |
An optional value for the |
variant |
An optional value for the |
stretch |
An optional value for the |
feature_setting |
An optional value for the |
variation_setting |
An optional value for the |
A character string with the @font-face
block.
font_face(
family = "MyHelvetica",
ttf = "MgOpenModernaBold.ttf",
local = c("Helvetica Neue Bold", "HelveticaNeue-Bold"),
weight = "bold"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.