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

Font fallback is misbehaving on iOS 13 for certain glyphs #40184

Closed
sroddy opened this issue Sep 10, 2019 · 15 comments
Closed

Font fallback is misbehaving on iOS 13 for certain glyphs #40184

sroddy opened this issue Sep 10, 2019 · 15 comments
Labels
a: typography Text rendering, possibly libtxt engine flutter/engine repository. See also e: labels. found in release: 1.24 Found to occur in 1.24 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-ios iOS applications specifically waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@sroddy
Copy link
Contributor

sroddy commented Sep 10, 2019

Steps to Reproduce

The following issue only occurs on iOS 13. Reproduced on the latest 2 stable releases (1.7.8 and 1.9.1).

Certain glyphs (e.g. U+2713) render as a square if you set a font family that do not contain them. Setting a font fallback family does not help either, while specifying a font family that contains the symbol (e.g. SF Pro Text Regular) does make it display right.
Interestingly enough, other glyphs (e.g. U+2714) handle fallback correctly and are displayed correctly.

Screenshot of bad behaviour (iOS 13):
Simulator Screen Shot - iPhone 8 - 2019-09-10 at 23 40 28

Screenshot of good behaviour (iOS 12.4)
Simulator Screen Shot - iPhone SE - 2019-09-10 at 23 47 36

void main() {
  runApp(
    MaterialApp(home: Center(child: Text('\u{2713}', style: TextStyle(
      fontFamily: 'Helvetica Neue',
      decoration: TextDecoration.none,
    ),),)));
}

Logs

flutter doctor -v
[✓] Flutter (Channel unknown, v1.9.1+hotfix.3-pre.3, on Mac OS X 10.14.6 18G87, locale it-IT)
• Flutter version 1.9.1+hotfix.3-pre.3 at /Users/sroddy_bs/flutter/flutter
• Framework revision a29de57 (6 days ago), 2019-09-04 14:25:10 +0200
• Engine revision b863200
• Dart version 2.5.0

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/sroddy_bs/Library/Android/sdk
• Android NDK at /Users/sroddy_bs/Library/Android/sdk/ndk-bundle
• Platform android-28, build-tools 28.0.3
• 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-1343-b01)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.3, Build version 10G8
• CocoaPods version 1.7.4

[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 19.1
• Dart plugin version 171.4424
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] IntelliJ IDEA Community Edition (version 2019.2.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 39.0.5
• Dart plugin version 192.6262.58

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

[✓] Connected device (1 available)
• iPhone SE • 96789764-DE45-4281-AD1E-E17C17D1FDB0 • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)

• No issues found!

@dnfield dnfield added a: typography Text rendering, possibly libtxt engine flutter/engine repository. See also e: labels. framework flutter/packages/flutter repository. See also f: labels. ‎‍platform-catalina Issues related to macOS Catalina platform-ios iOS applications specifically labels Sep 10, 2019
@chinmaygarde
Copy link
Member

cc @GaryQian

@dnfield dnfield added this to the Goals milestone Sep 10, 2019
@GaryQian
Copy link
Contributor

cc @jasonsimmons this must have happened after you fixed the incorrect fallback logic.

@sroddy
Copy link
Contributor Author

sroddy commented Sep 11, 2019

@GaryQian @jason-simmons just to point out, if it wasn't clear enough, that this is not a regression inside Flutter code, as any version of the framework is presenting the same behaviour once the OS is updated to iOS 13

@goderbauer goderbauer removed framework flutter/packages/flutter repository. See also f: labels. ‎‍platform-catalina Issues related to macOS Catalina labels Sep 11, 2019
@GaryQian
Copy link
Contributor

We rely on Coretext as a dependency to handle some of this behavior. Does this mean Apple has updated/broken/changed the API or its implementations? If so, preferably, changenotes would be helpful on figuring out how to respond to this.

@GaryQian
Copy link
Contributor

flutter/engine#12426 Has landed and may fix this bug. If Apple changed the font name, it could have impacted the order we previously loaded fallback fonts.

Can you confirm if this bug still exists?

@sroddy
Copy link
Contributor Author

sroddy commented Sep 25, 2019

I've just seen this, sorry.

Going to test it tomorrow morning as first thing, thanks.

@cbracken
Copy link
Member

@sroddy @GaryQian were you able to confirm whether this issue has been fixed?

@sroddy
Copy link
Contributor Author

sroddy commented Sep 30, 2019

@cbracken @GaryQian I've just tested it on current master (11d0235) and unfortunately this problem is NOT fixed.

@GaryQian
Copy link
Contributor

Thanks for checking, We can continue to look at this then independently from the other issues.

@PiN73
Copy link

PiN73 commented Dec 17, 2019

Same on Android, Flutter 1.12.

For example, symbol ₽ is present in Roboto but not OpenSans. Let's look at three cases:

fontFamily is not specified

Text('₽')

In this case Flutter uses default font for Android — Roboto, and the symbol is rendered correctly.

fontFamily does not support the symbol, fontFamilyFallback is not specified

Text('₽', style: TextStyle(
  fontFamily: 'OpenSans',
))

According to docs, if all font families are exhausted and no match was found, the default platform font family will be used instead. But actually instead of symbol from Roboto it renders a box.

fontFamily does not support the symbol, fontFamilyFallback is specified explicitly (.ttf font asset is used for Roboto)

Text('₽', style: TextStyle(
  fontFamily: 'OpenSans',
  fontFamilyFallback: ['Roboto'],
))

In this case fallback works.

But it would be good if system font is used as fallback implicitly

@jmagman jmagman added this to Awaiting Triage in Mobile - iOS fidelity review Feb 25, 2020
@kf6gpe kf6gpe added the P2 Important issues not at the top of the work list label May 29, 2020
@Hixie Hixie removed this from the None. milestone Aug 17, 2020
@gaaclarke gaaclarke moved this from Awaiting Triage to Engineer Reviewed in Mobile - iOS fidelity review Oct 13, 2020
@TahaTesser
Copy link
Member

The issue reproduces on iOS 14 as well

Simulator Screen Shot - iPhone 12 - 2020-10-27 at 18 41 25

code sample
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
      home: Center(
    child: Text(
      '\u{2713}',
      style: TextStyle(
        fontFamily: 'HelveticaNeue',
        decoration: TextDecoration.none,
      ),
    ),
  )));
}

fonts.zip

flutter doctor -v
[✓] Flutter (Channel master, 1.24.0-4.0.pre.82, on Mac OS X 10.15.7 19H2
    darwin-x64, locale en-GB)
    • Flutter version 1.24.0-4.0.pre.82 at /Users/tahatesser/Code/flutter_master
    • Framework revision e5814756a2 (4 hours ago), 2020-10-27 01:47:03 -0700
    • Engine revision 1857470267
    • Dart version 2.11.0 (build 2.11.0-260.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/tahatesser/Code/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/tahatesser/Code/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.10.0.rc.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

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

[✓] Connected device (3 available)
    • macOS (desktop)  • macos      • darwin-x64     • Mac OS X 10.15.7 19H2
      darwin-x64
    • Web Server (web) • web-server • web-javascript • Flutter Tools
    • Chrome (web)     • chrome     • web-javascript • Google Chrome
      86.0.4240.111

• No issues found!

@TahaTesser TahaTesser added found in release: 1.24 Found to occur in 1.24 has reproducible steps The issue has been confirmed reproducible and is ready to work on labels Oct 27, 2020
@icespring
Copy link

any progress?

@jmagman jmagman added this to Awaiting triage in iOS Platforms - text review Jun 8, 2021
@darshankawar
Copy link
Member

Verified this using latest master and running the code sample on iOS 15.3 and it shows the expected result as below:

Screenshot 2023-04-27 at 4 14 22 PM

Since I don't have iOS 13 or 14 to verify this behavior on, @sroddy is it possible for you to verify on said iOS version (13) and confirm if this is still an issue using latest master version ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 27, 2023
@github-actions
Copy link

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.

iOS Platforms - text review automation moved this from Awaiting triage to Engineer reviewed May 18, 2023
@github-actions
Copy link

github-actions bot commented Jun 1, 2023

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 Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: typography Text rendering, possibly libtxt engine flutter/engine repository. See also e: labels. found in release: 1.24 Found to occur in 1.24 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-ios iOS applications specifically waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
Mobile - iOS fidelity review
  
Engineer Reviewed
iOS Platforms - text review
  
Engineer reviewed
Development

No branches or pull requests