font: Font

Description Usage Arguments Weights Examples

View source: R/font.R

Description

The font() function adjusts the size, weight, style, case, and family of the font of a tag element.

Usage

1
font(x, size = NULL, weight = NULL, style = NULL, case = NULL, family = NULL)

Arguments

x

A tag element or .style pronoun.

size

One of 1, 2, 3, 4, 5, or 6 specifying a font size, defaults to NULL, in which case the argument is ignored. The sizes follow the conventions of heading tags, so 1 is the largest font and 6 the smallest.

weight

One of "light", "lighter", "normal", "bolder", or "bold" specifying the font weight, defaults to NULL, in which case the argument is ignored.

If "bolder" or "lighter", the font weight is changed relative to the current font weight.

style

One of "italic" or "normal" specifying the font style, defaults to NULL, in which case the argument is ignored.

case

One of "upper", "lower", or "title" specifying the font case, default to NULL, in which case the argument is ignored.

family

One of "sans-serif" or "monospace" specifying the font family, defaults to NULL, in which case the argument is ignored.

Weights

p(
  .style %>%
    font(weight = "bold"),
  "Curabitur lacinia pulvinar nibh."
)
html_preserve

Curabitur lacinia pulvinar nibh.

/html_preserve
p(
  .style %>%
    font(weight = "light"),
  "Proin quam nisl, tincidunt et."
)
html_preserve

Proin quam nisl, tincidunt et.

/html_preserve

Examples

1
2
3
4
5
6
7
8
library(htmltools)

p(
  .style %>%
    text("indigo") %>%
    font(weight = "bold"),
  "Phasellus at dui in ligula mollis ultricies."
)

cascadess documentation built on Jan. 13, 2021, 5:10 p.m.