[R] Problem with Palatino font in pdf figures

Paul Smith phhs80 at gmail.com
Sun Sep 30 20:14:22 CEST 2007


On 9/30/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> >>> Consider the following piece of code:
> >>>
> >>> pdf(file="figure.pdf", family="Palatino")
> >>> plot(0,0,type='n', xlim=c(-20,20), ylim=c(0,2),xlab="",ylab="",axes=F)
> >>> text(-1.4,1.168,expression(italic("The font looks different when this
> >>> is seen with Acrobat Reader!")),xpd=T)
> >>> dev.off()
> >>>
> >>> When viewing the produced figure.pdf with kpdf (on Linux), it looks as
> >>> being written with LaTeX Mathpazo font, but not when one views
> >>> figure.pdf with Acrobat Reader. Any ideas about how to get the same
> >>> result both with kpdf and with Acrobat Reader?
> >>
> >> Note that R does not embed the fonts by default in the PDF file.
> >>
> >> Based upon what I am seeing here on F7, which is consistent with your
> >> comments, the font substitution mapping in Adobe Reader 8 is different
> >> than that in either kpdf, gv or in Evince. The latter three appear to be
> >> using the same font substitution and look the same.
>
> There is a note to that effect in ?pdf.  All the viewers based on
> GhostScript are going to be using URW fonts (under Linux, at least), that
> is use URW Palladio to substitute Palatino.  xpdf is configurable, but I
> believe is also normally set up to use URW T1 fonts.
>
> >> You might want to review ?pdfFonts and ?embedFonts for additional
> >> information as well as the article by Paul Murrell and Prof. Ripley in R
> >> News on non-standard fonts:
> >>
> >>   http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdf
> >
> > Thanks, Marc. With embedFonts, everything gets right!
>
> I dobut it: Palatino is a commercial font (I believe it is a Linotype
> trademark) and _if_ you have it you need to worry about the legality of
> embedding it.  Most likely you have arranged to substitute URWPalladio
> everywhere, in which case you would do better to use the correct font
> metrics by specifying that in the first place.

Thanks for your clarification. In fact,

$ pdffonts figure.pdf
name                                 type         emb sub uni object ID
------------------------------------ ------------ --- --- --- ---------
LBSBWQ+Palatino-Italic               Type 1C      yes yes no      11  0
SLZFVF+Palatino-Roman                Type 1C      yes yes no       9  0
$

but if I specify

pdf(file="figure.pdf", family="URWPalladio")

I get

$ pdffonts figure.pdf
name                                 type         emb sub uni object ID
------------------------------------ ------------ --- --- --- ---------
RNPZMM+URWPalladioL-Ital             Type 1C      yes yes no       9  0
$

Paul



More information about the R-help mailing list