Skip to contents

The vector of fonts given by default_fonts() should be used with a gt table that is rendered to HTML. We can specify additional fonts to use but this default set should be placed after that to act as fallbacks. This is useful when specifying font values in the cell_text() function (itself used in the tab_style() function). If using opt_table_font() (which also has a font argument) we probably don't need to specify this vector of fonts since it is handled by its add option (which is TRUE by default).




A character vector of font names.


Use exibble to create a gt table. Attempting to modify the fonts used for the time column is much safer if default_fonts() is appended to the end of the font listing in the cell_text() call (the "Comic Sansa" and "Menloa" fonts don't exist, but, we'll get the first available font from the default_fonts() set).

exibble %>%
  dplyr::select(char, time) %>%
  gt() %>%
    style = cell_text(
      font = c(
        "Comic Sansa", "Menloa",
    locations = cells_body(columns = time)

This image of a table was generated from the first code example in the `default_fonts()` help file.

Function ID