font: Return or set font

Description Usage Arguments Value Examples

View source: R/properties.R

Description

These property functions modify or return the fonts of an rtf_doc object or individual titles/footnotes objects of the hf_line class.

When used on an rtf_doc object to retrieve fonts, the distinct set of fonts of all objects contained within the rtf_doc are returned. When used on an rtf_doc to set fonts, the default font for the RTF document is set.

When used on titles/footnotes (hf_line objects), the font is either returned of set for that individual line.

Usage

1
2
3
4
5
font(x, ...)

font(x) <- value

set_font(x, value)

Arguments

x

rtf_doc object, the table of a rtf_doc object, or a hf_line object

...

Additional arguments passed to method dispatch

value

A string representing a font

Value

For font(), the font attribute of the object in the case of hf_line and the table, or each unique font in the table, titles, footnotes, and the overall document in the case of rtf_doc. For set_font() and `font<-`(), the modified object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(huxtable)
ht <- huxtable(
  column1 = 1:5,
  column2 = letters[1:5]
)
rtf <- rtf_doc(ht, list(hf_line("text", font = "Comic Sans")))

pharmaRTF::font(rtf)
# Returns "Courier New" "Comic Sans"

pharmaRTF::font(rtf) <- "Times"

pharmaRTF::font(rtf)
# Returns "Times" "Comic Sans"

pharmaRTF::font(rtf$titles[[1]]) <- "Windings"

pharmaRTF::font(rtf)
# Returns "Times" "Windings"

pharmaRTF documentation built on Sept. 28, 2021, 5:08 p.m.