Post

1 follower Follow
0
Avatar

font error in plots

I have RStudio installed on an EC2 server via the instructions posted here:
http://www.youtube.com/watch?v=a7x2STw79Go

However, whenever I plot, the font is all squares and the console prints the following messages:

(process:21446): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='latin'

(process:21446): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='common'

Any suggestions?

Ian Pylvainen

7 comments

0
Avatar

Hi Mike,

We don't have any experience with RStudio running on the Amazon Linux distro -- I do know that we rely on an installation of the pangocairo library to render text, and it may be that this library is either not installed or not configured properly on the EC2 instance. On Debian and RedHat systems we install this (respectively) using:

sudo apt-get install libpango1.0-0

sudo yum install pango

Note that R also has an (optional) dependency on pango cairo that is nevertheless highly recommended. See:

http://stat.ethz.ch/R-manual/R-devel/doc/manual/R-admin.html#Useful-libraries-and-programs

Hope this helps!

J.J.

Ian Pylvainen 0 votes
0
Avatar

In the initial install, I installed R (from source) then pango, then RStudio. I just now tried re-installing R (from source) to see if it would see pango and fix things, but upon completion RStudio still shows the font errors. I note that in the output of ./config during the R install there is a line:

checking whether pkg-config knows about cairo and pango... no
checking whether pkg-config knows about cairo... no

Any idea why config doesn't seem to be able to find pango and cairo when they are indeed installed (via yum)?

Here's the full configure output: https://gist.github.com/1122670

Ian Pylvainen 0 votes
0
Avatar

Notably, when I run the following code in R outside RStudio:

pdf()
plot(1,1)
dev.off()

I get a pdf file with the proper font. So it seems that its only within RStudio that the font problem appears.

Ian Pylvainen 0 votes
0
Avatar

Also of note, when I export to pdf from within RStudio, the resulting pdf appears with the proper font.

Ian Pylvainen 0 votes
0
Avatar

Mike,

I am not really sure what is going on (don't have any experience with installs on the Amazon EC2 image -- the RPMs definitely find and use pango cairo correctly on RedHat, CentOS, and Fedora). I do know that when RStudio is built from source it also scans for cairo and pango using pkg-config so the fact that R can't find it using that technique may also be a clue.

J.J.
J.J.

Ian Pylvainen 0 votes
0
Avatar

Fixed it. I simply had to install some fonts via:

sudo yum -y install dejavu-sans-fonts dejavu-serif-fonts
Ian Pylvainen 0 votes