exposing text attributes via ATK

From: Mike Gorse <mgorse_at_mgorse.dhs.org>
Date: Fri Oct 19 2007 - 15:41:58 CEST

Hi Martin and all,

I have been working on adding accessibility support on Unix via atk and
would like to implement the function to expose text attributes. Following
is the relevant part from the idl in the at-spi source that describes the
way it is expected to work (I've abbridged it somewhat and removed the
parts not relevant to atk, which is bridged to at-spi):

     /**
      * Query a particular text object for the text attributes defined at a given offset,
      * obtaining the start and end of the "attribute run" over which these attributes are currently
      * invariant. Text attributes are those presentational, typographic, or semantic attributes or
      * qualitites which apply to a range of text specifyable by starting and ending offsets.
      * Attributes relevant to localization should be provided in
      * accordance with the w3c "Internationalization and Localization Markup Requirements",
      * http://www.w3.org/TR/2005/WD-itsreq-20051122/
      * Other text attributes should choose their names and value semantics in accordance with relevant
      * standards such as CSS level 2 (http://www.w3.org/TR/1998/REC-CSS2-19980512),
      * XHTML 1.0 (http://www.w3.org/TR/2002/REC-xhtml1-20020801), and
      * WICD (http://www.w3.org/TR/2005/WD-WICD-20051121/). ...
      * startOffset and endOffset will be back-filled to indicate the start and end of the attribute run
      * which contains 'offset' - an attribute run is a contiguous section of text whose attributes are
      * homogeneous.
      * @param offset the offset of the character whose attributes will be reported.
      * @param startOffset backfilled with the starting offset of the character range over which all
      * text attributes match those of \c offset, i.e. the start of the homogeneous
      * attribute run including \c offset.
      * @param endOffset backfilled with the offset of the first character past the character range over which all
      * text attributes match those of \c offset, i.e. the character immediately after
      * the homogeneous attribute run including \c offset.
      * @param includeDefaults if False, the call should only return those attributes which are
      * explicitly set on the current attribute run, omitting any attributes which are inherited from
      * the default values. See also Text::getDefaultAttributes.
      *
      * @see Accessible::getAttributes
      *
      * @returns the AttributeSet defined at offset, optionally including the 'default' attributes.
      *
      * @since AT-SPI 1.7.0
      **/
     AttributeSet getAttributeRun (in long offset,
                                   out long startOffset,
                                   out long endOffset,
                                   in boolean includeDefaults);

The corresponding ATK function that I am trying to implement looks like
this:
static AtkAttributeSet *abi_atk_docview_get_run_attributes(AtkText *text, gint offset, gint *start_offset, gint *end_offset);

I presume this should combine the section, block, and text attributes
(there is also a get_default_attributes function which takes no arguments
which would correspond to the document attributes)

There are several functions in fv_View for getting attributes
(getAttrPropForPoint, getAttributes, getAllAttrProp, getCharFormat),
although none of these currently do exactly what I want. I could extract
a new function from one of them that would take an offset as an argument,
and the existing function would pass in the caret or selection offset. I
wonder if some of the existing functions could be combined, though, rather
than adding yet another function. I also need to be able to retrieve the
start and end offsets of the run of text associated with the given offset.
Perhaps optional parameters could be addded to
pd_Document::getSpanAttrProp (used by getAttrPropForPoint) and/or
fl_ContainerLayout::getSpanAP(), although the latter would require that
several other functions be modified.

Let me know what you think or if I'm not being clear about what I need to
expose.

Thanks,
-- Mike Gorse / AIM:linvortex / http://mgorse.freeshell.org --
Received on Fri Oct 19 15:48:25 2007

This archive was generated by hypermail 2.1.8 : Fri Oct 19 2007 - 15:48:25 CEST