[R] embedFonts with pdf files and Windows 7

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Feb 7 09:49:56 CET 2010


Do your systems actually have the fonts you are trying to embed?
I doubt it: Helvetica is a commercial font, and most likely the Linux 
system is embedding a substitute.  It would be better to do

pdf("test.pdf", family="NimbusSan", useDingbats=FALSE)
plot(matrix(rnorm(200),nc=2))
dev.off()
myCall <- embedFonts("test.pdf",outfile = "test-a.pdf")

This is what ?pdf says you should expect:

      Since ‘embedFonts’
      makes use of Ghostscript, it should be able to embed the URW-based
      families for use with other viewers.

If that does not work, you need to get help with your Ghostscript 
installation (it is all to do with how it is set up to handle font 
substitution, which the above should avoid).


On Sat, 6 Feb 2010, James M. Curran wrote:

> I am trying to embed fonts in my PDF images so that they are embedded for the 
> publisher of my book.
>
> I am running:
>
> Windows 7 - 64 Enterprise
> R 2.10.1
> Ghostscript 8.70
> Ghostview 4.9
> MiKTeX 2.8
>
> I have this tiny test script:
>
> pdf("test.pdf")
> plot(matrix(rnorm(200),nc=2))
> graphics.off()
>
> myCall = embedFonts("test.pdf",outfile = "test-a.pdf")
>
> which successfully issues this command to ghostscript:
>
> > myCall
> [1] "gswin32c.exe -dNOPAUSE -dBATCH -q -dAutoRotatePages=/None 
> -sDEVICE=pdfwrite 
> -sOutputFile=C:\\Users\\curran\\AppData\\Local\\Temp\\RtmpSkHosh\\Rembed136f65f3 
> -sFONTPATH=  test.pdf"
>
> The file test.pdf is about 9kb with no fonts embedded. The file test-a.pdf is 
> about 4kb with no fonts embedded.
>
> I have tried altering the options:
>
> options = "-dEmbedAllFonts=true",
>
> and the font path
>
> fontpath = "C:\\Windows\\Fonts"
>
> To no avail. The only way I can get embedFonts to work is to shift the work 
> over to our Linux system.
>
> Any help would be greatly appreciated.

-- 
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