Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Text cut off issues when adjusting text size and font weight in …
…system settings (#39581) Summary: Fix Text cut off issues when adjusting text size and font weight in system settings. This pr fixed the problem that can be reproduced with the [snack](https://snack.expo.dev/fl5DSrLBJ) on Xiaomi devices with MIUI13 and MIUI14. The problem is shown as the image below: the number "999" is cut off and only "99" is rendered. <img src="https://github.com/facebook/react-native/assets/23273745/64269ced-4060-4ab5-8233-8199e4f2acbd" width="20%" height="20%" alt="text-cutoff-when-scaling-miui14" /> The problem is produced with setting font scaling in system settings like the image below shows. <img src="https://github.com/facebook/react-native/assets/23273745/c31d1bf2-d038-4536-b1a4-509050f2aa7c" width="20%" height="20%" alt="settings" /> This text cut off case can be avoided by setting [`allowFontScaling`](https://reactnative.cn/docs/text#allowfontscaling) to false. But this pr can make it no matter what value `allowFontScaling` is set. The root cause of this case, according to MIUI developers, is that Misans typeface, as a variable font which will adjust the weight of different font axes with different font size, gets different widths when Text is measured and drawn for a bug in the framework of MIUI rom. They will fix this bug in next version while this pr fixed it in old versions. ## Changelog: [ANDROID][FIXED]-Fix Text cut off issues when adjusting text size and font weight in system settings. <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: #39581 Test Plan: The effect after fixed is shown in the image below. <img src="https://github.com/facebook/react-native/assets/23273745/1f93f47f-5cdf-4ee1-934a-6cb3b04309ea" width="20%" height="20%" alt="fixed" /> Reviewed By: NickGerleman Differential Revision: D49509633 Pulled By: ryancat fbshipit-source-id: fd93f14bdbced8026a45dc9e0299465962433de5
- Loading branch information