A problem with fonts and/or printing PNG files?
Dmitri A. Sergatskov
dasergatskov at gmail.com
Thu Feb 28 20:14:57 CST 2008
On Thu, Feb 28, 2008 at 1:57 PM, John W. Eaton <jwe at bevo.che.wisc.edu> wrote:
> On 28-Feb-2008, Petr Mikulik wrote:
>
> | > I'm having a problem when I try to print a plot in PNG format. Here's
> | > a simple script that reproduces the problem on my machine:
> | >
> | > x = 1:10 ;
> | > plot (x);
> | > title ('My plot');
> | > print myplot.png -dpng
> | >
> | > When I type the print command, I get this error message:
> | >
> | > gdImageStringFT: Could not find/open font while printing string My plot
> | > with font Helvetica
> | >
> | > It only seems to happen when I try to print PNG. JPG, GIF and SVG
> | > formats all print fine.
> |
> | It seems to me that all, including the postscript output, are wrong.
> | See the postscript code generated by
> | print myplot.eps -deps
> | According to
> | drawnow("postscript","/dev/null",false,"debugeps.gp")
> | Octave sends to gnuplot
> | set title "My plot" font "helvetica,10";
> | which is wrong, because the postscript font name is "Helvetica", no
> | "helvetica". This needs a bug fix in Octave.
>
> This is fixed now.
>
>
> | In the case of
> | print myplot.png -dpng
> | the gd+freetype library used by gnuplot cannot find file "helvetica.ttf" and
> | thus producing the error message. I don't see any such file on my Linux box.
> | I think that another font, e.g. arial (arial.ttf exists) should be used
> | instead.
>
> On my system (Debian testing, up to date) I also see the error if I
> use gnuplot directly and ask for Arial:
>
> gnuplot> plot sin(x)
> gnuplot> set title "foobar" font "Arial,10"
> gnuplot> set term png
> Terminal type set to 'png'
> Options are 'nocrop medium '
> gnuplot> set output "foo.png"
> gnuplot> replot
> gdImageStringFT: Could not find/open font while printing string foobar with font Arial
>
> so what package do I need to get Arial?
>
This is GD library issue. You need to set GDFONTPATH to the
directory where it can find Arial.ttf.
Also if the file name is arial.ttf you need to say to gnuplot:
set title "foobar" font "arial,10"
Alternatively you can specify entire path:
gnuplot> set title "foobar" font "/usr/share/fonts/msttcorefonts/arial.ttf,14"
This all looks ugly and perhaps there is a better way, but I do not know it.
>
> jwe
>
Regards,
Dmitri.
More information about the Bug-octave
mailing list