Viechtbauer, Wolfgang (SP)
2021-Jan-19 14:48 UTC
[R] Monospaced font not shown correctly (Xubuntu 20.04)
Hi all, On my system (Xubuntu 20.04), using par(family="mono") is not rendered correctly. The same issue was raised here: https://stackoverflow.com/questions/64207220/rendering-plot-in-r-with-mono-spaced-family-font-does-not-display-characters-any Using par(family="monospace") does work: par(mfrow=c(1,2)) par(family="mono") plot(1) par(family="monospace") plot(1) Also, when saving to pdf, it works fine: pdf("plot.pdf"); par(family="mono"); plot(1); dev.off() I have forced a refresh of the font cache: fc-cache -r --verbose --really-force And Courier is available:> fc-list | grep Courier/usr/share/fonts/X11/Type1/c0419bt_.pfb: Courier 10 Pitch:style=Regular /usr/share/fonts/type1/texlive-fonts-recommended/pcrb8a.pfb: Courier:style=Bold /usr/share/fonts/X11/Type1/c0611bt_.pfb: Courier 10 Pitch:style=Bold Italic /usr/share/fonts/type1/texlive-fonts-recommended/pcrr8a.pfb: Courier:style=Regular /usr/share/fonts/X11/Type1/c0582bt_.pfb: Courier 10 Pitch:style=Italic /usr/share/fonts/X11/Type1/c0583bt_.pfb: Courier 10 Pitch:style=Bold /usr/share/fonts/type1/texlive-fonts-recommended/pcrro8a.pfb: Courier:style=Italic /usr/share/fonts/type1/texlive-fonts-recommended/pcrbo8a.pfb: Courier:style=Bold Italic Any other ideas how to fix this? Best, Wolfgang (happy to move this to R-SIG-Debian if this would be more appropriate)> sessionInfo()R version 4.0.3 (2020-10-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.1 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 [4] LC_COLLATE=C LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_4.0.3 tools_4.0.3> X11Fonts()$serif [1] "-*-times-%s-%s-*-*-%d-*-*-*-*-*-*-*" $sans [1] "-*-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*" $mono [1] "-*-courier-%s-%s-*-*-%d-*-*-*-*-*-*-*" $Times [1] "-adobe-times-%s-%s-*-*-%d-*-*-*-*-*-*-*" $Helvetica [1] "-adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*" $CyrTimes [1] "-cronyx-times-%s-%s-*-*-%d-*-*-*-*-*-*-*" $CyrHelvetica [1] "-cronyx-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*" $Arial [1] "-monotype-arial-%s-%s-*-*-%d-*-*-*-*-*-*-*" $Mincho [1] "-*-mincho-%s-%s-*-*-%d-*-*-*-*-*-*-*"
Paul Murrell
2021-Jan-19 23:36 UTC
[R] Monospaced font not shown correctly (Xubuntu 20.04)
Hi The switch to XUbunutu 20.04 may mean a switch to Pango > 1.44 (it does on Ubuntu 20.04), which means loss of support for Type 1 fonts (on Cairo-based graphics devices). The Courier fonts (the default for "mono" on Cairo-based devices) that you found are all Type 1 (.pfb) fonts. What does this give you (the matches for the default "sans" and "serif" on Cairo-based devices) ... ? fc-match Times fc-match Helvetica If those are .ttf or .otf fonts then that would explain why "sans" and "serif" still work. A workaround is to specify the family name for a non-Type-1 monospaced font, e.g., "Courier New" (?), or install a non-Type-1 Courier replacement (and specify that). Hope that helps. Paul On 20/01/21 3:48 am, Viechtbauer, Wolfgang (SP) wrote:> Hi all, > > On my system (Xubuntu 20.04), using par(family="mono") is not rendered > correctly. The same issue was raised here: > > https://stackoverflow.com/questions/64207220/rendering-plot-in-r-with-mono-spaced-family-font-does-not-display-characters-any > <https://stackoverflow.com/questions/64207220/rendering-plot-in-r-with-mono-spaced-family-font-does-not-display-characters-any> > > Using par(family="monospace") does work: > > par(mfrow=c(1,2)) > par(family="mono") > plot(1) > par(family="monospace") > plot(1) > > Also, when saving to pdf, it works fine: > > pdf("plot.pdf"); par(family="mono"); plot(1); dev.off() > > I have forced a refresh of the font cache: > > fc-cache -r --verbose --really-force > > And Courier is available: > > > fc-list | grep Courier > > /usr/share/fonts/X11/Type1/c0419bt_.pfb: Courier 10 Pitch:style=Regular > /usr/share/fonts/type1/texlive-fonts-recommended/pcrb8a.pfb: > Courier:style=Bold > /usr/share/fonts/X11/Type1/c0611bt_.pfb: Courier 10 Pitch:style=Bold Italic > /usr/share/fonts/type1/texlive-fonts-recommended/pcrr8a.pfb: > Courier:style=Regular > /usr/share/fonts/X11/Type1/c0582bt_.pfb: Courier 10 Pitch:style=Italic > /usr/share/fonts/X11/Type1/c0583bt_.pfb: Courier 10 Pitch:style=Bold > /usr/share/fonts/type1/texlive-fonts-recommended/pcrro8a.pfb: > Courier:style=Italic > /usr/share/fonts/type1/texlive-fonts-recommended/pcrbo8a.pfb: > Courier:style=Bold Italic > > Any other ideas how to fix this? > > Best, > Wolfgang > > (happy to move this to R-SIG-Debian if this would be more appropriate) > > > sessionInfo() > R version 4.0.3 (2020-10-10) > Platform: x86_64-pc-linux-gnu (64-bit) > Running under: Ubuntu 20.04.1 LTS > > Matrix products: default > BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 > LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3 > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 > [4] LC_COLLATE=C LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C > [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] compiler_4.0.3 tools_4.0.3 > > > X11Fonts() > $serif > [1] "-*-times-%s-%s-*-*-%d-*-*-*-*-*-*-*" > > $sans > [1] "-*-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*" > > $mono > [1] "-*-courier-%s-%s-*-*-%d-*-*-*-*-*-*-*" > > $Times > [1] "-adobe-times-%s-%s-*-*-%d-*-*-*-*-*-*-*" > > $Helvetica > [1] "-adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*" > > $CyrTimes > [1] "-cronyx-times-%s-%s-*-*-%d-*-*-*-*-*-*-*" > > $CyrHelvetica > [1] "-cronyx-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*" > > $Arial > [1] "-monotype-arial-%s-%s-*-*-%d-*-*-*-*-*-*-*" > > $Mincho > [1] "-*-mincho-%s-%s-*-*-%d-*-*-*-*-*-*-*" > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > <https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > <http://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code.-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/