rstudio / thematic

Theme ggplot2, lattice, and base graphics based on a few simple settings.
https://rstudio.github.io/thematic/
Other
244 stars 10 forks source link

Warning message is not helpful when showtext is not installed #77

Closed wch closed 3 years ago

wch commented 3 years ago

On my system, ragg is installed but showtext is not.

Example with base graphics. It renders the plot, but with no visible text.:

library(thematic)
thematic_on(font = "Righteous")
plot(1:5)
#> There were 40 warnings (use warnings() to see them)
warnings()
#> Warning messages:
#> 1: thematic was unable to resolve `bg='auto'`. Try providing an actual color (or `NA`) to the `bg` argument of `thematic_on()`. By the way, 'auto' is only officially supported in `shiny::renderPlot()`, some rmarkdown scenarios (specifically, `html_document()` with `theme!=NULL`), in RStudio, or if `auto_config_set()` is used.
#> 2: thematic was unable to resolve `fg='auto'`. Try providing an actual color (or `NA`) to the `fg` argument of `thematic_on()`. By the way, 'auto' is only officially supported in `shiny::renderPlot()`, some rmarkdown scenarios (specifically, `html_document()` with `theme!=NULL`), in RStudio, or if `auto_config_set()` is used.
#> 3: thematic was unable to resolve `accent='auto'`. Try providing an actual color (or `NA`) to the `accent` argument of `thematic_on()`. By the way, 'auto' is only officially supported in `shiny::renderPlot()`, some rmarkdown scenarios (specifically, `html_document()` with `theme!=NULL`), in RStudio, or if `auto_config_set()` is used.
#> 4: In axis(side = side, at = at, labels = labels, ...) :
#>   no font could be found for family "Righteous"
#> 5: In axis(side = side, at = at, labels = labels, ...) :
#>   no font could be found for family "Righteous"
...
#>   no font could be found for family "Righteous"
#> 36: In axis(side = side, at = at, labels = labels, ...) :
#>   no font could be found for family "Righteous"
#> 37: In title(...) : no font could be found for family "Righteous"
#> 38: In title(...) : no font could be found for family "Righteous"
#> 39: In title(...) : no font could be found for family "Righteous"
#> 40: In title(...) : no font could be found for family "Righteous"

With ggplot2. It does NOT render the plot at all:

library(ggplot2)
library(thematic)
thematic_on(font = "Righteous")
ggplot() + labs(title = "Custom hello title")
#> Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  : 
#>   polygon edge not found
#> In addition: There were 18 warnings (use warnings() to see them)

I think these things need to be different:

cpsievert commented 3 years ago

Done via #80