summaryrefslogtreecommitdiff
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorVictoria Lease <violets@google.com>2012-08-17 15:34:01 -0700
committerVictoria Lease <violets@google.com>2012-08-20 13:17:58 -0700
commitdf8ef4b139a8918895f8a5c62536123da06e81fe (patch)
treea2069be0733deb854f9cfcbf13777b4c603c7e0b /core/java/android/widget/TextView.java
parent6fb73ab83f9c1b745ccff4fb92babb429b9215ee (diff)
DO NOT MERGE LocaleSpan makes Han disambiguation easy!
Cherry-pick of I7f1b0d49a2ece957a7b9b5d65d48385bf2c2a668 from master. I've also provided TextView.setTextLocale() for use in single-language TextViews. Change-Id: I5692859bfd2aafc284172454d943afc250b22535
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 5be9899f29bc..f502de450c74 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -2203,6 +2203,27 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
/**
+ * Get the default {@link Locale} of the text in this TextView.
+ * @return the default {@link Locale} of the text in this TextView.
+ */
+ public Locale getTextLocale() {
+ return mTextPaint.getTextLocale();
+ }
+
+ /**
+ * Set the default {@link Locale} of the text in this TextView to the given value. This value
+ * is used to choose appropriate typefaces for ambiguous characters. Typically used for CJK
+ * locales to disambiguate Hanzi/Kanji/Hanja characters.
+ *
+ * @param locale the {@link Locale} for drawing text, must not be null.
+ *
+ * @see Paint#setTextLocale
+ */
+ public void setTextLocale(Locale locale) {
+ mTextPaint.setTextLocale(locale);
+ }
+
+ /**
* @return the size (in pixels) of the default text size in this TextView.
*/
@ViewDebug.ExportedProperty(category = "text")