diff options
author | Eric Fischer <enf@google.com> | 2009-08-12 15:00:10 -0700 |
---|---|---|
committer | Eric Fischer <enf@google.com> | 2009-08-12 16:04:10 -0700 |
commit | a9f1dd021f8f6ee777bc4d27913bd40c42e753af (patch) | |
tree | da094eda66b853fbf4106f8ee76b2f681ee84cc5 /core/java/android/widget | |
parent | c71c35d69f0a829df1c3d027815547932cc25337 (diff) | |
download | frameworks_base-a9f1dd021f8f6ee777bc4d27913bd40c42e753af.zip frameworks_base-a9f1dd021f8f6ee777bc4d27913bd40c42e753af.tar.gz frameworks_base-a9f1dd021f8f6ee777bc4d27913bd40c42e753af.tar.bz2 |
Make <font size> and <font height> 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
Diffstat (limited to 'core/java/android/widget')
-rw-r--r-- | core/java/android/widget/TextView.java | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 591f9bb..e0a268e 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -327,6 +327,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mText = ""; mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + mTextPaint.density = getResources().getDisplayMetrics().density; // If we get the paint from the skin, we should set it to left, since // the layout always wants it to be left. // mTextPaint.setTextAlign(Paint.Align.LEFT); |