From b26fa0ce68d3311b2fdffb930b27d897e481dd5a Mon Sep 17 00:00:00 2001 From: Victoria Lease Date: Fri, 8 Jun 2012 10:25:19 -0700 Subject: Fix fake bold for fallback fonts in frameworks. This change is analogous to Ic0e9f1bbd8cae9fdd3a6d1d015bb9224c8be545c in WebView, and depends upon the same Skia change that that CL makes use of. This flips the "fake bold" flag on for bold fonts in TextView.setTypeface(), with the expectation that Skia will ignore the flag if the final typeface used to render the glyphs is already bold. It also does the same for StyleSpans, TextAppearanceSpans, TypefaceSpans, and the Switch widget. With this, fake bold should work uniformly across all scripts - if fake bold works for a primary typeface, it should also work for all fallback typefaces. Bug: 6629786 Change-Id: Id3b8639ab0df83052ffd82809cb12adaacc1d46b --- core/java/android/widget/Switch.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/java/android/widget/Switch.java') diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index 471f259cc954..39bc7c2fc1f3 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -259,10 +259,12 @@ public class Switch extends CompoundButton { // now compute what (if any) algorithmic styling is needed int typefaceStyle = tf != null ? tf.getStyle() : 0; int need = style & ~typefaceStyle; + need |= typefaceStyle & Typeface.BOLD; mTextPaint.setFakeBoldText((need & Typeface.BOLD) != 0); mTextPaint.setTextSkewX((need & Typeface.ITALIC) != 0 ? -0.25f : 0); } else { - mTextPaint.setFakeBoldText(false); + int typefaceStyle = tf != null ? tf.getStyle() : 0; + mTextPaint.setFakeBoldText((typefaceStyle & Typeface.BOLD) != 0); mTextPaint.setTextSkewX(0); setSwitchTypeface(tf); } -- cgit v1.2.3