CMAP-REPOS / cmapplot

Set of templates and themes to apply CMAP graphics standards to R products.
https://cmap-repos.github.io/cmapplot/
Other
13 stars 1 forks source link

pkgdown site fonts broken #116

Closed matthewstern closed 3 years ago

matthewstern commented 3 years ago

It appears all fonts in plots on the pkgdown site are currently rendering in Arial. Noel, would you be willing to look into why this is the case, and hopefully implement a solution within #115?

nmpeterson commented 3 years ago

I'll try to take a closer look tomorrow but I'm not confident I'll be able to find the problem. According to the logs from the most recent pkgdown build, the fonts were correctly installed and available to R on the virtual machine.

image

matthewstern commented 3 years ago

Interestingly enough, it also looks like text is not getting bolded (e.g. title text in finalize), which should be happening even if falling back to Arial.

This could definitely be our fault, but I can't help but wonder if this has to do with the updates to the systemfonts package?

nmpeterson commented 3 years ago

We don’t use systemfonts, we use sysfonts

matthewstern commented 3 years ago

for me, fonts work:

Fonts do not work:

Could this be a pkgdown issue?

matthewstern commented 3 years ago

pkgdown was updated last Fall to use ragg_png to export png files. I wonder if the 2021 upgrades to ragg have created a pkgdown-specific knitting issue?

nmpeterson commented 3 years ago

Can confirm that pkgdown::build_site() is not working locally for me, either. If I install cmapplot with devtools::install_github('cmap-repos/cmapplot', build_vignettes=T) and then browseVignettes('cmapplot'), everything appears correct.

This is psychotic.

nmpeterson commented 3 years ago

Unfortunately I don't think I'm going to have any more time to investigate further this week.

matthewstern commented 3 years ago

It looks to me that a backend change in pkgdown has caused this issue. Rolling back to a previous version of pkgdown and previewing the site locally shows fonts correctly:

install_version("pkgdown", version = "1.5.1", repos = "http://cran.us.r-project.org")
pkgdown::build_site()

pkgdown has been at version 1.6.0 for months, during which time the site has built correctly. However, 1.6.0 was updated to use ragg_png, and ragg has been updated with substantial changes much more recently.

We don't call ragg_png directly, but pkgdown will use it behind the scenes to convert our "in-vignette plotting" to pngs for the html output. I presume that the regular knitting performed by rstudio does not use ragg, which would be why the error does not exist when vignettes are built normally.

We could solve this by trying to figure out what exactly what went wrong within the pkgdown context, but I think the right thing to do here is to actually to take the plunge and upgrade finalize_plot() to use ragg_png etc. My guess is this will recreate the same problem locally, which we would then need to solve but should address all cases. This is re-opening a big can of worms, though.

matthewstern commented 3 years ago

Replaced this with #127