showtext icon indicating copy to clipboard operation
showtext copied to clipboard

Fonts turn to be blurry in MacOS - Xquartz when enable showtext

Open mingsu opened this issue 5 years ago • 2 comments

require(showtext)
showtext_auto(enable = F)
plot(1)
Screen Shot 2020-09-24 at 10 28 43 AM
showtext_auto(enable = T)
plot(1)
Screen Shot 2020-09-24 at 10 29 35 AM

When I setup the dpi, font size changes

showtext_auto(enable = T)
showtext_opts(dpi = 220)
plot(1)
Screen Shot 2020-09-24 at 10 35 36 AM
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

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

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

other attached packages:
[1] showtext_0.9   showtextdb_3.0 sysfonts_0.8.1

loaded via a namespace (and not attached):
[1] compiler_4.0.2
>

mingsu avatar Sep 24 '20 02:09 mingsu

Just adding a +1, me too. Kind of a non-starter.

Behavior for me is somewhat random. When using RStudio with dev.new() the fonts are sometimes large and pixelated, and sometimes they're relatively normal and not pixelated. I'm using the agg device within RStudio, but I don't think it uses agg with external device after calling dev.new().

However, opening R from MacOS terminal command line, fonts are always pixelated.

Somehow, I've been able to cycle through some tests, and the font size in the RStudio plot pane has gotten progressively smaller. (?) By opening dev.new(), enabling showtext, testing, closing the device, testing the RStudio pane, closing it, etc. It's pretty buggy. I know it's hard to reproduce... I'll try to make a minimal test and add a comment. I need to open a new RStudio, I can't seem to find any graphical option that can explain the extremely small font size with cex=1.

jmw86069 avatar Mar 10 '25 03:03 jmw86069

I think I understand. The showtext_auto(enable=TRUE) is "sticky" - at least for my environment it does not release the hold on the device. I posted a separate issue with the "sticky" showtext_auto() that I think may fix that issue.

As for pixelated text output on MacOS, I don't have a good lead.

jmw86069 avatar Mar 10 '25 15:03 jmw86069