From 4442ddde8290a7ec447a070b624437579f678d56 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 21 Feb 2011 17:13:37 +0000 Subject: [PATCH] text: Round up the size Converting from Pango units to pixels by using the C conventions might cause us to lose a pixel; since we're doing the same for the height, we should use ceilf() to round up the width and the line height. http://bugzilla.clutter-project.org/show_bug.cgi?id=2573 --- clutter/clutter-text.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 835806c..496e464 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -1958,7 +1958,7 @@ clutter_text_get_preferred_width (ClutterActor *self, logical_width = logical_rect.x + logical_rect.width; layout_width = logical_width > 0 - ? (logical_width / 1024.0f) + ? ceilf (logical_width / 1024.0f) : 1; if (min_width_p) @@ -2014,7 +2014,7 @@ clutter_text_get_preferred_height (ClutterActor *self, * the height accordingly */ logical_height = logical_rect.y + logical_rect.height; - layout_height = ceilf ((gfloat) logical_height / 1024.0f + 0.5); + layout_height = ceilf (logical_height / 1024.0f); if (min_height_p) { @@ -2030,7 +2030,7 @@ clutter_text_get_preferred_height (ClutterActor *self, pango_layout_line_get_extents (line, NULL, &logical_rect); logical_height = logical_rect.y + logical_rect.height; - line_height = (gfloat) logical_height / 1024.0f; + line_height = ceilf (logical_height / 1024.0f); *min_height_p = line_height; } -- 2.7.4