OSDN Git Service

round subpixels up to next integer in measureText DO NOT MERGE
authorVictoria Lease <violets@google.com>
Tue, 26 Feb 2013 19:18:42 +0000 (11:18 -0800)
committerVictoria Lease <violets@google.com>
Wed, 27 Feb 2013 19:38:05 +0000 (11:38 -0800)
commit8e04840f38a16f806754dfca3de50c2548e67913
treefefcc9d799d1ec07c49a96ecc7edc115613435c7
parent0493d7997e22376524d707e407662d0f98f40c47
round subpixels up to next integer in measureText DO NOT MERGE

A common source of layout bugs we're seeing these days involves the
output of measureText() being fed into StaticLayout's constructor.
measureText() returns subpixel-accurate values, but StaticLayout only
takes integral bounds, resulting in the subpixel portion of the
bounds being truncated. This leaves StaticLayout with insufficient
space to layout the text that was just measured, causing all manner
of unexpected line breaks.

This could be causing issues elsewhere, as well. Until our text
pipeline is fully subpixel-perfect, it's best that measureText
guarantee that the value it returns will be sufficient to contain
the text, even if cast to int.

Cherry-pick of Ib84947f0d0a1229287f5b19b99e7efd40f5317f7

Bug: 8164205
Change-Id: I69795ba5770112c0a3d0e752158076a8d1646b1a
graphics/java/android/graphics/Paint.java