a11y: use actor color if no fgcolor found in pango attributes

This commit is contained in:
Philippe Normand 2011-02-04 10:20:23 +01:00 committed by Alejandro Piñeiro
parent 49d4317420
commit 11efaf8297

View File

@ -1249,6 +1249,25 @@ _cally_misc_layout_atk_attributes_from_pango (AtkAttributeSet *attrib_set,
return attrib_set;
}
static AtkAttributeSet*
_cally_misc_add_actor_color_to_attribute_set (AtkAttributeSet *attrib_set,
ClutterText *clutter_text)
{
ClutterColor color;
gchar *value;
clutter_text_get_color (clutter_text, &color);
value = g_strdup_printf ("%u,%u,%u",
(guint) (color.red * 65535 / 255),
(guint) (color.green * 65535 / 255),
(guint) (color.blue * 65535 / 255));
attrib_set = _cally_misc_add_attribute (attrib_set,
ATK_TEXT_ATTR_FG_COLOR,
value);
return attrib_set;
}
/**
* _cally_misc_layout_get_run_attributes:
*
@ -1278,7 +1297,10 @@ _cally_misc_layout_get_run_attributes (AtkAttributeSet *attrib_set,
{
*start_offset = 0;
*end_offset = len;
_cally_misc_add_actor_color_to_attribute_set (attrib_set, clutter_text);
}
else
{
iter = pango_attr_list_get_iterator (attr);
/* Get invariant range offsets */
/* If offset out of range, set offset in range */
@ -1310,6 +1332,10 @@ _cally_misc_layout_get_run_attributes (AtkAttributeSet *attrib_set,
/* Get attributes */
attrib_set = _cally_misc_layout_atk_attributes_from_pango (attrib_set, iter);
pango_attr_iterator_destroy (iter);
}
if (!_cally_misc_find_atk_attribute (attrib_set, ATK_TEXT_ATTR_FG_COLOR))
attrib_set = _cally_misc_add_actor_color_to_attribute_set (attrib_set, clutter_text);
return attrib_set;
}