[clutter/clutter-1.18] text: Discover the direction of the contents
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/clutter-1.18] text: Discover the direction of the contents
- Date: Tue, 4 Mar 2014 01:36:11 +0000 (UTC)
commit 50b6b59d02947bf17252c402deff112c2071edc8
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Mar 3 18:04:19 2014 +0000
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
clutter/clutter-text.c | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c
index 90565ff..17f3500 100644
--- a/clutter/clutter-text.c
+++ b/clutter/clutter-text.c
@@ -528,7 +528,30 @@ clutter_text_create_layout_no_cache (ClutterText *text,
pango_attr_list_unref (tmp_attrs);
}
else
- pango_layout_set_text (layout, contents, contents_len);
+ {
+ 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);
+ }
/* This will merge the markup attributes and the attributes
* property if needed */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]