A problem with fonts and/or printing PNG files?
Petr Mikulik
mikulik at physics.muni.cz
Fri Feb 29 01:56:07 CST 2008
> > | > x = 1:10 ;
> > | > plot (x);
> > | > title ('My plot');
> > | > print myplot.png -dpng
> > | >
> > | > 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.
> >
> > 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"
You are right; and the file is really called arial.ttf, so "arial,10" is
correct. For filenames, see e.g. the directory /usr/share/fonts/truetype
> 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.
The GDFONTPATH should be set, if the gd library cannot find the fonts by
default (e.g. %WINDIR%/FONTS or /usr/share/fonts/truetype/)
>| 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.
>
> I'd consider a patch.
The same code as for "print('x.png', '-dpng')" can be used, just with
replaced "set term png" by "set term jpeg" or "set term gif".
I'm just looking to Matlab, and it seems that it does not have '-Sn,n'
option, but '-rn' option for resolution ... but I don't see for which page
size.
---
PM
More information about the Bug-octave
mailing list