font {pharmaRTF} | R Documentation |
Return or set font
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
font(x, ...)
font(x) <- value
set_font(x, value)
Arguments
x |
|
... |
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
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"