[R-sig-Debian] Font issue under X11() (Ubuntu 20.04)

Wolfgang Viechtbauer wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Wed Aug 24 15:11:54 CEST 2022


On Tue, 23 Aug 2022, Wolfgang Viechtbauer wrote:
> On Tue, 23 Aug 2022, Dirk Eddelbuettel wrote:
>> On 23 August 2022 at 15:04, Viechtbauer, Wolfgang (NP) wrote:
>> | Hi all,
>> |
>> | Using R under (X)ubuntu 20.04 here. I just noticed that the equal symbol
>> | (and other symbols like <>) are hanging kinda low under X11(). For 
>> example,
>> | if I run this code:
>> |
>> | plot(NA, xlim=c(0,2), ylim=c(0,2))
>> | text(1,1,"P = 0.01", cex=2)
>> | abline(h=1)
>> |
>> | then the = symbol is completely below the horizontal line, which looks a 
>> bit
>> | off. I can fix this with X11.options(family="...") by using a different 
>> font,
>> | but I am just wondering if there is something misconfigued on my system 
>> or if
>> | other people are seeing the same thing.
>> |
>> | Running R with 'FC_DEBUG=1 R' shows that
>> |
>> | family: "Nimbus Sans"(w)
>> |
>> | is apparently used as the default.
>> 
>> Looks to be the same for me under 22.04, but I am not sure what if anything 
>> I
>> can do for you here.  The package builds do nothing special with respect to
>> font configuration, setup, or load. "It's just R and x11."
>> 
>> Maybe a private email to Paul Murrell is the best way forward as this is
>> likely deep inside R ...
>
> Ok, thanks for confirming that this is not just some weird config on my end. 
> Will consider getting in your with Paul.

Another follow-up. So I think this is really an Ubuntu issue. R looks for 
Helvetica, but this gets matched to Nimbus Sans, as shown by:

fc-match Helvetica

and that font has these strangely dropped symbols (e.g., =<>), at least 
for the version that ships with Ubuntu 20.04.

The fix for this is to create ~/.config/fontconfig/fonts.conf with:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
     <match>
         <test name="family">
             <string>Helvetica</string>
         </test>
         <edit mode="assign" name="family" binding="same">
             <string>Liberation Sans</string>
         </edit>
     </match>
</fontconfig>

(or whatever font you want to use in place of Helvetica). Then X11(), but 
also other devices like png() and so on will make use of the desired font 
in place of Helvetica.

I don't think that there is anything for R to address here, so I'll skip 
contacting Paul.

Best,
Wolfgang



More information about the R-SIG-Debian mailing list