mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-02 17:00:19 +00:00
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
This commit is contained in:
parent
ed1fb8d2af
commit
73c8f30928
@ -2147,6 +2147,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
|
|||||||
GtkTextIter iter;
|
GtkTextIter iter;
|
||||||
GtkTextAttributes *style;
|
GtkTextAttributes *style;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
|
gint text_pixel_width;
|
||||||
PangoAttrList *attrs;
|
PangoAttrList *attrs;
|
||||||
gint text_allocated, layout_byte_offset, buffer_byte_offset;
|
gint text_allocated, layout_byte_offset, buffer_byte_offset;
|
||||||
PangoRectangle extents;
|
PangoRectangle extents;
|
||||||
@ -2465,7 +2466,8 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
|
|||||||
|
|
||||||
pango_layout_get_extents (display->layout, NULL, &extents);
|
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);
|
display->height += PANGO_PIXELS (extents.height);
|
||||||
|
|
||||||
/* If we aren't wrapping, we need to do the alignment of each
|
/* If we aren't wrapping, we need to do the alignment of each
|
||||||
@ -2473,7 +2475,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
|
|||||||
*/
|
*/
|
||||||
if (pango_layout_get_width (display->layout) < 0)
|
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))
|
switch (pango_layout_get_alignment (display->layout))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user