From f483e514d4ed3b93cc5ba22beb9c85efcda75535 Mon Sep 17 00:00:00 2001 From: Gilles Debunne Date: Thu, 28 Apr 2011 15:08:54 -0700 Subject: TextView's baseline is correctly computed for empty text. Bug http://code.google.com/p/android/issues/detail?id=15598 Change-Id: I3aae29b55dc92acca3883b8d14e01dc1c79c2243 --- core/java/android/text/TextLine.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core/java/android/text/TextLine.java') diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java index 1b7f2f310c9f..0f8097a948a6 100644 --- a/core/java/android/text/TextLine.java +++ b/core/java/android/text/TextLine.java @@ -815,6 +815,13 @@ class TextLine { int limit, boolean runIsRtl, Canvas c, float x, int top, int y, int bottom, FontMetricsInt fmi, boolean needWidth) { + // Case of an empty line, make sure we update fmi according to mPaint + if (start == measureLimit) { + TextPaint wp = mWorkPaint; + wp.set(mPaint); + return handleText(wp, 0, 0, 0, 0, runIsRtl, c, x, top, y, bottom, fmi, needWidth); + } + // Shaping needs to take into account context up to metric boundaries, // but rendering needs to take into account character style boundaries. // So we iterate through metric runs to get metric bounds, -- cgit v1.2.3