mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Explicity reset typeface in updateTextPaint (#47097)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47097 Calling Paint.reset() doesn't reset the active type face (https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/libs/hwui/hwui/PaintImpl.cpp;l=86), which causes measurements bugs for Text which don't specify a font to be incorrect. Changelog: [Android][Fixed] Text without explicit font styles was potentially cut-off. Reviewed By: NickGerleman Differential Revision: D64535719 fbshipit-source-id: d300c26bf828a0e2e4b170254f9be5f409aff2dc
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0a2dec175e
commit
95a5d1c628
+4
-1
@@ -432,10 +432,11 @@ public class TextLayoutManager {
|
||||
private static void updateTextPaint(
|
||||
TextPaint paint, TextAttributeProps baseTextAttributes, Context context) {
|
||||
// TextPaint attributes will be used for content outside the Spannable, like for the
|
||||
// hypothetical height of a new line after a trailing newline charater (considered part of the
|
||||
// hypothetical height of a new line after a trailing newline character (considered part of the
|
||||
// previous line).
|
||||
paint.reset();
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
if (baseTextAttributes.getEffectiveFontSize() != ReactConstants.UNSET) {
|
||||
paint.setTextSize(baseTextAttributes.getEffectiveFontSize());
|
||||
}
|
||||
@@ -459,6 +460,8 @@ public class TextLayoutManager {
|
||||
paint.setFakeBoldText((missingStyle & Typeface.BOLD) != 0);
|
||||
paint.setTextSkewX((missingStyle & Typeface.ITALIC) != 0 ? -0.25f : 0);
|
||||
}
|
||||
} else {
|
||||
paint.setTypeface(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user