Skip to content
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

Closed
jayden320 opened this issue Jul 19, 2019 · 17 comments · Fixed by flutter/engine#12426
Labels
a: fidelity Matching the OEM platforms better a: typography Text rendering, possibly libtxt framework flutter/packages/flutter repository. See also f: labels.

Comments

@jayden320
Copy link

jayden320 commented Jul 19, 2019

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:
image

In normal times:
IMG_2440

Logs


[  +44 ms] executing: [/Users/suteki/Flutter/flutter/] git log -n 1 --pretty=format:%H
[  +51 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[        ] 7a4c33425ddd78c54aba07d86f3f9a4a0051769b
[        ] executing: [/Users/suteki/Flutter/flutter/] git describe --match v*.*.* --first-parent --long --tags
[  +27 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v1.5.4-hotfix.2-0-g7a4c33425
[  +13 ms] executing: [/Users/suteki/Flutter/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +11 ms] Exit code 128 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] fatal: HEAD does not point to a branch
[  +12 ms] executing: [/Users/suteki/Flutter/flutter/] git rev-parse --abbrev-ref HEAD
[  +14 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] HEAD
[ +262 ms] executing: /Users/suteki/Library/Android/sdk/platform-tools/adb devices -l
[  +12 ms] Exit code 0 from: /Users/suteki/Library/Android/sdk/platform-tools/adb devices -l
[        ] List of devices attached
[  +11 ms] executing: idevice_id -h
[  +51 ms] /usr/bin/xcrun simctl list --json devices
[ +310 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +5 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FuchsiaCacheArtifacts' is not required, skipping update.
[ +115 ms] Found plugin battery at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/battery-0.2.3/
[  +34 ms] Found plugin city_pickers at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/city_pickers-0.1.22/
[  +14 ms] Found plugin device_info at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/device_info-0.4.0+2/
[   +5 ms] Found plugin fake_analytics at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_analytics-0.2.3/
[   +3 ms] Found plugin fake_notch at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_notch-0.0.2+5/
[   +3 ms] Found plugin fake_path_provider at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_path_provider-0.1.0/
[   +1 ms] Found plugin fake_tencent at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_tencent-0.3.3/
[   +2 ms] Found plugin fake_wechat at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_wechat-0.3.2/
[   +2 ms] Found plugin fake_weibo at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_weibo-0.2.2/
[   +6 ms] Found plugin flutter_baidu_tts_plugin at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_baidu_tts_plugin-55acc17bb945d8535863e2ea7e4f0031469a4b3c/
[   +5 ms] Found plugin flutter_deeplink at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_deeplink-8fb13724e5095e2c922e8868840529c7ce9f0fe2/
[   +3 ms] Found plugin flutter_mix_push at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_mix_push-964c90e815bb0e207f3256e6736246ec860f86db/
[   +3 ms] Found plugin flutter_statusbar_manager at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_statusbar_manager-b33a851e5627901560869f9ed6a2895f3dd5f9a3/
[   +3 ms] Found plugin flutter_umpush at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_umpush_plugin-0d08cd9f87cdf717b909870a2f1d8400e8a08aee/
[   +1 ms] Found plugin flutter_user_agent at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_user_agent-1.0.1/
[   +1 ms] Found plugin flutter_webview_plugin at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_webview_plugin-23b0dd8585d35f31887af2acacc5437a4812b7ed/
[   +3 ms] Found plugin fluttertoast at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.0/
[  +10 ms] Found plugin image_cropper at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/image_cropper-1.0.2/
[   +1 ms] Found plugin image_picker at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.0+17/
[   +1 ms] Found plugin image_picker_saver at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/image_picker_saver-0.3.0/
[   +1 ms] Found plugin in_app_purchase at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/in_app_purchase-0.1.1+2/
[  +12 ms] Found plugin mob_ads_pangolin at /Users/suteki/Flutter/flutter/.pub-cache/git/mob_ads_pangolin-057efd8f8a5c99dafc60ef0b9621c4dd702051e6/
[   +2 ms] Found plugin package_info at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/package_info-0.4.0+5/
[   +2 ms] Found plugin path_provider at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-0.5.0+1/
[   +2 ms] Found plugin permission_handler at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/permission_handler-3.2.0/
[  +11 ms] Found plugin screen at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/screen-0.0.5/
[   +1 ms] Found plugin share at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.2/
[   +1 ms] Found plugin shared_preferences at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.4.3/
[   +6 ms] Found plugin sqflite at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.1.6+1/
[   +9 ms] Found plugin tobias at /Users/suteki/Flutter/flutter/.pub-cache/git/tobias-578ba153d681dfa099d1f0ded6d85ec325eaa070/
[   +1 ms] Found plugin url_launcher at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.1.0/
[  +29 ms] Found plugin battery at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/battery-0.2.3/
[   +8 ms] Found plugin city_pickers at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/city_pickers-0.1.22/
[   +3 ms] Found plugin device_info at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/device_info-0.4.0+2/
[   +1 ms] Found plugin fake_analytics at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_analytics-0.2.3/
[   +1 ms] Found plugin fake_notch at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_notch-0.0.2+5/
[        ] Found plugin fake_path_provider at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_path_provider-0.1.0/
[        ] Found plugin fake_tencent at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_tencent-0.3.3/
[        ] Found plugin fake_wechat at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_wechat-0.3.2/
[        ] Found plugin fake_weibo at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fake_weibo-0.2.2/
[   +1 ms] Found plugin flutter_baidu_tts_plugin at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_baidu_tts_plugin-55acc17bb945d8535863e2ea7e4f0031469a4b3c/
[   +1 ms] Found plugin flutter_deeplink at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_deeplink-8fb13724e5095e2c922e8868840529c7ce9f0fe2/
[   +1 ms] Found plugin flutter_mix_push at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_mix_push-964c90e815bb0e207f3256e6736246ec860f86db/
[   +1 ms] Found plugin flutter_statusbar_manager at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_statusbar_manager-b33a851e5627901560869f9ed6a2895f3dd5f9a3/
[   +2 ms] Found plugin flutter_umpush at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_umpush_plugin-0d08cd9f87cdf717b909870a2f1d8400e8a08aee/
[   +1 ms] Found plugin flutter_user_agent at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_user_agent-1.0.1/
[        ] Found plugin flutter_webview_plugin at /Users/suteki/Flutter/flutter/.pub-cache/git/flutter_webview_plugin-23b0dd8585d35f31887af2acacc5437a4812b7ed/
[        ] Found plugin fluttertoast at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.0/
[   +4 ms] Found plugin image_cropper at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/image_cropper-1.0.2/
[        ] Found plugin image_picker at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.0+17/
[        ] Found plugin image_picker_saver at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/image_picker_saver-0.3.0/
[        ] Found plugin in_app_purchase at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/in_app_purchase-0.1.1+2/
[   +5 ms] Found plugin mob_ads_pangolin at /Users/suteki/Flutter/flutter/.pub-cache/git/mob_ads_pangolin-057efd8f8a5c99dafc60ef0b9621c4dd702051e6/
[        ] Found plugin package_info at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/package_info-0.4.0+5/
[   +1 ms] Found plugin path_provider at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-0.5.0+1/
[   +1 ms] Found plugin permission_handler at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/permission_handler-3.2.0/
[   +5 ms] Found plugin screen at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/screen-0.0.5/
[        ] Found plugin share at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.2/
[        ] Found plugin shared_preferences at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.4.3/
[   +5 ms] Found plugin sqflite at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.1.6+1/
[   +6 ms] Found plugin tobias at /Users/suteki/Flutter/flutter/.pub-cache/git/tobias-578ba153d681dfa099d1f0ded6d85ec325eaa070/
[   +1 ms] Found plugin url_launcher at /Users/suteki/Flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.1.0/
[  +92 ms] Launching lib/main.dart on iPhone 8 in debug mode...
[   +7 ms] executing: /usr/bin/defaults read /Users/suteki/Desktop/FNovel/ios/Runner/Info CFBundleIdentifier
[ +107 ms] Exit code 0 from: /usr/bin/defaults read /Users/suteki/Desktop/FNovel/ios/Runner/Info CFBundleIdentifier
[        ] $(PRODUCT_BUNDLE_IDENTIFIER)
[  +23 ms] Building Runner.app for 9E67BBF4-5B1A-468B-A450-9616F073E064.
[   +7 ms] executing: script /dev/null /usr/bin/log stream --style syslog --predicate processImagePath CONTAINS "9E67BBF4-5B1A-468B-A450-9616F073E064"
[  +42 ms] [DEVICE LOG] Filtering the log data using "processImagePath CONTAINS "9E67BBF4-5B1A-468B-A450-9616F073E064""
[ +461 ms] Skipping kernel compilation. Fingerprint match.
[+1377 ms] Building bundle
[   +1 ms] Writing asset files to build/flutter_assets
[ +246 ms] "flutter run" took 3,398ms.
[        ] "flutter run" took 3,398ms.


   info • Unused import: 'package:fnovel/pages/share_paragraph/share_paragraph_page.dart' • lib/app/app_navigator.dart:8:8 • unused_import
   info • This function has a return type of 'Type', but doesn't end with a return statement • lib/app/constant.dart:13:10 • missing_return
   info • Unused import: 'dart:io' • lib/app/tab_page.dart:1:8 • unused_import
   info • The value of the local variable 'userMgr' isn't used • lib/pages/coupon/coupon_unavailable_list_view.dart:74:9 • unused_local_variable
   info • Unused import: 'package:fnovel/pages/reader/utility/reader_database.dart' • lib/pages/download/downloaded_cell.dart:2:8 • unused_import
   info • Unused import: 'package:flutter/material.dart' • lib/pages/feedback_create/feedback_create_model.dart:4:8 • unused_import
   info • Unused import: 'package:fnovel/pages/forum_member/forum_member_page.dart' • lib/pages/forum/forum_fan_cell.dart:6:8 • unused_import
   info • Unused import: 'package:fnovel/utility/novel_cache_manager.dart' • lib/pages/forum_info/forum_info_publish_comment_cell.dart:3:8 • unused_import
   info • Unused import: 'package:cached_network_image/cached_network_image.dart' • lib/pages/forum_info/forum_info_publish_comment_cell.dart:5:8 • unused_import
   info • This function has a return type of 'Member', but doesn't end with a return statement • lib/pages/forum_info/forum_info_publish_comment_cell.dart:50:3 •
          missing_return
   info • Unused import: 'package:intl/intl.dart' • lib/pages/forum_info/forum_info_publish_view.dart:3:8 • unused_import
   info • Unused import: 'package:fnovel/utility/novel_cache_manager.dart' • lib/pages/forum_info/forum_info_receive_comment_cell.dart:3:8 • unused_import
   info • Unused import: 'package:cached_network_image/cached_network_image.dart' • lib/pages/forum_info/forum_info_receive_comment_cell.dart:5:8 • unused_import
   info • This function has a return type of 'Member', but doesn't end with a return statement • lib/pages/forum_info/forum_info_receive_comment_cell.dart:80:3 •
          missing_return
   info • The method '_buildImages' isn't used • lib/pages/forum_member/forum_member_post_cell.dart:48:16 • unused_element
   info • The method '_buildContent' isn't used • lib/pages/forum_member/forum_member_post_cell.dart:91:3 • unused_element
   info • `Future` results in `async` function bodies must be `await`ed or marked `unawaited` using `package:pedantic` •
          lib/pages/forum_post_detail/forum_post_detail_page.dart:116:7 • unawaited_futures
   info • `Future` results in `async` function bodies must be `await`ed or marked `unawaited` using `package:pedantic` •
          lib/pages/forum_post_detail/forum_post_detail_page.dart:129:7 • unawaited_futures
   info • `Future` results in `async` function bodies must be `await`ed or marked `unawaited` using `package:pedantic` •
          lib/pages/forum_post_detail/forum_post_extend_menu.dart:16:5 • unawaited_futures
   info • Unused import: 'package:fnovel/pages/forum_member/forum_member_page.dart' • lib/pages/forum_post_detail/forum_reply_view.dart:4:8 • unused_import

20 issues found. (ran in 8.3s)
[✓] Flutter (Channel unknown, v1.5.4-hotfix.2, on Mac OS X 10.14.4 18E226, locale zh-Hans-CN)
    • Flutter version 1.5.4-hotfix.2 at /Users/suteki/Flutter/flutter
    • Framework revision 7a4c33425d (3 months ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

 
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/suteki/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/suteki/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.7.4

[!] Android Studio (version 3.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] VS Code (version 1.36.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.2.0

[✓] Connected device (1 available)
    • iPhone 8 • 9E67BBF4-5B1A-468B-A450-9616F073E064 • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

! Doctor found issues in 2 categories.
@kelvinluo1112
Copy link

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.
Try to merge your theme's text style with TextStyle(fontFamilyFallback: ["PingFang SC", "Heiti SC"]) in iOS platform.

@jmagman jmagman added a: fidelity Matching the OEM platforms better framework flutter/packages/flutter repository. See also f: labels. labels Aug 17, 2019
@dcoinapi
Copy link

I got the similar problem when korean displayed. I attached a test project to reproduce it easily.
image
image
image
flutter_app.zip

[✓] Flutter (Channel beta, v1.8.3, on Mac OS X 10.14.6 18G87, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Android Studio (version 3.4)
[✓] VS Code (version 1.36.1)
[✓] Connected device (1 available)

@dcoinapi
Copy link

@GaryQian Bro, would you please take a look :)

@GaryQian
Copy link
Contributor

@jason-simmons Do you think this could be due to the ambiguous picking order for font fallback bug you recently fixed?

@jason-simmons
Copy link
Member

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".

@dcoinapi
Copy link

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:

  1. first time, '系统消息设置' displayed normal
  2. click the plus icon and korean '알림메시지' displayed
  3. click the plus icon again, it displayed '系统消息设置' which is abnormal
    flutter_app.zip

@GaryQian
Copy link
Contributor

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.

@CarGuo
Copy link

CarGuo commented Aug 29, 2019

I fix it with the following code :

   var themeData = ThemeData(
        primarySwatch: primarySwatch,);

   var result = themeData.copyWith(
      textTheme: themeData.textTheme.copyWith(
        display4: themeData.textTheme.display4
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        display3: themeData.textTheme.display3
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        display2: themeData.textTheme.display2
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        display1: themeData.textTheme.display1
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        headline: themeData.textTheme.headline
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        title: themeData.textTheme.title
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        subhead: themeData.textTheme.subhead
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        body2: themeData.textTheme.body2
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        body1: themeData.textTheme.body1
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        caption: themeData.textTheme.caption
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        button: themeData.textTheme.button
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        subtitle: themeData.textTheme.subtitle
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        overline: themeData.textTheme.overline
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
      ),
      accentTextTheme: themeData.accentTextTheme.copyWith(
        display4: themeData.accentTextTheme.display4
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        display3: themeData.accentTextTheme.display3
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        display2: themeData.accentTextTheme.display2
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        display1: themeData.accentTextTheme.display1
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        headline: themeData.accentTextTheme.headline
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        title: themeData.accentTextTheme.title
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        subhead: themeData.accentTextTheme.subhead
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        body2: themeData.accentTextTheme.body2
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        body1: themeData.accentTextTheme.body1
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        caption: themeData.accentTextTheme.caption
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        button: themeData.accentTextTheme.button
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        subtitle: themeData.accentTextTheme.subtitle
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        overline: themeData.accentTextTheme.overline
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
      ),
      primaryTextTheme: themeData.primaryTextTheme.copyWith(
        display4: themeData.primaryTextTheme.display4
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        display3: themeData.primaryTextTheme.display3
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        display2: themeData.primaryTextTheme.display2
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        display1: themeData.primaryTextTheme.display1
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        headline: themeData.primaryTextTheme.headline
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        title: themeData.primaryTextTheme.title
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        subhead: themeData.primaryTextTheme.subhead
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        body2: themeData.primaryTextTheme.body2
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        body1: themeData.primaryTextTheme.body1
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        caption: themeData.primaryTextTheme.caption
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        button: themeData.primaryTextTheme.button
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        subtitle: themeData.primaryTextTheme.subtitle
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
        overline: themeData.primaryTextTheme.overline
            .copyWith(fontFamilyFallback: ["PingFang SC", "Heiti SC"]),
      ),
    );
    return result;
  }

@dcoinapi
Copy link

dcoinapi commented Sep 5, 2019

I fix it with the following code :

   var themeData = ThemeData(
        primarySwatch: primarySwatch,);
 ......

It works. Thanks bro :)

@GaryQian
Copy link
Contributor

Thanks for speaking to me about this in person at GDD, I'll try to get on this as soon as I can!

@GaryQian
Copy link
Contributor

Possibly related: #40184

It may have to do with changes in the coretext backend.

@GaryQian
Copy link
Contributor

GaryQian commented Sep 23, 2019

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 Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans') to specify simplified Chinese.

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.

@GaryQian
Copy link
Contributor

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.

@GaryQian
Copy link
Contributor

Have confirmed this repros in an app with no localization setup at all. This bug is completely unrelated to locales.

@GaryQian GaryQian added the a: typography Text rendering, possibly libtxt label Sep 23, 2019
@GaryQian
Copy link
Contributor

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.

@GaryQian
Copy link
Contributor

GaryQian commented Sep 24, 2019

So "Apple SD Gothic Neo" provides traditional glyphs for a subset of CJK characters:

https://www.findmyfont.com/fonts/font-preview?fset=Mac-OS-Fonts&fid=5522739427c13d9d6934f5050ad8727c&width=1130&text=%E7%B3%BB%E7%BB%9F%E6%B6%88%E6%81%AF%E8%AE%BE%E7%BD%AE&fsize=48&wrap=2

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.

@github-actions
Copy link

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 flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: fidelity Matching the OEM platforms better a: typography Text rendering, possibly libtxt framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants