Moeb
Moeb

Reputation: 10871

Suppress the missing font warning with gnuplot

I am using gnuplot and get this warning everytime I generate a graph:

Could not find/open font when opening font "arial", using internal non-scalable font

Is there a way to suppress the warning?

Upvotes: 4

Views: 10853

Answers (1)

mgilson
mgilson

Reputation: 310117

This warning is generated by the gd backend I believe. Suppressing it might be a little tricky (you could try redirecting stderr of the gnuplot process), but gnuplot seems to like to write useful things to stderr, so I don't advise that ... and the builtin (non-scalable) font looks like garbage. The easiest fix is to see if your gnuplot was built with pango-cairo support. Just try:

set term pngcairo

instead of:

set term png

In this case, the font subsystem of cairo will take over rather than of gd. As a side bonus, I've found that I'm much happier with the cairo plots.

If that's not an option, you can download/find a suitable font and put it in a directory somewhere. Then you can set an environment variable GDFONTPATH to point to that directory. For example, find a truetype font that looks like Arial and put it in ~/fonts/arial.ttf. Then set your environment export GDFONTPATH=${HOME}/fonts and all should work.

If you're willing to live with the ugly font that gd provides, you can use the builtin fonts explicitly:

set term png tiny

or:

set term png large

See help fonts gd for more information.

Upvotes: 5

Related Questions