[clutter/clutter-1.14] text: Consider text direction when computing layout offsets
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/clutter-1.14] text: Consider text direction when computing layout offsets
- Date: Thu, 21 Nov 2013 00:10:07 +0000 (UTC)
commit b45a1ded44dc585a9755cb9b55729931fd40c410
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Sep 10 20:56:09 2013 +0200
text: Consider text direction when computing layout offsets
Currently this is only the case when the actor's x-expand/x-align
flags have been set and clutter_text_compute_layout_offsets() is
used.
https://bugzilla.gnome.org/show_bug.cgi?id=705779
(cherry picked from commit 986e46dc6677a708cd3db8abaf28f09cd2007c4b)
Signed-off-by: Emmanuele Bassi <ebassi gnome org>
clutter/clutter-text.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c
index 5606125..0cfb63f 100644
--- a/clutter/clutter-text.c
+++ b/clutter/clutter-text.c
@@ -2264,6 +2264,7 @@ clutter_text_paint (ClutterActor *self)
{
PangoRectangle logical_rect = { 0, };
gint actor_width, text_width;
+ gboolean rtl;
pango_layout_get_extents (layout, NULL, &logical_rect);
@@ -2276,17 +2277,19 @@ clutter_text_paint (ClutterActor *self)
- 2 * TEXT_PADDING;
text_width = logical_rect.width / PANGO_SCALE;
+ rtl = clutter_actor_get_text_direction (self) == CLUTTER_TEXT_DIRECTION_RTL;
+
if (actor_width < text_width)
{
gint cursor_x = priv->cursor_pos.x;
if (priv->position == -1)
{
- text_x = actor_width - text_width;
+ text_x = rtl ? TEXT_PADDING : actor_width - text_width;
}
else if (priv->position == 0)
{
- text_x = TEXT_PADDING;
+ text_x = rtl ? actor_width - text_width : TEXT_PADDING;
}
else
{
@@ -2302,7 +2305,7 @@ clutter_text_paint (ClutterActor *self)
}
else
{
- text_x = TEXT_PADDING;
+ text_x = rtl ? actor_width - text_width : TEXT_PADDING;
}
}
else if (!priv->editable && !(priv->wrap && priv->ellipsize))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]