Applies a single font family to every styleable part of a gt table in one
call: the title and subtitle, the stubhead, column spanners and labels, row
groups, the stub, the body, footnotes, and source notes. Setting the same font
through gt::tab_options() means naming each *_font option in turn.
Usage
gt_set_font(
gt_object,
font_family,
from_google_font = TRUE,
weight = NULL,
style = NULL,
gt_table = NULL
)Arguments
- gt_object
A
gttable object to modify.- font_family
Character. The font family to apply to the whole table.
- from_google_font
Logical. Should the font be pulled from Google Fonts through
gt::google_font()?FALSEtreatsfont_familyas a font already installed on the local machine. Defaults toTRUE.- weight
The font weight applied to every part, passed to
gt::cell_text(). Either a keyword such as"bold"or a numeric weight. Defaults toNULL, which leaves the weight alone.- style
Character. The font style applied to every part, one of
"normal","italic", or"oblique". Defaults toNULL, which leaves the style alone.- gt_table
Deprecated. Use
gt_object.
Details
The font is applied with a single gt::tab_style() over a list of cell
locations covering each part of the table. Summary and grand-summary cells are
not included, so a font set here does not reach them. When from_google_font
is TRUE the family is wrapped in gt::google_font(), which adds the import
so the font renders in an exported table without relying on it being installed
locally.
