Character encoding broken after cairo/pango update

Hello,
On linux:
Pango 1.44.6-1
Cairo 17.2+17+g52a7c79fd-1
r 3.6.1-1
rstudio-desktop-bin 1.2.1335-1

After recent update to cairo and pango character encoding is broken on RStudioGD.

plot(cars)

cars
Can you please suggest any options to correct this mess?
Thank you

1 Like

I don't think that it is an RStudioGD issue: I am not using RStudio and I am having the exact same issue (on Arch Linux).

Are you sure it is caused by cairo or pango? I tried downgrading both and the problem persists.

(I noticed the problem today, but I haven't plotted anything in R for a long time. So I don't know when the problem started and that makes it hard to pinpoint the problem upgrade...).

Hello,
I have pin-pointed the issue just to recent pango 1.44. Downgrading to 1.43 solves the issue. My understanding is pango developers removed support for Type 1 bitmap fonts, whatever that means.

1 Like

Oh, thanks. I had not downgraded pango far enough. Downgrading is not a long term solution though. Do you know if this has been reported somewhere?

Ah, I found more information on this:

A closed issue in the pango repo:

An open bug report in Arch Linux:

https://bugs.archlinux.org/index.php?do=details&action=details.addvote&task_id=63297

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

@matoxxx I finally got to investigating the problem and found the root of the problem (and an easy solution).

Do you happen to have the adobe-base-14-fonts package installed (or maybe some other Adobe font package)? If so, that is your problem.

I kept being puzzled at why there were not more threads on this subject on the web. As it turns out, this is affecting extremely few of us and this is why:

  • R, by default, uses a set of fonts, including helvetica (on linux, you can find the list with X11Fonts())

  • pango 1.44 terminated support for bitmap fonts. So any package using pango and bitmap fonts got broken. R does use pango. But the reason nobody is complaining about the problem is because most people don't use bitmap fonts

  • the adobe-base-14-fonts package however installs (in addition to many .ttf fonts) a number of bitmap fonts, including one for helvetica. So if you have this package installed (or another one which installs a bitmap version of any of the font that R uses), then things broke for you with the pango update

It is never a good solution to downgrade a package. So you should revert pango to 1.44 and uninstall adobe-base-14-fonts or whatever other package installed bitmap fonts in your machine. There is no doubt that you also have a .ttf helvetica file (probably from the gsfonts package, but possibly from other very common dependencies) and it will take over once the bitmap fonts are gone.

An alternative solution (nicer but more complex), if you don't want to loose the fonts in that package, is to configure fontconfig so that helvetica (and any other font that R uses) will use the .ttf file and not the bitmap file (in my case, all the bitmap files were .pfb files which are Adobe type1 fonts).

If the problem, in your case, is not caused by adobe-base-14-fonts and you don't know what caused it, you can run (on the command line, not in R, fc-match helvetica. If, instead of returning a .ttf file it returns some .pfb or other file, then you can search what installed that file). But I really suspect that adobe-base-14-fonts is the problem package for you as well and that the fix will thus be really easy.

I hope this helped. Thanks to you for pointing me in the right direction by pinpointing the problem to pango 1.44 in the first place.

I can confirm this works for me too. I always had feeling font configuration on linux is a mess ready to go down anytime.
Thank you

1 Like

I don't know what dictates which font file should be used when this is not set in fontconfig (as is the case, by default, for helvetica). If it is not customized by the user, I guess it all depends on the installed versions of the font. And in the present case the adobe package file took precedence. The clean way would thus be to customize it to be sure that the helvetica font will always use the .ttf file. I considered doing so, but I also went for the easy solution and simply got rid of the adobe package. If I really need an adobe font some day, I'll write a fontconfig file for helvetica.

Anyway, glad I could help. But it really was a team effort as you got me started in the right direction. Sorry it took me so long to get to it.