Re: [guppi-list] Re: Problems with gnome/guppi




On Wed, 9 Jun 1999, Jan-Oliver Wagner wrote:
> 
> 	// find out width and height of label
> 	Frontend * fe = guppi_frontend();
> 	g_assert(fe != 0);
> 	VFont * vfont = fe->default_font();
> 	g_assert(vfont != 0);

Here, instead of an assertion you should just take some reasonable default
action; a good default action would be to not set the GnomeCanvasText's
font at all, and just pick some basically random numbers for your font
metrics.

If default_font() returns 0, it means that gnome-print doesn't know about
any fonts; Guppi will throw up a dialog warning the user about this, but
then you have to be careful not to crash. You can go ahead and have things
work badly, because this shouldn't happen, but don't crash. :-)

You might look at how the XY plot deals with this.

> 	double lh = vfont->font_height();
> 	double lw = vfont->string_width((const gchar *)"test-label");
> 
> 	g_debug("lw=%g, lh=%g\n", lw,lh);
> 
> lw and lh is always 0.
> I found quite similar code in xyplotstate, so I think
> the code - in principle - is OK.
> I have added debug output to xyplotstate: says also size always 0.
> So it seem to be a more general problem (on my system only?).
> 
> Has anyone a hint how to approach this problem?
> 

That's quite strange; I can only blame it on gnome-print, because Guppi is
just calling gnome-print. Let me debug this a bit; I'm coincidentally
working on fonts today, so I should have something.

> BTW: I have installed gnome-print-0.2. guppi always crashed with
> 0.1.1 installed (when starting pie charts).
> 

Maybe you tried to use the default font without checking for 0, and
gnome-print 1.1 wasn't finding any fonts? It's hard to say.

I'm improving fonts today and making a font-picker option menu, so maybe
I'll figure out some of these bugs in the process.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]