Learn R Programming

cascadess (version 0.1.0)

font: Font

Description

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

Usage

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."
)

Curabitur lacinia pulvinar nibh.

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

Proin quam nisl, tincidunt et.

Examples

Run this code
# NOT RUN {
library(htmltools)

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

# }

Run the code above in your browser using DataLab