font: Set the font for cell text

View source: R/properties-cell.R

fontR Documentation

Set the font for cell text

Description

Set the font for cell text

Usage

font(ht)

font(ht) <- value

set_font(ht, row, col, value)

map_font(ht, row, col, fn)

Arguments

ht

A huxtable.

value

A character vector or matrix. Set to NA to reset to the default, which is NA_character_.

row

A row specifier. See rowspecs for details.

col

An optional column specifier.

fn

A mapping function. See mapping-functions for details.

Details

To find out what fonts are on your system, systemfonts::match_font() is useful.

For HTML, you can use comma-separated lists of font names like "Times New Roman, Times, Serif". This is not portable, though.

LaTeX and HTML use different font names. To use the same font names across document formats, see options("huxtable.latex_use_fontspec") in huxtable-options.

See Also

Other formatting functions: background_color(), bold(), font_size(), na_string(), number_format(), text_color()

Examples

font(jams) <- "times"
font(jams)

set_font(jams, "arial")
set_font(jams, 2:3, 1, "arial")
map_font(jams, by_rows("arial", "times"))


huxtable documentation built on Aug. 19, 2025, 1:12 a.m.