-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Simplified Chinese characters with background do not display properly in RichText. #24337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Please add the output of |
|
I can reproduce this on a Nexus 5X. It happens with both GL and software rendering back ends. The glyphs render as expected if I remove the Interestingly, this bug seems to be sensitive to text size and placement of the text blobs within a line. On the Nexus 5X, if I set the parent TextStyle's fontSize to 80.0, then all the glyphs will render on top of the background as expected. I suspect this is happening somewhere within Skia. |
Could be related to #24234? |
Thanks a lot. It is true that using multiple language styles will cause this problem. But I can't understand why when I set the background color with opacity, the characters will be seen? |
Is there any workaround for this? this blocking my app to be released. This is not just an issue with Chinese, it's also a problem with any unicode characters (in my case, it's Korean). |
When the span is broken into multiple runs (due to language/font differences), we iterate through each run and paint in the order of:
I suspect that the background for the chinese is painting, then we paint the text, however, when painting the 1111, the background is painting again, covering the chinese. I will experiment with the painting order, and see if I can figure out what is happening. |
So the real bug here seems to be that the background width covers the entire span instead of just the run it is corresponding to. This is causing the widths to "overdraw" onto neighboring runs. |
flutter/engine#7287 This should fix the background overlapping with the text, causing it to become invisible behind it. The strange translucency behavior requires a more in-depth metrics revision to properly draw them. |
I would expect the parent TextSpan to paint behind the child TextSpan (even if both have a background). |
(and I would expect the backgrounds to paint in pre-order depth-first) |
Yes, this should happen now with the PR above, it was not the case before. For example, the current order is for two runs: run1bg, run1text, run2bg, run2text |
Reopening as there is still the background misalignment part of this bug to fix. The width of the background should span the beginning of the run to the end of the run, but it is the beginning of the line to the end of the run instead. When more than one run makes up the line, then the backgrounds will draw over each other. Another behavior that this causes is for multi-run lines, translucent backgrounds will be darker the more runs there are in the line. |
@yumi0629 @ozexpert @jason-simmons @zoechi hi guy, there is a workaround for this issue , see does it help for you. |
…ccurate rendering of text decorations Fixes flutter/flutter#30041 Fixes flutter/flutter#24337
…ccurate rendering of text decorations (#8368) Fixes flutter/flutter#30041 Fixes flutter/flutter#24337
…ccurate rendering of text decorations (flutter#8368) Fixes flutter/flutter#30041 Fixes flutter/flutter#24337
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
I want to add a background to text, here is my code:
But the Simplified Chinese words do not display:

If I set the background color with opacity, it seems well:
But it still doesn't meet my expectation:
I have added app locales supports like this:
Still doesn't work.
The text was updated successfully, but these errors were encountered: