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



On Tue, Jun 08, 1999 at 02:23:28PM -0400, Havoc Pennington wrote:
> 
> On Tue, 8 Jun 1999, Jan-Oliver Wagner wrote:
> > 
> > - I need the width of canvas text items.
> > 	In the corresponding module of libgnomeui
> > 	a read-only argument "text_width" is listed.
> > 	But how do I get this value?
> > 	I thought there must be some function like
> > 	gnome_canvas_item_get() as a brother
> > 	of gnomer_canvas_item_set(), but I haven't
> > 	found it. Any clues?

> However, this may not be the best approach. Ideally, the layout will be
> done in the PiePlotState object, which has no knowledge of the
> GnomeCanvas. Remember that we will use the PiePlotState to print and so
> on, so you need the layout information there.
> 
> Thus, instead of using the width of the canvas item, I would use 
> VFont::string_width() in vfont.h You can get a font from the Frontend
> returned by guppi_frontend() in util.h. 
> 
> You can just assume that the width of the text item will be the same as
> the width of the VFont. It's possible that this won't be *exactly* true,
> but it will be close enough.

I have tried this

	// find out width and height of label
	Frontend * fe = guppi_frontend();
	g_assert(fe != 0);
	VFont * vfont = fe->default_font();
	g_assert(vfont != 0);
	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?

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

Jan



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