From 2990e0d7967b7b8c671db6cb24369a525117b05d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 25 Jan 2006 16:23:33 +0000 Subject: [PATCH] Use logical extents of the layout instead of ink extents. According to 2006-01-25 Behdad Esfahbod * gtk/gtklabel.c (get_layout_location): Use logical extents of the layout instead of ink extents. According to Pango docs, that's what should be used for placement. Moreover, simply use pango_layout_get_pixel_size instead of getting the extents and dividing ourselves. --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ gtk/gtklabel.c | 10 ++-------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 876eb05ee5..7098561049 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-01-25 Behdad Esfahbod + + * gtk/gtklabel.c (get_layout_location): Use logical extents of the + layout instead of ink extents. According to Pango docs, that's what + should be used for placement. Moreover, simply use + pango_layout_get_pixel_size instead of getting the extents and + dividing ourselves. + 2006-01-25 Matthias Clasen * gdk/x11/gdkcursor-x11.c (gdk_x11_display_set_cursor_theme): Only diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 876eb05ee5..7098561049 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2006-01-25 Behdad Esfahbod + + * gtk/gtklabel.c (get_layout_location): Use logical extents of the + layout instead of ink extents. According to Pango docs, that's what + should be used for placement. Moreover, simply use + pango_layout_get_pixel_size instead of getting the extents and + dividing ourselves. + 2006-01-25 Matthias Clasen * gdk/x11/gdkcursor-x11.c (gdk_x11_display_set_cursor_theme): Only diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 79c5be1c48..1ad227dc7a 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -2221,18 +2221,12 @@ get_layout_location (GtkLabel *label, if (label->ellipsize || priv->width_chars > 0) { int width; - PangoRectangle ink_rect; width = pango_layout_get_width (label->layout); if (width == -1) - { - pango_layout_get_extents (label->layout, &ink_rect, NULL); - req_width = PANGO_PIXELS (ink_rect.width); - } + pango_layout_get_pixel_size (label->layout, &req_width, NULL); else - { - req_width = PANGO_PIXELS (width); - } + req_width = PANGO_PIXELS (width); } else req_width = widget->requisition.width;