#1868 gnuplot pdfcairo unnamed Type 3 font in output


Gnuplot with the pdfcairo terminal seems to give strange behavior in terms of fonts, where the generated pdf has unnamed, Type 3 fonts. Here's output from pdffonts on the output pdf file:

name                 type              encoding         emb sub uni object ID
------------------ ----------------- ---------------- --- --- --- ---------
[none]              Type 3            Custom           yes no  yes      5  0
HTVMTJ+Helvetica    CID TrueType      Identity-H       yes yes yes      6  0
ITRAZO+Helvetica    CID TrueType      Identity-H       yes yes yes      7  0

This is a problem because publishers often refuse to accept Type 3 fonts in documents. Below is a small gnuplot file that reproduces the problem on OS X El Capitan 10.11.3, gnuplot 5.0 patchlevel 5:

set terminal pdfcairo font "Helvetica, 16"
set output "../plots/test.pdf"
set xlabel "x-axis"
set ylabel "y-axis"
set xrange [0:1]
set yrange [0:1]
plot 0.5 title "y=0.5"  w l lw 3

A workaround is to use the postscript terminal and then epstopdf, which does correctly embed only the right font.


  • Ethan Merritt

    Ethan Merritt - 2016-10-25

    gnuplot does not do its own font handling, so you will have to look elsewhere for problems of this sort.
    In the case of cairo, fonts are managed by the fontconfig system utility. See "man fonts-conf" and lots of other documentation about system font handling.

    At a guess, your fontconfig files (in /etc/fonts/ on my system but I don't know about OSX) point to a directory containing Type 3 fonts. If you don't want to use these you could edit the configuration files to remove it, or re-order the search so that TrueType font directories are searched before Adobe Type 3 directories, etc. Or you could delete the fonts in question if you never want to use them.

    Note that fontconfig does not guarantee to return a font with the same name as the one requested. It has tables of font properties and tries to find one that is a good match to what was requested. So for instance if I run your test script here, fontconfig sees a request for "Helvetica 16" and returns TrueType font LiberationSans.

    Having said all that, I have encountered the same thing myself in dealing with pdf files submitted to publishers - with or without any involvment of gnuplot. One possible solution is to open the document in a pdf viewer (e,g, acrobat) and then use "print to file" to create a new pdf file with different properties.

  • Sam Mangham

    Sam Mangham - 2016-12-05

    I've hit this bug too, and it comes from including whitespace in axis labels or tics. I'm currently trying to build a minimum viable problem, as it's very inconsistent.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks