diff options
author | Eric Fischer <enf@google.com> | 2009-08-17 17:16:44 -0700 |
---|---|---|
committer | Eric Fischer <enf@google.com> | 2009-08-17 17:16:44 -0700 |
commit | 86fcef87b802ee58147127dc5cca940239a30404 (patch) | |
tree | 57e1ffb20759c52fbe5af76aff79d439e44b5acd /core/java/android/text/BoringLayout.java | |
parent | 01f750d6fa03f16ef93802618a6ccf8b353ae8e2 (diff) | |
download | frameworks_base-86fcef87b802ee58147127dc5cca940239a30404.zip frameworks_base-86fcef87b802ee58147127dc5cca940239a30404.tar.gz frameworks_base-86fcef87b802ee58147127dc5cca940239a30404.tar.bz2 |
Don't use BoringLayout to display text that has paragraph-style markup.
BoringLayout assumes it doesn't have to do any work to calculate the
line height. In this case, though, there may actually be work to be
done, so have it fall back to StaticLayout to do the more thorough job.
Bug 2051050
Diffstat (limited to 'core/java/android/text/BoringLayout.java')
-rw-r--r-- | core/java/android/text/BoringLayout.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/text/BoringLayout.java b/core/java/android/text/BoringLayout.java index 843754b..944f735 100644 --- a/core/java/android/text/BoringLayout.java +++ b/core/java/android/text/BoringLayout.java @@ -19,6 +19,7 @@ package android.text; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; +import android.text.style.ParagraphStyle; import android.util.FloatMath; /** @@ -262,6 +263,14 @@ public class BoringLayout extends Layout implements TextUtils.EllipsizeCallback TextUtils.recycle(temp); + if (boring && text instanceof Spanned) { + Spanned sp = (Spanned) text; + Object[] styles = sp.getSpans(0, text.length(), ParagraphStyle.class); + if (styles.length > 0) { + boring = false; + } + } + if (boring) { Metrics fm = metrics; if (fm == null) { |