[R] Should this PDF render correctly without font embedding?

Jeffrey Horner jeff.horner at vanderbilt.edu
Thu Jul 24 22:29:09 CEST 2008


A professor here at Vanderbilt sent me the following code. Each of the 
text strings should right justify against the center vertical bar, but 
because of font issues it doesn't. I understand that there are 
workarounds, but I was just curious if this was consistent across all 
platforms. On linux with R 2.7.1 and R-trunk (r46103), both acrobat 
reader 8 and kpdf render it incorrectly. How about Mac or Windows? Is 
this a platform config issue, or something else?

pdf('temp.pdf', width=11, height=8.5)
plot(0,0,xlim=c(0,1),ylim=c(0,1),type='n')
abline(v=.5)
# pos=2 is for right-alignment
text(0.5,0.9, 'Yo', pos=2)
text(0.5,0.8, 'Yo Yo', pos=2)
text(0.5,0.7, 'Yo Yo Yo', pos=2)
text(0.5,0.6, 'Yo Yo Yo Yo', pos=2)
text(0.5,0.5, 'Yo Yo Yo Yo Yo', pos=2)
text(0.5,0.4, 'Yo Yo Yo Yo Yo Yo', pos=2)
text(0.5,0.3, 'Yo Yo Yo Yo Yo Yo Yo', pos=2)
dev.off()

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner



More information about the R-help mailing list