showtext icon indicating copy to clipboard operation
showtext copied to clipboard

Allow setting fig.showtext in pkgdown template packages

Open Bisaloo opened this issue 2 months ago • 0 comments

I am using showtext for a ggplot2 theme for my organization. As a result, I would like showtext to always be enabled in vignettes in pkgdown websites.

I can specify:

knitr::opts_chunk$set(
  fig.showtext = TRUE,
  fig.retina = 1
)

in each vignette of each package but it gets a bit cumbersome.

I would like to set it once and for all for all vignettes and all packages via the pkgdown template package we are using. There is a way to do this but it requires packages that define custom parameters to explicit get them from the theme:

https://pkgdown.r-lib.org/reference/build_articles.html#figures

https://pkgdown.r-lib.org/reference/fig_settings.html

You can see for example how the rgl package is doing it:

https://github.com/dmurdoch/rgl/blob/0b13a6948314cdfa608a241d7b568585b3a05032/R/pkgdown.R#L46-L47

Is this something that could be implemented in showtext?

Bisaloo avatar May 07 '24 16:05 Bisaloo