Saturday, August 16, 2014

Using embedded fonts in eps graphs generated using gnuplot

When submitting camera ready versions to conferences/journals, you might come across a requirement where all the fonts (including those used in the EPS/PDF figures) should be embedded in the PDF.

To use embedded fonts in graphs generated using gnuplot, we need to use the font file used by MIKTEX (on windows) or its equivalent on Linux. In the below example, we use the "NimbusSanL-Regu" embedded font available in the ".pfb" file in the fonts folder in the Miktex installation directory (something like ...\Program Files\MiKTeX 2.7\fonts\type1\urw\helvetic\).

set terminal postscript eps enhanced "NimbusSanL-Regu" 12 fontfile "uhvr8a.pfb"
set output 'filename.eps'

When using the ".pfb" file you might come across an error in Gnuplot like:
"Automatic font conversion pfb->pfa not supported"

For this you can convert the pfb file to pfa file using tools like "pfbtops" (supports on-the-fly conversion to .pfa type) or "pfb2pfa" (if on-the-fly is not needed and you need the .pfa file output).  There is also an online service (http://everythingfonts.com/pfb-to-pfa) that can generate the pfa file.

Once the .pfa file is generated, you can use it in the same format.
set terminal postscript eps enhanced "NimbusSanL-Regu" 12 fontfile "uhvr8a.pfa"

References:
1. http://www.cepe.ethz.ch/howtodos/embed_fonts
2. http://everythingfonts.com/pfb-to-pfa
3. http://gnuplot.sourceforge.net/docs_4.2/node413.html

No comments:

Post a Comment