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.
font(x, ...) font(x) <- value set_font(x, value)
| x |
|
|---|---|
| ... | Additional arguments passed to method dispatch |
| value | A string representing a font |
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.
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)#> [1] "Courier New" "Comic Sans"# Returns "Courier New" "Comic Sans" pharmaRTF::font(rtf) <- "Times" pharmaRTF::font(rtf)#> [1] "Times" "Comic Sans"# Returns "Times" "Comic Sans" pharmaRTF::font(rtf$titles[[1]]) <- "Windings" pharmaRTF::font(rtf)#> [1] "Times" "Windings"# Returns "Times" "Windings"