Skip to content

Fix Android adjustsFontSizeToFit shrinking text that fits#56815

Open
danyalahmed1995 wants to merge 1 commit into
facebook:mainfrom
danyalahmed1995:fix/issue-56799-android-adjusts-font-size-rounding
Open

Fix Android adjustsFontSizeToFit shrinking text that fits#56815
danyalahmed1995 wants to merge 1 commit into
facebook:mainfrom
danyalahmed1995:fix/issue-56799-android-adjusts-font-size-rounding

Conversation

@danyalahmed1995
Copy link
Copy Markdown

@danyalahmed1995 danyalahmed1995 commented May 13, 2026

Summary

Fixes an Android Text regression where adjustsFontSizeToFit={true} could shrink text even when the original size already fits.

The Android font-size fitting path now performs an initial layout check before entering the binary-search resize loop. If the original layout already satisfies the same max-lines, height, and single-character-width constraints used by the fitting logic, it returns without mutating TextPaint or ReactAbsoluteSizeSpan values.

Fixes #56799.

Test Plan

  • Added a focused Robolectric test covering the no-resize case for adjustsFontSizeToFit.
  • Verified that ReactAbsoluteSizeSpan(22) and TextPaint.textSize = 22f remain unchanged when the text has enough space and no max-line pressure.
  • Ran the focused Android text layout test successfully.

Changelog:

[Android] [Fixed] - Prevent adjustsFontSizeToFit from shrinking text when the original Android Text layout already fits.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 13, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Using adjustsFontSizeToFit=true sometimes causes font size to be too small.

1 participant