Skip to content

Commit 6f6fa0a

Browse files
Abbondanzometa-codesync[bot]
authored andcommitted
Set display density on prepared text layout paint (#59213)
Summary: Pull Request resolved: #59213 When prepared text layout is enabled, PreparedLayoutTextView draws the cached Layout directly. That Layout is built with a fresh TextPaint that never received the display density, so custom decoration drawing that scales with paint.density rendered wrong: the DOUBLE underline/linethrough gap (thickness + 2dp) collapsed to zero and the two strokes merged into one solid band. Changelog: [Android][Fixed] - Fix double text decorations rendering as a solid band when prepared text layout is enabled Reviewed By: christophpurrer Differential Revision: D126198343 fbshipit-source-id: 240f3c79fbef2c08995533104c56d345c8b51155
1 parent 79adf34 commit 6f6fa0a

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,7 @@ internal object TextLayoutManager {
11071107
fontWeightAdjustment: Int,
11081108
): TextPaint {
11091109
val paint = TextPaint(TextPaint.ANTI_ALIAS_FLAG)
1110+
paint.density = DisplayMetricsHolder.getScreenDisplayMetrics().density
11101111
updateTextPaint(paint, baseTextAttributes, assets, fontWeightAdjustment)
11111112
return paint
11121113
}

0 commit comments

Comments
 (0)