From 576ee7de7d169e637439e992a5e9d92ea5829989 Mon Sep 17 00:00:00 2001 From: Clara Bayarri Date: Wed, 22 Mar 2017 16:53:44 +0000 Subject: [PATCH] Fix textStyle being ignored for Font resources in TextView When a font resource is set via fontFamily, the textStyle attribute was being ignored. Bug: 36505747 Test: cts attached in topic Change-Id: I6418297d9a289460a3b36c6883441ac48ea33b22 --- core/java/android/widget/TextView.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index f2a7f25decc15..cae086ac8adfc 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -2031,6 +2031,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener Typeface tf = fontTypeface; if (tf == null && familyName != null) { tf = Typeface.create(familyName, styleIndex); + } else if (tf != null && tf.getStyle() != styleIndex) { + tf = Typeface.create(tf, styleIndex); } if (tf != null) { setTypeface(tf);