mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
text: Discover the direction of the contents
We should set the direction on the PangoContext when creating a PangoLayout based on a best effort between the contents of the text itself and the text direction of the widget, in case that fails. https://bugzilla.gnome.org/show_bug.cgi?id=705779
This commit is contained in:
parent
c42aa42361
commit
50b6b59d02
@ -528,7 +528,30 @@ clutter_text_create_layout_no_cache (ClutterText *text,
|
|||||||
pango_attr_list_unref (tmp_attrs);
|
pango_attr_list_unref (tmp_attrs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
PangoDirection pango_dir;
|
||||||
|
|
||||||
|
if (priv->password_char != 0)
|
||||||
|
pango_dir = PANGO_DIRECTION_NEUTRAL;
|
||||||
|
else
|
||||||
|
pango_dir = pango_find_base_dir (contents, contents_len);
|
||||||
|
|
||||||
|
if (pango_dir == PANGO_DIRECTION_NEUTRAL)
|
||||||
|
{
|
||||||
|
ClutterTextDirection text_dir;
|
||||||
|
|
||||||
|
text_dir = clutter_actor_get_text_direction (CLUTTER_ACTOR (text));
|
||||||
|
|
||||||
|
if (text_dir == CLUTTER_TEXT_DIRECTION_RTL)
|
||||||
|
pango_dir = PANGO_DIRECTION_RTL;
|
||||||
|
else
|
||||||
|
pango_dir = PANGO_DIRECTION_LTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
pango_context_set_base_dir (clutter_actor_get_pango_context (CLUTTER_ACTOR (text)), pango_dir);
|
||||||
|
|
||||||
pango_layout_set_text (layout, contents, contents_len);
|
pango_layout_set_text (layout, contents, contents_len);
|
||||||
|
}
|
||||||
|
|
||||||
/* This will merge the markup attributes and the attributes
|
/* This will merge the markup attributes and the attributes
|
||||||
* property if needed */
|
* property if needed */
|
||||||
|
Loading…
Reference in New Issue
Block a user