Skip to content
Snippets Groups Projects
Commit 99bc70c0 authored by Sally Yuen's avatar Sally Yuen Committed by Android (Google) Code Review
Browse files

Merge "[Bold text] Use a default bold font for null typefaces" into main

parents 461a2bd5 b82c54b7
No related branches found
No related tags found
No related merge requests found
......@@ -201,3 +201,13 @@ flag {
purpose: PURPOSE_BUGFIX
}
}
flag {
name: "fix_null_typeface_bolding"
namespace: "text"
description: "Use a bold typeface when bolding is enabled and the original typeface is null"
bug: "314811487"
metadata {
purpose: PURPOSE_BUGFIX
}
}
......@@ -4817,7 +4817,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (mFontWeightAdjustment != 0
&& mFontWeightAdjustment != Configuration.FONT_WEIGHT_ADJUSTMENT_UNDEFINED) {
if (tf == null) {
tf = Typeface.DEFAULT;
if (Flags.fixNullTypefaceBolding()) {
tf = Typeface.DEFAULT_BOLD;
} else {
tf = Typeface.DEFAULT;
}
} else {
int newWeight = Math.min(
Math.max(tf.getWeight() + mFontWeightAdjustment, FontStyle.FONT_WEIGHT_MIN),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment