Set display density on prepared text layout paint (#59213)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/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
This commit is contained in:
Peter Abbondanzo authored and meta-codesync[bot] committed 2026-10-20 14:27:12 -07:00
1 parent 79adf3498f
commit 6f6fa0ad9f
1 file changed
+1
@@ -1107,6 +1107,7 @@ internal object TextLayoutManager {
fontWeightAdjustment: Int,
): TextPaint {
val paint = TextPaint(TextPaint.ANTI_ALIAS_FLAG)
paint.density = DisplayMetricsHolder.getScreenDisplayMetrics().density
updateTextPaint(paint, baseTextAttributes, assets, fontWeightAdjustment)
return paint
}