Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set global font options (rather than specifying body, column, header, etc invdividually) #585

Closed
jthomasmock opened this issue May 15, 2020 · 1 comment · Fixed by #591
Closed

Comments

@jthomasmock
Copy link
Collaborator

jthomasmock commented May 15, 2020

After a discussion with @rich-iannone I posted this issue.

gt has easy and rich support for custom fonts which I love, but to change fonts across the entire table I believe the only way so far is to do the following (and if you wanted to change things like the title you'd also need to specify further targets):

library(gt)
suppressPackageStartupMessages(library(dplyr))

ggplot2::mpg %>% 
  head() %>% 
  gt() %>% 
  gt::tab_style(
    style = list(
      cell_text(font = "Fira Mono")
    ),
    locations = list(
      cells_body(gt::everything()),
      cells_column_labels(gt::everything())
  
  ))

Created on 2020-05-15 by the reprex package (v0.3.0)

Screen Shot 2020-05-15 at 10 40 20 AM

It'd be great if there were options to:

  • Set a global/table level font
  • Override sections optionally with the above formatting (cell body, columns, title, etc)
  • Clearly understand WHERE fonts are allowed to be imported from IE:
    • System Installed fonts
    • Imported web fonts
    • Integration w/ font packages (extrafont, systemfonts, gridtext, etc)

Some ideas about supporting/loading fonts via:

  • systemfonts
  • thematic
  • gridtext

Tagging @apreshill for her interest as well.

@zrodriguez89
Copy link

zrodriguez89 commented Jun 18, 2020

On a related note, I have seen similar requests regarding setting other stylistic changes to a table. For example, if I want to easily change all of the borders to black instead of the default gray as stated elsewhere.

#176 (comment)

I was actually digging through the code for when gt is initialized to see if I can find where the color is set. This could at least allow when creating the object to set a color for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants