[R] eps file with embedded font

Jonathan Baron baron at psych.upenn.edu
Fri Sep 4 17:06:15 CEST 2009


A couple of other ideas about embedding fonts and setting bounding
boxes.  These all work on Linux, so in theory they should also work on
OS X, although I have no idea how.

1. For setting bounding boxes, you can use gv, which is a PostScript
viewer.  As you move the pointer around, you can see the numbers in a
side panel.

2. Another way to do it is to set them automatically using ghostscript.
(This is based on a suggested made by Brian Ripley.)  Here is a script
that does this for me:

#!/bin/bash
cat $1 | sed -r -e "s/BoundingBox:[\ ]+[0-9]+[\ ]+[0-9]+[\ ]+[0-9]+[\ ]+[0-9]+/`gs -sDEVICE=bbox -dBATCH -dNOPAUSE -q`/" > temp.eps
gs -sDEVICE=bbox -sNOPAUSE -q $1 $showpage -c quit 2> bb.out
sed -e"1 r bb.out" temp.eps > $1
/bin/rm bb.out
/bin/rm temp.eps

The idea is to remove the bounding box that exists and replace it.
You run it by saying
bbox myfile.eps
(It doesn't matter if it is .ps instead of eps at this point.)

3. Finally, there is a pdf viewer called xpdf, which will embed fonts
by default if you use it to print to a file.  (I'm not sure it still
does this by default, but there is an option for it.)  So first
convert to pdf, then read with xpdf, then print to file (and then, if
necessary, convert back to pdf again).  This is what I did for my last
book; even though I used standard PostScript fonts, the publisher
insisted that they all be embedded.

Xpdf comes with a thing called pdffonts that will list the fonts in a
pdf file and tell you whether they are embedded.

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron




More information about the R-help mailing list