[atk: 1/2] Add ATK_TEXT_ATTR_TEXT_POSITION to the list of possible AtkText attributes
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [atk: 1/2] Add ATK_TEXT_ATTR_TEXT_POSITION to the list of possible AtkText attributes
- Date: Wed, 15 Jan 2020 15:43:55 +0000 (UTC)
commit 26756a4ffbbbda2c703e5a89b57d529b8d28495b
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Jan 15 15:43:35 2020 +0000
Add ATK_TEXT_ATTR_TEXT_POSITION to the list of possible AtkText attributes
IAccessible2 has a "text-position" attribute with values of "baseline",
"super", and "sub". This relative position is arguably preferable to
having applications specify the pixels via ATK_TEXT_ATTR_RISE, which
applications are not using anyway. Adding text position as an officially
supported attribute increases the likelihood that assistive technologies
will get this information in a predictable fashion.
atk/atktext.c | 11 +++++++++++
atk/atktext.h | 4 +++-
2 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/atk/atktext.c b/atk/atktext.c
index 3728bd4..ef489fc 100644
--- a/atk/atktext.c
+++ b/atk/atktext.c
@@ -135,6 +135,14 @@ static const guint8 underline_offsets[] = {
0, 5, 12, 19, 23
};
+static const char text_position[] =
+ "baseline\0"
+ "super\0"
+ "sub\0";
+static const guint8 text_position_offsets[] = {
+ 0, 9, 15,
+};
+
static void atk_text_base_init (AtkTextIface *class);
static void atk_text_real_get_range_extents (AtkText *text,
@@ -1335,6 +1343,9 @@ atk_text_attribute_get_value (AtkTextAttribute attr,
case ATK_TEXT_ATTR_STYLE:
g_assert (index >= 0 && index < G_N_ELEMENTS (style_offsets));
return style + style_offsets[index];
+ case ATK_TEXT_ATTR_TEXT_POSITION:
+ g_assert (index >= 0 && index < G_N_ELEMENTS (text_position_offsets));
+ return text_position + text_position_offsets[index];
default:
return NULL;
}
diff --git a/atk/atktext.h b/atk/atktext.h
index ca66a43..7d78ab5 100644
--- a/atk/atktext.h
+++ b/atk/atktext.h
@@ -43,7 +43,7 @@ G_BEGIN_DECLS
*@ATK_TEXT_ATTR_PIXELS_BELOW_LINES: Pixels of blank space to leave below each newline-terminated line.
*@ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP: Pixels of blank space to leave between wrapped lines inside the same
newline-terminated line (paragraph).
*@ATK_TEXT_ATTR_BG_FULL_HEIGHT: "true" or "false" whether to make the background color for each character
the height of the highest font used on the current line, or the height of the font used for the current
character.
- *@ATK_TEXT_ATTR_RISE: Number of pixels that the characters are risen above the baseline
+ *@ATK_TEXT_ATTR_RISE: Number of pixels that the characters are risen above the baseline. See also
ATK_TEXT_ATTR_TEXT_POSITION.
*@ATK_TEXT_ATTR_UNDERLINE: "none", "single", "double", "low", or "error"
*@ATK_TEXT_ATTR_STRIKETHROUGH: "true" or "false" whether the text is strikethrough
*@ATK_TEXT_ATTR_SIZE: The size of the characters in points. eg: 10
@@ -61,6 +61,7 @@ G_BEGIN_DECLS
*@ATK_TEXT_ATTR_STRETCH: The stretch of the text, if set. Values are "ultra_condensed", "extra_condensed",
"condensed", "semi_condensed", "normal", "semi_expanded", "expanded", "extra_expanded" or "ultra_expanded"
*@ATK_TEXT_ATTR_VARIANT: The capitalization variant of the text, if set. Values are "normal" or "small_caps"
*@ATK_TEXT_ATTR_STYLE: The slant style of the text, if set. Values are "normal", "oblique" or "italic"
+ *@ATK_TEXT_ATTR_TEXT_POSITION: The vertical position with respect to the baseline. Values are "baseline",
"super", or "sub". Note that a super or sub text attribute refers to position with respect to the baseline of
the prior character.
*@ATK_TEXT_ATTR_LAST_DEFINED: not a valid text attribute, used for finding end of enumeration
*
* Describes the text attributes supported
@@ -95,6 +96,7 @@ typedef enum
ATK_TEXT_ATTR_STRETCH,
ATK_TEXT_ATTR_VARIANT,
ATK_TEXT_ATTR_STYLE,
+ ATK_TEXT_ATTR_TEXT_POSITION,
ATK_TEXT_ATTR_LAST_DEFINED
} AtkTextAttribute;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]