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
[iOS]App in simplified Chinese. After using the app for a period of time, it may appear that the font is disordered, which may be big or small #36527
Comments
I think this can happen after there is any text contains both chinese and non-chinese charaters(may be non-CJK charaters as well) in the page. |
I got the similar problem when korean displayed. I attached a test project to reproduce it easily. [✓] Flutter (Channel beta, v1.8.3, on Mac OS X 10.14.6 18G87, locale zh-Hans-CN) |
@GaryQian Bro, would you please take a look :) |
@jason-simmons Do you think this could be due to the ambiguous picking order for font fallback bug you recently fixed? |
I don't think it's related to that. This looks like something involving locale-specific glyph lookup. The app switches from the system default locale (screenshot 0) to the "ko" locale (1) to the "zh" locale (2). Skia might select different glyphs for a code point in the device's default locale versus "zh". |
Thanks for reply. I don't think it's a locale problem and I attached a new simple example to prove it. children: <Widget>[
Text(_counter == 0
? '系统消息设置'
: (_counter == 1 ? '알림메시지' : '系统消息设置')),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
], It seems that the widget rendered korean and then the chinese displayed weird in iOS system(include simulator). The example shows as below:
|
Hmm, thanks for trying that out. The characters that are wrongly being displayed are consistent with the korean and japanese usage of those glyphs. They seem to share the same codepoint, so the only thing that would distinguish what is shown is the locale. In absence of a locale, I wonder if there is some sort of assumption system/golbal memory that is guessing the version of the glyph to use based off of context and "remembering" the korean used previously. |
I fix it with the following code :
|
It works. Thanks bro :) |
Thanks for speaking to me about this in person at GDD, I'll try to get on this as soon as I can! |
Possibly related: #40184 It may have to do with changes in the coretext backend. |
A potential workaround/solution to this is to explicitly specify the scriptCode for the supported locales and the locales you are using. In cases where the scriptCode is ambiguous, we can only guess at the proper scripts to use. Specify locales with the Without your actual apps, I cannot verify it fixes your specific cases but if you try this please let me know if it fixes it. |
Also, @dcoinapi What is generating your i18n.dart file? The resolution algorithm in there is rather simple and likely produces worse results than the default local resolution algorithm. This means that your app is possibly stripping useful information such as scriptCode from the locales. |
Have confirmed this repros in an app with no localization setup at all. This bug is completely unrelated to locales. |
So after extracting the fallback font order, I have found that without showing the korean (also happens with other character sets), the fallback font is "PingFang SC" which is correct. However, after displaying Korean, the fallback font list now discovers and places "Apple SD Gothic Neo" ahead of the "PingFang SC". I have verified that force removing this specific font from the fallback order does indeed fix this bug, however that is not a viable fix. Will continue to update with any new developments. |
So "Apple SD Gothic Neo" provides traditional glyphs for a subset of CJK characters: Usage of this font with simplified Chinese is just incompatible as it is the font for Korean. It is not clear yet why this font is being included for fallback ahead of PingFang. |
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 |
Steps to Reproduce
App in simplified Chinese. After using the app for a period of time, it may appear that the font is disordered in each page, which may be big or small. This doesn't happen on android
I build app with flutter 1.5.4-hotfix.2 and 1.7.8-hotfix.3,They all have the same problem.
when font is disordered:
In normal times:
Logs
The text was updated successfully, but these errors were encountered: