1
0
Fork 0

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
This commit is contained in:
Emmanuele Bassi 2011-02-21 17:13:37 +00:00
parent 91740fd4df
commit 4442ddde82

View file

@ -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;
}