Fix/text cutoff when scaling#39711
Closed
jcdhlzq wants to merge 2 commits into
Closed
Conversation
…ing for it will be called in super constructor
Base commit: 8e36cc0 |
Contributor
Author
|
This PR fixed npe in #39581 which has been reverted. |
Contributor
Author
|
Hi, @NickGerleman Could you help to review this PR? |
|
@jcdhlzq hi, I have the same problem as you, but I set allowFontScaling to false, and still could not display the numbers completely. what should I do? |
|
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
This PR was closed because it has been stalled for 7 days with no activity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fix Text cut off issues when adjusting text size and font weight in system settings.
Summary:
This pr fixed the problem that can be reproduced with the snack 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.

The problem is produced with setting font scaling in system settings like the image below shows.
This text cut off case can be avoided by setting
allowFontScalingto false. But this pr can make it no matter what valueallowFontScalingis 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.
Test Plan:
The effect after fixed is shown in the image below.