Re: AtkText interface and labels

"Padraig O'Briain" <Padraig Obriain Sun COM> writes:

> I have looked at what information GtkLabel gives us and it seems to
> me that we can get the position of the start of the text using
> gtk_label_get_layout() but cannot get the bounding rectangle.

That's what:

 void gtk_label_get_layout_offsets (GtkLabel *label,
                                    gint     *x,
				    gint     *y);

is for - combined with pango_layout_get_[pixel_]extents(), you
can use that to find the bounding box. 

Of course, that involves accessing the currently marked private 
label->layout field; and label->layout is also demand-created,
so its possible under some conditions that label->layout might
be NULL.

Could you file a bug on that an accessor
is needed for label->layout (which will internally call

> GtkLabel only provides an interface to get the entire label text as
> one string, i.e. gtk_label_get_text().
> Gtklabel can have PangoAttrList associated with the label using 
> gtk_label_set_attributes(); I assume that this is similar to styled text 
> referred to below.

Yes, you can do things like:
 gtk_label_new_with_markup ("this is <big>BIG</big> <b>bold</b> text");

which will parse the markup and create a string and an accompanying
attribute list.


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