From a9f1dd021f8f6ee777bc4d27913bd40c42e753af Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 12 Aug 2009 15:00:10 -0700 Subject: Make and in string resources respect density. This unfortunately requires API changes because the existing text markup classes had no access to the screen density. TextPaint gains a "density" field so that TextView can pass the density along. AbsoluteSizeSpan gains a new flag to indicate that its argument is in dip instead of in physical pixels. LineHeightSpan gains an inner interface whose chooseHeight() method includes a TextPaint argument so it can get at the density. And when StringBlock creates the markup objects, it now uses the density-aware versions. Bug 1976971, Bug 2031746 --- core/java/android/text/TextPaint.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/java/android/text/TextPaint.java') diff --git a/core/java/android/text/TextPaint.java b/core/java/android/text/TextPaint.java index f13820d3a885..f9e7cac6c505 100644 --- a/core/java/android/text/TextPaint.java +++ b/core/java/android/text/TextPaint.java @@ -27,6 +27,7 @@ public class TextPaint extends Paint { public int baselineShift; public int linkColor; public int[] drawableState; + public float density = 1.0f; public TextPaint() { super(); @@ -51,5 +52,6 @@ public class TextPaint extends Paint { baselineShift = tp.baselineShift; linkColor = tp.linkColor; drawableState = tp.drawableState; + density = tp.density; } } -- cgit v1.2.3