default fontname graphics property

Ben Abbott bpabbott at mac.com
Sat Mar 7 22:06:58 CST 2009


On Mar 8, 2009, at 6:04 AM, John W. Eaton wrote:

> The default of "Helvetica" seems to cause a lot of trouble.  For
> example, many people report problems when trying to generate png files
> with gnuplot.  I only chose "Helvetica" because that's the default in
> Matlab and I thought people would expect that.  But since it causes so
> much trouble, maybe we should switch it to "*", which in Octave means
> "use the default font".  If the gnuplot backend sees "*" for the font
> name, it just skips trying to set an explicit name and gnuplot uses
> its default.  Does anyone see a good reason not to make this change?
>
> Thanks,
>
> jwe

I'm currently working on a changeset that will allow

	print (gcf, "-dpng", "-r300", "page.png")

to print a 300dpi image with tick-labels, axes-labels, and title  
positioned properly.

If you try the two commands below you'll see the problem.

	print (0:10)
	print (gcf, "-dpng", "-r300", "page.png")

Presently, a fontname of "*" prevents the "fontsize" info from being  
passed to gnuplot. For example, in __go_draw_axes__.m

1508   if (strcmp (fontname, "*"))
1509     fontspec = "";
1510   else
1511     fontspec = sprintf ("font \"%s,%d\"",  fontname, fontsize);
1512   endif

I don't see it in the gnuplot manual .... but ... the following works  
for me running gnuplot 4.3.x

	$ gnuplot

	Terminal type set to 'x11'
	gnuplot> set terminal x11 font "*,10"
	Terminal type set to 'x11'
	Options are ' nopersist font "*,10"'
	gnuplot> plot sin(x)
	gnuplot> set terminal x11 font "*,20"
	Terminal type set to 'x11'
	Options are ' nopersist font "*,20"'
	gnuplot> plot sin(x)

This would be a trivial change to make, once all the instances are  
located.  A quick grep indicates that all likely candidates appear to  
all be isolated to __go_draw_axes__

__go_draw_axes__.m:90:	if (strcmp (f, "*"))
__go_draw_axes__.m:110:	if (strcmp (f, "*"))
__go_draw_axes__.m:142:	if (strcmp (f, "*"))
__go_draw_axes__.m:173:	if (strcmp (f, "*"))
__go_draw_axes__.m:706:		   case "*"
__go_draw_axes__.m:946:	  if (strcmp (f, "*"))
__go_draw_axes__.m:1308:      case "*"
__go_draw_axes__.m:1508:  if (strcmp (fontname, "*"))

I'm rushing to finish my fontscaling work, so that it can be tested  
well prior to the 3.2 release and before I return to the day to day  
grind in a week ;-)

If someone else look at making this change it would be helpful. If not  
I'll get to it once I have the fontscaling working completed.

Ben







More information about the Octave-maintainers mailing list