OSDN Git Service

Fix for positioning of glyphs within a bitmap
authorAlexander Toresson <alexander.toresson@sonymobile.com>
Wed, 28 Aug 2013 14:13:06 +0000 (16:13 +0200)
committerJohan Redestig <johan.redestig@sonymobile.com>
Thu, 23 Jan 2014 12:31:15 +0000 (13:31 +0100)
commit3ed192760314dc976cd02f62ac49798daa89b4b1
treed1c1e5797f4dad52e2369afe6a27b3033609747e
parentc9a60b0f77525244ac4f970258703b8dc62ee140
Fix for positioning of glyphs within a bitmap

For positioning of glyphs within a bitmap, roundf(int + float) is used,
where the float is the glyph position and the int is the text position.
When the text position is varied, this may lead to the sum being rounded
in different directions, due to floating point rounding, caused by that
floating point numbers have different precision in different ranges.

This may therefore lead to slightly different positioning for glyphs and
therefore slightly different widths and heights for text strings,
depending on the position they are rendered at.

The solution in this patch is to use int + (int) roundf(float), which
has consistent rounding, and also enables us to use the full range of
ints.

Change-Id: Id1143cdfcbdfa9915ced878ae04df589a3e03cee
libs/hwui/font/Font.cpp