Skip to content

X11 font error on headless server running Xvfb

3 messages · Jonathan Levine, MacQueen, Don

#
I am trying to run an R script to create a .png file containing a tree map on a headless Linux server using Xvfb.  When I try to run tmPlot, I get the following errors and warnings:

Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  : 
  X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 9 could not be loaded
Calls: tmPlot ... <Anonymous> -> widthDetails -> widthDetails.text -> grid.Call
In addition: Warning messages:
1: In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
...
etc.  (complete error message below)

The .png file does contain a partially constructed graph.  When I try something simple like plot(x,y) I get a plot with warnings.

The results from capabilities() and X11Fonts() (see end of message) suggest to me that it should work.

Any idea what is happening and how to fix the problem (or work around it)?


Thanks,

Jay
--------------------------
R version 2.15.0 (2012-03-30)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] treemap_1.0-4      data.table_1.8.0   RColorBrewer_1.0-5
jpeg      png     tiff    tcltk      X11     aqua http/ftp  sockets 
    TRUE     TRUE     TRUE     TRUE     TRUE    FALSE     TRUE     TRUE 
  libxml     fifo   cledit    iconv      NLS  profmem    cairo 
    TRUE     TRUE    FALSE     TRUE     TRUE    FALSE    FALSE
$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-*-*-*-*-*-*-*"
+ vSize=vars[4], 
+ vColor=vars[3], 
+ type="value")
Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  : 
  X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 9 could not be loaded
Calls: tmPlot ... <Anonymous> -> widthDetails -> widthDetails.text -> grid.Call
In addition: Warning messages:
1: In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
2: In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
3: In grid.Call.graphics(L_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
4: In grid.Call.graphics(L_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
5: In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
6: In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
7: In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
8: In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
9: In grid.Call.graphics(L_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
10: In grid.Call.graphics(L_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just,  :
  X11 protocol error: BadMatch (invalid parameter attributes)
Execution halted
#
You could try the Cairo() device from the Cairo package. It's my
understanding (from a time when I was using Xvgb for the same reason) that
Cairo does not depend on X Windows.

-Don
3 days later
#
Thanks, Don.  the Cairo package was just what I needed.

It was a challenge to get it all set up on the serve since I don't have root privileges.  Had to install Pixman and Cairo, figure out to set TMPDIR so R could build the package.  

This page was critical is getting Cairo to compile from source:  http://comments.gmane.org/gmane.comp.lib.cairo/20962 ,
and the R admin manual http://cran.r-project.org/doc/manuals/R-admin.pdf explained some of the issues with installing the packages .

Jay
On Jun 4, 2012, at 5:37 PM, MacQueen, Don wrote: