Skip to content

Saving table as PNG doesn't keep some font styling (i.e. bold)  #885

@gponce-ars

Description

@gponce-ars

Description

Running the example below (extracted from the documentation) you can see that the PNG does not keep the strong/bold style in the header as you expect it and see it in the HTML output.

Reproducible example

library(gt)
gt_table<- exibble %>% 
              gt() %>% 
              tab_spanner(
                          label = md("**Testing style**"),
                          columns = c(datetime, currency, row)
                  )
  
gtsave(gt_table, filename = '/home/devfe/test.png')
gtsave(gt_table, filename = '/home/devfe/test.html')

PNG
image
HTML
image

Expected result

A PNG showing the table with the expected font style.

Session info

R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
BLAS/LAPACK: /Users/gponce/miniconda3/envs/python39/lib/libopenblasp-r0.3.15.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] gt_0.3.1

loaded via a namespace (and not attached):
 [1] magrittr_2.0.1    tidyselect_1.1.1  munsell_0.5.0     colorspace_2.0-2
 [5] R6_2.5.1          rlang_0.4.12      fansi_1.0.2       dplyr_1.0.7
 [9] tools_4.1.0       grid_4.1.0        checkmate_2.0.0   gtable_0.3.0
[13] utf8_1.2.2        DBI_1.1.1         htmltools_0.5.1.1 ellipsis_0.3.2
[17] assertthat_0.2.1  digest_0.6.29     tibble_3.1.6      lifecycle_1.0.1
[21] crayon_1.4.2      purrr_0.3.4       ggplot2_3.3.5     sass_0.4.0
[25] vctrs_0.3.8       glue_1.6.1        compiler_4.1.0    pillar_1.6.4
[29] backports_1.4.1   generics_0.1.1    scales_1.1.1      pkgconfig_2.0.3

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions