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
This commit is contained in:
Clara Bayarri
2017-03-22 16:53:44 +00:00
parent 2821eeae97
commit 576ee7de7d

View File

@@ -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);