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

[Engine][3.7] Emojis are not properly rendered #119536

Open
KnucklesEQ opened this issue Jan 30, 2023 · 65 comments · Fixed by flutter/engine#40666
Open

[Engine][3.7] Emojis are not properly rendered #119536

KnucklesEQ opened this issue Jan 30, 2023 · 65 comments · Fixed by flutter/engine#40666
Labels
a: typography Text rendering, possibly libtxt c: regression It was better in the past than it is now c: rendering UI glitches reported at the engine/skia rendering level engine flutter/engine repository. See also e: labels. found in release: 3.7 Found to occur in 3.7 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-linux Building on or for Linux specifically platform-windows Building on or for Windows specifically team-engine Owned by Engine team triaged-engine Triaged by Engine team

Comments

@KnucklesEQ
Copy link

Hi!

After installing the latest Flutter version (3.7), we noticed in our apps that the emojis in general (and emoji flags in particular) are flat, without colour.

Am I missing something? Is there a logical reason for this change? We didn't find any info related in the changelog of Flutter 3.7.

We tried to use the Noto Color Emoji in our last web application, but the app hangs many seconds to load the icons.

Steps to Reproduce

You can copy the code in DartPad:

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark().copyWith(
        scaffoldBackgroundColor: Colors.blueGrey,
      ),
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    String k = 'ES';

    String flag = k
        .toUpperCase()
        .split('')
        .map((char) => 127397 + char.codeUnitAt(0))
        .map((code) => String.fromCharCode(code))
        .join();
    return Text(flag);
  }
}

Expected results:

This happens in Flutter 3.3.10:
imagen

imagen

Actual results:

This happens in Flutter 3.7:
imagen

imagen

--
Thanks!

@FXschwartz
Copy link

@KnucklesEQ Testing this in dartpad shows the same thing. But testing on the master channel (Flutter 3.7.0-28.0.pre.20) works correctly for me. Can you try testing on master as well and see if it is fixed for you?

@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Jan 31, 2023
@danagbemava-nc
Copy link
Member

I can reproduce the issue only when I do not include the NotoColorEmoji font.

Hi @KnucklesEQ, is this the same case for you as well?

without NotoColorEmoji with NotoColorEmoji
Screenshot 2023-01-31 at 08 35 16 Screenshot 2023-01-31 at 08 36 16

@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 31, 2023
@KnucklesEQ
Copy link
Author

@KnucklesEQ Testing this in dartpad shows the same thing. But testing on the master channel (Flutter 3.7.0-28.0.pre.20) works correctly for me. Can you try testing on master as well and see if it is fixed for you?

I build our last web app with Flutter Master:

Flutter is already up to date on channel master
Flutter 3.7.0-31.0.pre.25 • channel master • https://github.com/flutter/flutter.git
Framework • revision 2c34a88eb8 (hace 79 minutos) • 2023-01-31 02:28:09 -0500
Engine • revision 72abe0e4b8
Tools • Dart 3.0.0 (build 3.0.0-179.0.dev) • DevTools 2.20.1

The problem still persist:
imagen

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 31, 2023
@KnucklesEQ
Copy link
Author

KnucklesEQ commented Jan 31, 2023

I can reproduce the issue only when I do not include the NotoColorEmoji font.

Hi @KnucklesEQ, is this the same case for you as well?
without NotoColorEmoji with NotoColorEmoji
...

Hi @danagbemava-nc

Yes, it works with the NotoColorEmoji font:

imagen

But the problem with this font is that it is HUGE.

When I load it using the Google Fonts package, the app hangs for about 5 to 10 seconds while it downloads. And if I add the font to the assets folder, it's so huge in size (22MB vs 200-300KB of a regular font).

And as mentioned here (#119602 (comment)), if the user enters an emoji in a TextField, you can't get it to display correctly with NotoColorEmoji.

That's why I wrote this issue, I don't understand that NotoColorEmoji is a solution.

@danagbemava-nc danagbemava-nc changed the title Problem with flag emojis in Flutter 3.7 [Web][Canvaskit][3.7] Emojis are not properly rendered Jan 31, 2023
@danagbemava-nc
Copy link
Member

danagbemava-nc commented Jan 31, 2023

Thanks for the info.

I can confirm that entering emojis into a Textfield does not work as expected. See the screenshots below. When using the NotoColorEmoji with Text widgets, that works, but it doesn’t appear to be a solution for every case.

Upon further investigation (based on #119536 (comment)), I found that this issue reproduces on windows as well.

However, when I use the emoji keyboard on windows, I do not have any issues

Side Note: this worked just fine in stable 3.3.10, but appears to have broken on 3.7.0

Labeling for further investigation.

screenshots

Web

canvaskit HTML
Screenshot 2023-01-31 at 13 04 20 Screenshot 2023-01-31 at 13 05 31

Windows

entering emoji in textfields displaying flag emoji
code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark().copyWith(
        scaffoldBackgroundColor: Colors.blueGrey,
      ),
      debugShowCheckedModeBanner: false,
      home:  Scaffold(
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: const [
              MyWidget(),
              TextField()
            ],
          ),
        ),
      ),
    );
  }
}

class MyWidget extends StatelessWidget {
  const MyWidget({super.key});

  @override
  Widget build(BuildContext context) {
    String k = 'ES';

    String flag = k
        .toUpperCase()
        .split('')
        .map((char) => 127397 + char.codeUnitAt(0))
        .map((code) => String.fromCharCode(code))
        .join();
    return Text(flag);
  }
}
flutter doctor -v
[✓] Flutter (Channel stable, 3.7.0, on macOS 13.1 22C65 darwin-arm64, locale en-GB)
    • Flutter version 3.7.0 on channel stable at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b06b8b2710 (8 days ago), 2023-01-23 16:55:55 -0800
    • Engine revision b24591ed32
    • Dart version 2.19.0
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

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

[!] Android Studio (version 2022.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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[!] Android Studio (version 2022.1)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Community Edition (version 2022.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • 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

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.1 22C65 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.
[!] Flutter (Channel master, 3.7.0-31.0.pre.24, on macOS 13.1 22C65 darwin-arm64, locale en-GB)
    • Flutter version 3.7.0-31.0.pre.24 on channel master at /Users/nexus/dev/sdks/flutters
    ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7ba440655a (9 hours ago), 2023-01-30 20:37:21 -0800
    • Engine revision 9448f2966c
    • Dart version 3.0.0 (build 3.0.0-179.0.dev)
    • DevTools version 2.20.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

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

[!] Android Studio (version 2022.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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[!] Android Studio (version 2022.1)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Community Edition (version 2022.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • 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

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.1 22C65 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 3 categories.

Platforms I have personally tested

Platform Does issue reproduce
iOS
macOS
windows desktop
HTML
canvaskit
android

❌: Issue does not reproduce
✅: Issue reproduces

Edit: added more info about platforms

@danagbemava-nc danagbemava-nc added c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. a: typography Text rendering, possibly libtxt c: rendering UI glitches reported at the engine/skia rendering level e: web_canvaskit CanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Web has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.7 Found to occur in 3.7 and removed in triage Presently being triaged by the triage team labels Jan 31, 2023
@KnucklesEQ
Copy link
Author

Thanks @danagbemava-nc

We did some additional research, and we found also that something similar happens in Linux Desktop and in Windows Desktop:

  • In Linux:

imagen

  • In Windows:

imagen

It's not the same case as Web. In Linux and Windows I don't see the flag with an 'ES' in it, I see only the two characters separated. Maybe this is not just a Canvaskit issue?

PS: The Android version of the app works fine.

@danagbemava-nc danagbemava-nc changed the title [Web][Canvaskit][3.7] Emojis are not properly rendered [Engine][3.7] Emojis are not properly rendered Feb 1, 2023
@danagbemava-nc danagbemava-nc added engine flutter/engine repository. See also e: labels. and removed engine flutter/engine repository. See also e: labels. e: web_canvaskit CanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Web labels Feb 1, 2023
@danagbemava-nc
Copy link
Member

Hi @KnucklesEQ, what linux distro did you test on? I asked my colleague (@huycozy) to check on his linux machine but it worked just fine for him on both stable and master. He's running Ubuntu 22.04.1 LTS 5.15.0-58-generic

@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 1, 2023
@KnucklesEQ
Copy link
Author

KnucklesEQ commented Feb 1, 2023

Hi @danagbemava-nc

I'm using Debian GNU/Linux 11 (bullseye) stable, with kernel Linux 5.10.0-21-amd64 x86_64.

This is the info from flutter doctor:

[✓] Linux toolchain - develop for Linux desktop
    • Debian clang version 11.0.1-2
    • cmake version 3.18.4
    • ninja version 1.10.1
    • pkg-config version 0.29.2

On Windows, I tested the app on Windows 10.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 1, 2023
@while-loop
Copy link

while-loop commented Feb 4, 2023

Adding another data point to this issue.

Building web v3.7.0 w/ canvaskit shows monochrome emojis. On:

  • Linux Chrome browser
  • Android Chrome browser
  • iOS Safari & Chrome browser.

Downgrading to v3.3.10 shows the correct emoji on the devices list above ☝️

flutter docker -v
[!] Flutter (Channel stable, 3.7.0, on Ubuntu 20.04.1 LTS 5.8.0-34-generic, locale en_US.UTF-8)
    • Flutter version 3.7.0 on channel stable at /home/anthony/fvm/versions/3.7.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b06b8b2710 (11 days ago), 2023-01-23 16:55:55 -0800
    • Engine revision b24591ed32
    • Dart version 2.19.0
    • DevTools version 2.20.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[✓] Connected device (2 available)
    • Chrome (web)    • chrome • web-javascript • Google Chrome 108.0.5359.124

@chinmaygarde chinmaygarde added the P2 Important issues not at the top of the work list label Feb 6, 2023
@zjrwdl
Copy link

zjrwdl commented Jul 26, 2023

#131337
Some emojis cannot be rendered properly in flutter web html rendering mode
@ditman

@EddieMataEwy
Copy link

For people on Windows, setting familyFontFallback didn't work for me.
What worked was setting app theme familyfont (you can also only set it for specific elements) to "Segoe UI Emoji". Normal text will still be rendered natively but emojis will now be rendered correctly.
Flutter falls back to "Segoe UI Variant" for anything that is not an emoji I believe.

Merrit added a commit to Merrit/nyrna that referenced this issue Aug 29, 2023
Fallback to Noto Color Emoji is needed to render emojis in color.

See:
flutter/flutter#119536
Merrit added a commit to Merrit/nyrna that referenced this issue Aug 29, 2023
Fallback to Noto Color Emoji is needed to render emojis in color.

See:
flutter/flutter#119536
Merrit added a commit to Merrit/adventure_list that referenced this issue Sep 14, 2023
Fallback to Noto Color Emoji is needed to render emojis in color.

See:
flutter/flutter#119536
Merrit added a commit to Merrit/adventure_list that referenced this issue Sep 14, 2023
Fallback to Noto Color Emoji is needed to render emojis in color.

See:
flutter/flutter#119536
@lucasjinreal
Copy link

How to resolve on windows for now? I still can not get emoji properly rendered with flutter 3.13

image

@ehmd-sh
Copy link

ehmd-sh commented Nov 24, 2023

Quoted reply.

How to resolve on windows for now? I still can not get emoji properly rendered with flutter 3.13

image

@lucasjinreal Windows' built-in emoji font does not have support for Flags hence why it shows them as their ISO Country Codes only. The only emoji flags that render on Windows are non-Country flags. In case you see any empty spots where you expect Emojis, it's because Windows emoji font hasn't been updated with the newer emojis that were published by the Unicode Consortium.

Flutter Docs have a section on how you can use a custom font, so you might want to use Noto Color Emoji/Twemoji (free), JoyPixels (paid), or something else: Flutter Docs: Use a custom font

@Juliotati
Copy link

Juliotati commented May 15, 2024

👋 @ditman
Since flutter v3.22.0 index.html has an updated config and it's no longer needed to have the old _flutter.loader.loadEntrypoint... where we were setting useColorEmoji for a fix.

Is there a way to get the same outcome without having to use the old initialisation that allows us to set useColorEmoji?

Is there a possibility of having this set to true by default somewhere for the client (us) or it's not the desired path for a solution?

Update:

The solution is documented here https://docs.flutter.dev/platform-integration/web/bootstrapping

@cedvdb
Copy link
Contributor

cedvdb commented May 17, 2024

Why is this behind a flag useColorEmoji ? Does it import additional assets ?

@ditman
Copy link
Member

ditman commented May 22, 2024

Why is this behind a flag useColorEmoji ? Does it import additional assets ?

@cedvdb Good question (and poorly documented on our end, I just found out!).

The fallback font we use to render color emojis (Noto Color Emoji) is very large (a ~24MB download IIRC), so we defaulted to the lightest one (Noto Emoji).

@cedvdb
Copy link
Contributor

cedvdb commented May 22, 2024

I assume you considered having text as platform views, so why not ? Letter spacing not being exactly the same on every platforms pales in comparison of adding an additional 24MB for emojis, or not being able to select text for free.

@tomasweigenast
Copy link

Why is this behind a flag useColorEmoji ? Does it import additional assets ?

@cedvdb Good question (and poorly documented on our end, I just found out!).

The fallback font we use to render color emojis (Noto Color Emoji) is very large (a ~24MB download IIRC), so we defaulted to the lightest one (Noto Emoji).

But why does Flutter need a custom font to render emojis if operating systems already have their font with emojis?

@ditman
Copy link
Member

ditman commented May 22, 2024

But why does Flutter need a custom font to render emojis if operating systems already have their font with emojis?

@tomasweigenast Good question! The reason is that Skia (also canvaskit) needs the bytes of whatever font you want to use so it can render text, and doesn't have access to the system fonts (see the SkParagraph example in the CanvasKit - Skia + WebAssembly docs)

I assume you considered having text as platform views, so why not ? Letter spacing not being exactly the same on every platforms pales in comparison of adding an additional 24MB for emojis, or not being able to select text for free.

@cedvdb yeah, I don't know if there's a specific proposal for all text, but I know a (sadly, former) member of the team was working on text input as platform views. Doing all text may have been a logical continuation.

@tomasweigenast
Copy link

But why does Flutter need a custom font to render emojis if operating systems already have their font with emojis?

@tomasweigenast Good question! The reason is that Skia (also canvaskit) needs the bytes of whatever font you want to use so it can render text, and doesn't have access to the system fonts (see the SkParagraph example in the CanvasKit - Skia + WebAssembly docs)

But Skia is used on Android too. And there, we don't need the Noto Emoji font to render emojis.

@ditman
Copy link
Member

ditman commented May 23, 2024

But Skia is used on Android too.

@tomasweigenast yeah, Android has a completely different set of (security) restrictions than the Web, and this is one of them :)

On the web, there's the Local Font Access API, but it's not widely available yet, and it prompts the user for permissions when you want to access their local fonts (check the demo).

@kamranbekirovyz
Copy link

With the new version of Flutter where we build with wasm support the index.html file's content has changed and I can only see <script src="flutter_bootstrap.js" async=""></script> as a place where I can add some logic for adding useColorEmoji. But, I'm not sure where to add. @ditman can I get any help from you?

@tomasweigenast
Copy link

With the new version of Flutter where we build with wasm support the index.html file's content has changed and I can only see <script src="flutter_bootstrap.js" async=""></script> as a place where I can add some logic for adding useColorEmoji. But, I'm not sure where to add. @ditman can I get any help from you?

You can modify the behavior. Check the official docs: https://docs.flutter.dev/platform-integration/web/initialization

@ditman
Copy link
Member

ditman commented Jun 25, 2024

I'm not sure where to add. @ditman can I get any help from you?

@kamranbekirovyz, @tomasweigenast linked to the best documentation page for this. The code is essentially the same, but it now can live in the flutter_bootstrap.js (which can also be inlined into your index.html to save one round-trip to the server.)

I migrated some of my example apps to the new syntax a while ago; I can point you to some of those examples if the docs aren't enough :)

@T-P-F
Copy link

T-P-F commented Jun 26, 2024

SOLVED: solution at bottom of post

Still seems that useColorEmoji is not working.

  1. Delete and recreate web folder (flutter create --platforms web --org com.company.appName .)
  2. Create flutter_bootstrap.js file in the web directory with the following contents
{{flutter_js}}
{{flutter_build_config}}

window.addEventListener("load", function () {
  var loading = document.querySelector("#loading");
  _flutter.loader
    .load({
      entrypointUrl: "main.dart.js?v=UNIQUE_VERSION_STRING",
      serviceWorker: {
        timeoutMilis: 6000,
        serviceWorkerVersion: {{flutter_service_worker_version}},
      },
    })
    .then(function (engineInitializer) {
      loading.classList.add("main_done");
      return engineInitializer.initializeEngine({ useColorEmoji: true });
    })
    .then(function (appRunner) {
      loading.classList.add("init_done");
      return appRunner.runApp();
    })
    .then(function (app) {
      // Wait a few milliseconds so users can see the "zoooom" animation before getting rid of the "loading" div.
      window.setTimeout(function () {
        loading.remove();
      }, 200);
    });
});
  1. Node that the new index.js includes:
    <script src="flutter_bootstrap.js" async></script>
  1. Run the app in Chrome and try to render some emojis, they're still black and white:
Screenshot 2024-06-26 at 22 28 17

There is a simple loading animation, which works correctly. It is just the b-w emojis that are not working.

  1. In Chrome inspector, this occurs:
Screenshot 2024-06-26 at 22 34 42

Any obvious steps I've missed here? Thoughts on what the problem might be?

Thanks for any help @ditman & all 🙏

flutter doctor -v

[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale en-NL)
• Flutter version 3.22.2 on channel stable at /Users/blerg/fvm/versions/3.22.2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 761747b (3 weeks ago), 2024-06-05 22:15:13 +0200
• Engine revision edd8546116
• Dart version 3.4.3
• DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/blerg/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/blerg/Library/Android/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
17.0.7+0-17.0.7b1000.6-10550314)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2

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

[✓] Android Studio (version 2023.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
17.0.7+0-17.0.7b1000.6-10550314)

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

[✓] Connected device (5 available)
• iPhone 15 (mobile) • BDFF72F2-4E60-4134-8FD4-50BFCD49CA98 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
• macOS (desktop) • macos •
darwin-arm64 • macOS 14.5 23F79 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad •
darwin • macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome •
web-javascript • Google Chrome 126.0.6478.116

[✓] Network resources
• All expected network resources are available.

• No issues found!

SOLUTION

Screenshot 2024-06-26 at 22 47 46

In flutter_bootstrap.js changed this:

window.addEventListener("load", function () {
  var loading = document.querySelector("#loading");
  _flutter.loader
    .load({
      entrypointUrl: "main.dart.js?v=UNIQUE_VERSION_STRING",
      serviceWorker: {
        timeoutMilis: 6000,
        serviceWorkerVersion: "3786782205",
      },
    })
    .then(function (engineInitializer) {
      loading.classList.add("main_done");
      return engineInitializer.initializeEngine({ useColorEmoji: true });
    })
    .then(function (appRunner) {
      loading.classList.add("init_done");
      return appRunner.runApp();
    })
    .then(function (app) {
      // Wait a few milliseconds so users can see the "zoooom" animation before getting rid of the "loading" div.
      window.setTimeout(function () {
        loading.remove();
      }, 200);
    });
});

to this:

window.addEventListener("load", function () {
  var loading = document.querySelector("#loading");
  _flutter.loader.load({
    onEntrypointLoaded: async function (engineInitializer) {
      loading.classList.add("main_done");

      const appRunner = await engineInitializer.initializeEngine({ useColorEmoji: true });
      loading.classList.add("init_done");
      await appRunner.runApp();
      window.setTimeout(function () {
        loading.remove();
      }, 200);
    },
  });
});

@ditman
Copy link
Member

ditman commented Jun 28, 2024

"Changed to onEntrypointLoaded"...

This is the way, @T-P-F, the promise syntax has been deprecated for a while (I think the browser console should be telling you to use onEntrypointLoaded instead?)

@ditman
Copy link
Member

ditman commented Jun 28, 2024

We need to document useColorEmoji here:

https://docs.flutter.dev/platform-integration/web/initialization

@T-P-F
Copy link

T-P-F commented Jun 29, 2024

I think the browser console should be telling you to use onEntrypointLoaded instead?

If it was, I'd missed it 🤷

@T-P-F
Copy link

T-P-F commented Jun 29, 2024

We need to document useColorEmoji

Yeah, it is only knowable via SO currently :)

@vantian
Copy link

vantian commented Jul 11, 2024

I used useColorEmoji in my index.html, it's works fine on my local. but when I'm deploying to my Firebase it's still showing black & white. I'm totally lost here.

@double12
Copy link

double12 commented Jul 11, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: typography Text rendering, possibly libtxt c: regression It was better in the past than it is now c: rendering UI glitches reported at the engine/skia rendering level engine flutter/engine repository. See also e: labels. found in release: 3.7 Found to occur in 3.7 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-linux Building on or for Linux specifically platform-windows Building on or for Windows specifically team-engine Owned by Engine team triaged-engine Triaged by Engine team
Projects
None yet
Development

Successfully merging a pull request may close this issue.