Re: Getting/Setting text attributes for a GtkEntry



Marc Mulcahy wrote:
> 
> Hi All,
> 
> To play devil's advocate (no horns yet I hope), when you ask text for its
> attributes in most screen readers, or in Emacspeak, you get something
> back.  It is never the case that you ask text for its attributes and get
> nothing since all text does have some basic attributes (size, color,
> etc).  

OK, that's an interesting point.  Let's examine the use case a little
more closely: in the case of "non-attributable" widgets (those which
always use only "default" attributes), how interested is the blind
user in those attributes, since they are always the same and they
cannot be changed (except perhaps via the theme engine?)  A content
creator would care, but the cases we are looking at do not allow the
content creator to change the attributes, they are just vanilla,
whatever that means.  Of what interest is the name of the default
font, or the default foreground color?  The downside of providing this
information is that one then cannot distinguish between "specified"
attributes (e.g. "the guy who wrote this GUI wanted me to see blue
text here") and default ones (e.g. "this text happens to be blue").

I agree that there are probably a few cases where the info is of
interest irrespective of whether the widget text was "customized" or
not, but if we cannot distinguish programmatically set attributes from
default ones then I think we will cannot usefully build a screenreader
that "reads" attributes by default (which I think would be attractive
in some cases) since the signal-to-noise ratio will be too low.  

It would be possible (and perhaps quite simple) to build a separate
"atk_text_get_default_attributes ()" method.  One attraction of this
is, as I note below, it may make implementation sense to obtain these
attributes a different way from the others.   

> Does Pango not provide this info for us in the case of GtkEntry?

Generally Pango reports only those attributes that were "specified",
not those that were inherited by default.  Also, the pango elements in
GtkEntry are not externally available in GtkEntry (their accessory
methods are declared static), so we can't get to this info without
either modifying Gtk or hacking into GtkLabel's private data.  (The
pango layout is called "cached_layout" which suggests that the latter
might be dangerous as well as ugly).

I expect that there must be some way of getting to the default
attributes for text, but it will take a different execution path from
querying attributes that were programmatically set.

-Bill

> Marc

-- 
--------------
Bill Haneman
Gnome Accessibility / Batik SVG Toolkit
Sun Microsystems Ireland




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