[R] pdf device and TeXencoding?

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Nov 7 22:44:58 CET 2005


On Mon, 7 Nov 2005, ivo welch wrote:

> [a] I believe that the pdf device does not yet fully support 
> TeXencoding.  (under R-2.2.0, the pdf file created with Textext as font 
> encoding still dies when post-processed by ghostscript.)  are there any 
> workarounds, or are there utilities that would allow a TeXencoded font 
> to be re-encoded/converted into ISOLatin, perhaps, which R could then 
> handle beautifully?

1) What does `dies' mean?
2) See the following R-patched NEWS entry

     o	pdf() was not writing details of the encoding to the file
 	correctly.  (Spotted by Alexey Shipunov in Russian encodings.)

so this may well be solved in current R (R-patched/R-devel).

> [b] is there a way to use an arbitrary postscript font and position it 
> into a ps or pdf graphic (i.e., without it being in the family {5 fonts} 
> that I am using for the main drawing)?  in a weird latex/R mix, my 
> intent is something like

Yes, see par(family=) and (in 2.2.x)  ?postscriptFont to create a family.

> 	pdf(file="test.pdf");
> 	plot( c(0,1),c(0,1) );
> 	test.font = fontis("postscriptfont.pfb");  # may need a tfm specification, too?
> 	text( 0.5, 0.5, fontobject("some text", test.font));
> 	dev.off();
>
> help would be highly appreciated, as always.

This area is all under development as we allow for CJK fonts.  In R-devel, 
something like

myfam <- Type1Font("test", rep("postscriptfont.afm"), 4)
pdf(file="test.pdf", fonts=myfam)
plot( c(0,1),c(0,1) )
text( 0.5, 0.5, "some text", family=myfam)
dev.off()

will work (and with amendments if this is a TeX-encoded font).


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list