clutter-text: Round the layout width to nearest integer not down
When converting the floating point allocation width to an integer multiple of PANGO_SCALE to give to the PangoLayout it can sometimes end up slightly short of the allocated size due to rounding errors. This can cause some of the lines to be wrapped differently when a non-integer-aligned position is used (such as when animating text). It works better to round the number to the nearest integer by adding 0.5 instead of letting the default float cast truncate it downwards. http://bugzilla.openedhand.com/show_bug.cgi?id=2170
This commit is contained in:
parent
f97d16cd2d
commit
38da6b4a0e
@ -532,7 +532,7 @@ clutter_text_create_layout (ClutterText *text,
|
||||
!((priv->editable && priv->single_line_mode) ||
|
||||
(priv->ellipsize == PANGO_ELLIPSIZE_NONE && !priv->wrap))))
|
||||
{
|
||||
width = allocation_width * 1024;
|
||||
width = allocation_width * 1024 + 0.5f;
|
||||
}
|
||||
|
||||
/* Pango only uses height if ellipsization is enabled, so don't set
|
||||
@ -549,7 +549,7 @@ clutter_text_create_layout (ClutterText *text,
|
||||
priv->ellipsize != PANGO_ELLIPSIZE_NONE &&
|
||||
!priv->single_line_mode)
|
||||
{
|
||||
height = allocation_height * 1024;
|
||||
height = allocation_height * 1024 + 0.5f;
|
||||
}
|
||||
|
||||
/* Search for a cached layout with the same width and keep
|
||||
|
Loading…
Reference in New Issue
Block a user