From: Emmanuele Bassi Date: Mon, 21 Feb 2011 17:13:37 +0000 (+0000) Subject: text: Round up the size X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4442ddde8290a7ec447a070b624437579f678d56;p=profile%2Fivi%2Fclutter.git 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 --- 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; }