| @@ -12,7 +12,8 @@ | |||
| slide level doesn't result in giant slide numbers (#53). | |||
| * xaringanthemer no longer sets the `fig.showtext` chunk option when the | |||
| showtext package isn't installed (#56). | |||
| showtext package isn't installed and also when `fig.showtext = FALSE` | |||
| (thanks @mikedecr #36, #56). | |||
| * The style functions gain a `link_decoration` argument to set the | |||
| [`text-decoration`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration) | |||
| @@ -903,6 +903,17 @@ verify_fig_showtext <- function(fn = "theme_xaringan_base") { | |||
| )) | |||
| } | |||
| set_fig_showtext <- function() { | |||
| if (!requireNamespace("showtext", quietly = TRUE)) { | |||
| return(invisible()) | |||
| } | |||
| curr_fst <- knitr::opts_chunk$get("fig.showtext") | |||
| if (!is.null(curr_fst) && identical(curr_fst, FALSE)) { | |||
| return(invisible()) | |||
| } | |||
| knitr::opts_chunk$set(fig.showtext = TRUE) | |||
| } | |||
| requires_xaringanthemer_env <- function( | |||
| css_file = NULL, | |||
| try_css = TRUE, | |||
| @@ -2,17 +2,13 @@ | |||
| .onLoad <- function(libname, pkgname, ...) { | |||
| if ("knitr" %in% loadedNamespaces()) { | |||
| if (requireNamespace("showtext", quietly = TRUE)) { | |||
| knitr::opts_chunk$set(fig.showtext = TRUE) | |||
| } | |||
| set_fig_showtext() | |||
| } | |||
| setHook( | |||
| packageEvent("knitr", "onLoad"), | |||
| function(...) { | |||
| if (requireNamespace("showtext", quietly = TRUE)) { | |||
| knitr::opts_chunk$set(fig.showtext = TRUE) | |||
| } | |||
| set_fig_showtext() | |||
| } | |||
| ) | |||