Hi all:
I'm using grid to create a layout in R that will include text mixed with 
graphics.  In the layout, the positions of certain graphical elements depend on 
the number of lines in adjacent text blocks (which will vary from case to 
case).  I was hoping to use grid's built in functions to automate the placement 
of the graphical elements.  I can get this to work if I use the standard pdf 
device, but when using the Cairo_pdf device (from the cairoDevice package), I 
run into problems.  I need the TrueType functionality of Cairo.
The example below illustrates my problem. The rectangle in "SizeMatch.pdf" 
matches the size of the text block, while the rectangle in "SizeMismatch.pdf" 
is too small.  Why is this the case?  I'm using R-2.13.0 (32bit) on Windows 7.  
Thanks a bunch.  Cheers, Al
---
library(cairoDevice)library(grid)
Cairo_pdf("SizeMismatch.pdf",11,8.5,pointsize=10)pushViewport(viewport(gp=gpar(fontfamily="Arial",font=1,fontsize=8,lineheight=0.9)))grid.text("The
 quick\nbrown fox\njumps\nover\nthe lazy 
dog")grid.rect(width=0.5,height=unit(5,"lines"))dev.off()
pdf("SizeMatch.pdf",11,8.5,pointsize=10)pushViewport(viewport(gp=gpar(fontfamily="Times",font=1,fontsize=8,lineheight=0.9)))grid.text("The
 quick\nbrown fox\njumps\nover\nthe lazy 
dog")grid.rect(width=0.5,height=unit(5,"lines"))dev.off()                       
               
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to