2009-05-27

Embeding fonts in figures produced by R

Some publishers insist that we embed (include) the fonts in each figure. Here is a set of links regarding this issue for figures produced by R:

2 comments:

Karl Ove Hufthammer said...

And the publishers rightly insist on this. Having PDFs with non-embedded fonts is extremely bad practice, and leads to all sorts of problems.

After trying very many solutions, I have found that the best way to embed the fonts is to use R to create a PS file, and then to execute:

ps2eps --size b3 --ignoreBB --loose --force file.ps

GS_OPTIONS='-dPDFSETTINGS=/prepress' epstopdf file.eps

Other solutions have various problems, such as too large margins, slightly (about 1 point) too small margins, leading to parts of the text being cut off, or problems handling colour spaces.

I use a Makefile basically containing the above commands to automatically create PDF versions of all my PS figures.

The only problem with my approach, is that it doesn’t handle alpha transparency (since PostScript doesn’t support it).

Song said...

I had the same problem of embedding fonts in a large document with over 100 figures generated from R. Processing them one by one is time consuming. My solution is:

http://songqiansblog.blogspot.com/2009/03/embedding-all-fonts.html