r-lib/ragg

mono italic won't print??

Closed this issue · 3 comments

Here's a strange bug on my Mac:

doit <- function() {
  text <- c("mono 1", "mono 2", "mono 3", "mono 4")
  plot(1:4, 1:4, type="n")
  text(2, 1:4, text, family="mono", font=1:4)
  dev.off()
}

agg_png("test.png")
doit()

This produces this plot:
test

The same thing happens with other agg_* devices, but not the standard devices, e.g.

png("test.png")
doit()

produces this:
test

Here's my session info:

> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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

time zone: America/Toronto
tzcode source: internal

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

other attached packages:
[1] ragg_1.2.5 rgl_1.2.6 

loaded via a namespace (and not attached):
 [1] digest_0.6.33     R6_2.5.1          base64enc_0.1-3  
 [4] fastmap_1.1.1     xfun_0.40         extrafont_0.19   
 [7] magrittr_2.0.3    knitr_1.44.1      htmltools_0.5.6  
[10] rmarkdown_2.25    cli_3.6.1         textshaping_0.3.6
[13] systemfonts_1.0.4 compiler_4.3.1    rstudioapi_0.15.0
[16] tools_4.3.1       extrafontdb_1.0   evaluate_0.22    
[19] yaml_2.3.7        Rttf2pt1_1.3.12   rlang_1.1.1      
[22] jsonlite_1.8.7    htmlwidgets_1.6.2

This seems related to r-lib/systemfonts#105, however ragg is using textshaping so maybe not...

I can reproduce and will investigate

No, this is definitely related. Freetype is throwing the same 130 error when trying to load the glyph - however, AGG simply ignores the glyph in this case so nothing is plottet

This will get fixed with r-lib/systemfonts#105

I'll close here as this is a systemfonts issue (though it really is a FreeType/Courier issue)