diff options
author | Sebastien Lafargue <slafargue@gnome.org> | 2014-12-18 20:52:58 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-01-10 21:23:14 -0500 |
commit | 583a8dd1a716b25b7b5ec011a84777b8ec8c4912 (patch) | |
tree | 66ddaf85647311637f3815f03d9085b0b1425828 | |
parent | d82e76c1de9a700d051c9af6759bf4c176ed2b1e (diff) | |
download | gtk+-583a8dd1a716b25b7b5ec011a84777b8ec8c4912.tar.gz |
gtktextlayout: fix for right margin with RTL text
When a RTL paragraph is not set to wrap, the right margin is not respected
because of the margins counted twice so we replace
display->width by PIXEL_BOUND (extents.width), the same quantity
without the margins.
https://bugzilla.gnome.org/show_bug.cgi?id=741702
-rw-r--r-- | gtk/gtktextlayout.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 7dbb62e13b..5019cf0b07 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -2129,6 +2129,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, GtkTextIter iter; GtkTextAttributes *style; gchar *text; + gint text_pixel_width; PangoAttrList *attrs; gint text_allocated, layout_byte_offset, buffer_byte_offset; PangoRectangle extents; @@ -2447,7 +2448,8 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, pango_layout_get_extents (display->layout, NULL, &extents); - display->width = PIXEL_BOUND (extents.width) + display->left_margin + display->right_margin; + text_pixel_width = PIXEL_BOUND (extents.width); + display->width = text_pixel_width + display->left_margin + display->right_margin; display->height += PANGO_PIXELS (extents.height); /* If we aren't wrapping, we need to do the alignment of each @@ -2455,7 +2457,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, */ if (pango_layout_get_width (display->layout) < 0) { - gint excess = display->total_width - display->width; + gint excess = display->total_width - text_pixel_width; switch (pango_layout_get_alignment (display->layout)) { |