Skip to content

Fix missing height constraints when creating Fabric layout for adjustsFontSizeToFit#51550

Closed
NickGerleman wants to merge 1 commit into
facebook:mainfrom
NickGerleman:export-D75251391
Closed

Fix missing height constraints when creating Fabric layout for adjustsFontSizeToFit#51550
NickGerleman wants to merge 1 commit into
facebook:mainfrom
NickGerleman:export-D75251391

Conversation

@NickGerleman
Copy link
Copy Markdown
Contributor

Summary:
adjustsFontSizeToFit will adjust font size so that given text fits in both veritcal and horizontal bounds. The algorithm to mutate text to fit is executed during TextLayoutManager during layout creation for Fabric, and then re-executed in TextView.onDraw(). See D56134348 which introduced the logic.

In Facsimile, we were not seeing font size adjusted when text is too tall. This is because we are only incorporating the height constraint during Spannable mutation during draw, but not the original layout, which Facsimile uses directly.

This could potentially fix other bugs, where width may not corredpond to the final font size we settle on during drawing.

Changelog:
[Android][Fixed] - Fix missing height constraints when creating Fabric layout for adjustsFontSizeToFit

Reviewed By: mdvacca

Differential Revision: D75251391

…tsFontSizeToFit`

Summary:
`adjustsFontSizeToFit` will adjust font size so that given text fits in both veritcal and horizontal bounds. The algorithm to mutate text to fit is executed during TextLayoutManager during layout creation for Fabric, and then re-executed in `TextView.onDraw()`. See D56134348 which introduced the logic.

In Facsimile, we were not seeing font size adjusted when text is too tall. This is because we are only incorporating the height constraint during Spannable mutation during draw, but not the original layout, which Facsimile uses directly.

This could potentially fix other bugs, where width may not corredpond to the final font size we settle on during drawing.

Changelog:
[Android][Fixed] - Fix missing height constraints when creating Fabric layout for `adjustsFontSizeToFit`

Reviewed By: mdvacca

Differential Revision: D75251391
@facebook-github-bot facebook-github-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 22, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D75251391

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in b70c73d.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @NickGerleman in b70c73d

When will my fix make it into a release? | How to file a pick request?

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. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants