Re: Default settings for GtkTextAttributes



Oisin Boydell <Oisin Boydell Sun COM> writes:

> I am implementing a function in the atk accessability interface which returns a 
> GList of gchar* name/value pairs which describe the attributes that are set at a 
> particular point in the text. If a particular attribute is not set, the function 
> will not return any mention of it since only attributes that are explicity set 
> are of interest. But it is impossible to tell whether an attribute is set or not 
> by looking at a GtkTextAttribute struct since all values will be set to some 
> default value. I do not know if the font stretch was explicitly set to 
> PANGO_STRETCH_ULTRA_CONDENSED or if this is just the default value for example.
> 
> There are two solutions to this that I can see:
> 1. Add a new value to all the Pango enumerations specifying that no value is set 
> such as PANGO_WEIGHT_UNSET, PANGO_STRETCH_UNSET etc.
> 2. Add flags to the GtkTextAttributes struct to specify which values are 
> set/unset.
> 
> I noticed that GtkTextTags have flags specifying if values are set/unset but 
> when tags are converted into a GtkTextAttributes struct by the 
> _gtk_text_attributes_fill_from_tags() function as part of the public 
> gtk_text_iter_get_attributes() this information is lost.

The gtk_text_iter_get_attributes() function was intended for
retrieving the attributes for display - after all a user has no way of
knowing whether these attributes come from tags set on the buffer, or
from default values set for the entire buffer.

I don't see changing GtkTextAttributes - for the use 
gtk_text_iter_get_attributes() was originally intended for, 
the set flags would be overkill, since for display, we need
to know _all_ the attributes.

If you really need to get the information about what attributes have
been overriden on a particular stretch of text, it should be possible
(if a little long-winded) for you to go down a level and work from
gtk_text_iter_get_tags() instead.

Regards,
                                        Owen




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