diff options
author | Raph Levien <raph@google.com> | 2014-08-11 14:26:37 -0700 |
---|---|---|
committer | Raph Levien <raph@google.com> | 2014-08-11 14:26:37 -0700 |
commit | ff86bcd08827d1050a8cfd99b521c21848b3f364 (patch) | |
tree | 8f9d195abc77dd407f3eb197044b09834310aa8b /graphics | |
parent | 1584609f422c338ade65b8b4078b434ba3a81253 (diff) | |
download | frameworks_base-ff86bcd08827d1050a8cfd99b521c21848b3f364.zip frameworks_base-ff86bcd08827d1050a8cfd99b521c21848b3f364.tar.gz frameworks_base-ff86bcd08827d1050a8cfd99b521c21848b3f364.tar.bz2 |
Resolve invalid Typeface style to default
Setting a textAppearance that specified a fontFamily but not a textStyle
results in a styleIndex of -1 being passed to the Typeface.create()
call. This patch resolves such invalid style indices to the default.
Fix for bug 16880318 "Applying TextAppearance To TextView with custom
font family incorrectly adds italics style on LMP"
Change-Id: I05c9cfc4d76161be21b58abdb4037c51a23cae37
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Typeface.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java index 0dc903a..06586ca 100644 --- a/graphics/java/android/graphics/Typeface.java +++ b/graphics/java/android/graphics/Typeface.java @@ -132,6 +132,9 @@ public class Typeface { * @return The best matching typeface. */ public static Typeface create(Typeface family, int style) { + if (style < 0 || style > 3) { + style = 0; + } long ni = 0; if (family != null) { // Return early if we're asked for the same face/style |