A problem with fonts and/or printing PNG files?

Petr Mikulik mikulik at physics.muni.cz
Thu Feb 28 12:44:40 CST 2008


>    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.

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.

Output to GIF or JPG does not work either. It seems to me that gnuplot's 
"set term gif|jpeg" is not used as 
	print('myplot.jpg', '-djpg', '-S800,600')
	print('myplot.gif', '-dgif', '-S800,600')
does not work. I propose Octave uses gnuplot for this output, not a 
conversion via postscript.

---
PM



More information about the Bug-octave mailing list