Repository navigation
Separate ARM64 Linux Desktop and Embedded engine builds to fix CJK and non-ASCII font rendering - #180235
Conversation
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the font rendering issue for CJK and non-ASCII characters on ARM64 Linux desktops by separating the engine builds for desktop and embedded systems. The introduction of a new linux_arm_host_desktop_engine with fontconfig enabled is a clean solution. The modifications to the existing linux_arm_host_engine to focus solely on embedded targets are also logical. I have one suggestion to improve the clarity and robustness of the new CI configuration by avoiding potential build name collisions.
| { | ||
| "archives": [ | ||
| { | ||
| "name": "ci/linux_profile_arm64", | ||
| "type": "gcs", | ||
| "base_path": "out/ci/linux_profile_arm64/zip_archives/", | ||
| "include_paths": [ | ||
| "out/ci/linux_profile_arm64/zip_archives/linux-arm64-profile/linux-arm64-flutter-gtk.zip" | ||
| ], | ||
| "realm": "production" | ||
| } | ||
| ], | ||
| "drone_dimensions": [ | ||
| "device_type=none", | ||
| "os=Linux" | ||
| ], | ||
| "gclient_variables": { | ||
| "download_android_deps": false, | ||
| "download_jdk": false, | ||
| "use_rbe": true | ||
| }, | ||
| "gn": [ | ||
| "--target-dir", | ||
| "ci/linux_profile_arm64", | ||
| "--runtime-mode", | ||
| "profile", | ||
| "--target-os=linux", | ||
| "--linux-cpu=arm64", | ||
| "--prebuilt-dart-sdk", | ||
| "--no-lto", | ||
| "--rbe", | ||
| "--no-goma", | ||
| "--enable-fontconfig" | ||
| ], | ||
| "name": "ci/linux_profile_arm64", | ||
| "description": "Produces profile mode artifacts to target arm64 Linux from a Linux host with fontconfig enabled.", | ||
| "ninja": { | ||
| "config": "ci/linux_profile_arm64", | ||
| "targets": [ | ||
| "flutter/shell/platform/linux:flutter_gtk" | ||
| ] | ||
| } |
There was a problem hiding this comment.
There's a potential build name collision. The build name "ci/linux_debug_arm64" is used for one of the builds in this file, and it's also used in engine/src/flutter/ci/builders/linux_arm_host_engine.json.
Since these two configurations now build for different targets (desktop vs. embedded), they produce different artifacts. Using the same build name can lead to confusion and potential issues with artifact storage and retrieval in CI, where one build's output might overwrite another's if they are identified by the same name.
To avoid this, it's best to use unique names for the builds in this new desktop-specific configuration. I suggest appending a _desktop suffix to the build names and their corresponding paths and configurations.
This change should be applied to all three builds defined in this file (profile, debug, and release) for consistency. Here is a suggestion for the profile build:
{
"archives": [
{
"name": "ci/linux_profile_arm64_desktop",
"type": "gcs",
"base_path": "out/ci/linux_profile_arm64_desktop/zip_archives/",
"include_paths": [
"out/ci/linux_profile_arm64_desktop/zip_archives/linux-arm64-profile/linux-arm64-flutter-gtk.zip"
],
"realm": "production"
}
],
"drone_dimensions": [
"device_type=none",
"os=Linux"
],
"gclient_variables": {
"download_android_deps": false,
"download_jdk": false,
"use_rbe": true
},
"gn": [
"--target-dir",
"ci/linux_profile_arm64_desktop",
"--runtime-mode",
"profile",
"--target-os=linux",
"--linux-cpu=arm64",
"--prebuilt-dart-sdk",
"--no-lto",
"--rbe",
"--no-goma",
"--enable-fontconfig"
],
"name": "ci/linux_profile_arm64_desktop",
"description": "Produces profile mode artifacts to target arm64 Linux from a Linux host with fontconfig enabled.",
"ninja": {
"config": "ci/linux_profile_arm64_desktop",
"targets": [
"flutter/shell/platform/linux:flutter_gtk"
]
}
}2eb7b14 to
8de35d4
Compare
8de35d4 to
e2acdf9
Compare
|
Hi @dkwingsmt, Sorry for the ping. I have updated this branch using rebase to stay current with the latest master. This PR aims to fix the fontconfig issue on Linux ARM64 desktop. Most CI checks are passing, but the Google testing is currently waiting for a maintainer's approval to proceed. Could you please take a look when you have a moment, or help trigger the internal tests? Thank you for your time and help! |
|
Thank you for the message. I'm reassigning it to @jtmcdole to evaluate / triage since he's more responsible to infrastructural work like this. |
make the diffs minimal
|
I made a change to make this basically mirror the |
|
Why remove "ci/linux_profile_arm64" and "ci/linux_release_arm64"? |
|
|
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
@jtmcdole Thank you for your review and the improvements! My apologies for the delayed response - I missed the notifications during the Spring Festival holiday period and have been quite busy with work afterwards. Regarding the removal of I see you've made changes to align the structure with Please let me know if there are any other adjustments you'd like me to make! |
|
So when separate (( |
|
cc @jtmcdole This is ready for another review when you're available :) |
…pport The flutter-elinux engine used for ARM64 Linux is compiled without --enable-fontconfig, so the Flutter text shaper cannot discover system fonts, causing CJK characters to render as tofu boxes even when fonts like Noto Sans CJK are installed. See flutter/flutter#139293. Fix by loading a CJK font at startup via FontLoader (bypassing fontconfig) and propagating it through two paths so all text is covered: 1. MyTheme.applyFontFallback() — updates textTheme in both light/dark ThemeData so Material components get the fallback via the theme. 2. _mergeCjkFallback() in GetMaterialApp builders — merges the fallback into DefaultTextStyle so bare Text() widgets and those with inherit:true styles also render CJK correctly. Font discovery prefers fc-list (fontconfig CLI, available even without engine fontconfig support), with a hardcoded search-path list as fallback covering Debian/Ubuntu, Fedora/RHEL, and Arch Linux layouts. This is an app-level workaround; the engine-level fix is tracked at flutter/flutter#180235 (open as of 2026-06). https://claude.ai/code/session_01MhU2orMADdw7M2AdzmJfGh
The flutter-elinux engine used for ARM64 Linux builds is compiled without --enable-fontconfig, so Flutter's text shaper cannot discover system fonts. This causes CJK characters to render as tofu boxes even when fonts such as Noto Sans CJK are installed. See flutter/flutter#139293. Fix by loading a CJK font at startup via FontLoader (bypassing fontconfig) and propagating it through two paths so all text widgets are covered: 1. MyTheme.applyFontFallback() — updates textTheme on both light and dark ThemeData so Material components receive the fallback through the theme. 2. _mergeCjkFallback() in GetMaterialApp builders — wraps child widgets in DefaultTextStyle.merge so bare Text() widgets and those with inherit:true also render CJK characters correctly. Font discovery first runs `fc-list :lang=zh` (the fontconfig CLI tool is available system-wide even when the engine has no fontconfig support), then falls back to a hardcoded search-path list covering Debian/Ubuntu, Fedora/ RHEL, Arch Linux, and WenQuanYi font layouts. This is an app-level workaround. The engine-level fix is tracked at flutter/flutter#180235 (open as of 2026-06). Fixes rustdesk#10666
The flutter-elinux engine used for ARM64 Linux builds is compiled without --enable-fontconfig, so Flutter's text shaper cannot discover system fonts. This causes CJK characters to render as tofu boxes even when fonts such as Noto Sans CJK are installed. See flutter/flutter#139293. Fix by loading a CJK font at startup via FontLoader (bypassing fontconfig) and propagating it through two paths so all text widgets are covered: 1. MyTheme.applyFontFallback() — updates textTheme on both light and dark ThemeData so Material components receive the fallback through the theme. 2. _mergeCjkFallback() in GetMaterialApp builders — wraps child widgets in DefaultTextStyle.merge so bare Text() widgets and those with inherit:true also render CJK characters correctly. Font discovery first runs `fc-list :lang=zh` (the fontconfig CLI tool is available system-wide even when the engine has no fontconfig support), then falls back to a hardcoded search-path list covering Debian/Ubuntu, Fedora/ RHEL, Arch Linux, and WenQuanYi font layouts. This is an app-level workaround. The engine-level fix is tracked at flutter/flutter#180235 (open as of 2026-06). Fixes rustdesk#10666
The flutter-elinux engine used for ARM64 Linux builds is compiled without --enable-fontconfig, so Flutter's text shaper cannot discover system fonts. This causes CJK characters to render as tofu boxes even when fonts such as Noto Sans CJK are installed. See flutter/flutter#139293. Fix by loading a CJK font at startup via FontLoader (bypassing fontconfig) and propagating it through two paths so all text widgets are covered: 1. MyTheme.applyFontFallback() — updates textTheme on both light and dark ThemeData so Material components receive the fallback through the theme. 2. _mergeCjkFallback() in GetMaterialApp builders — wraps child widgets in DefaultTextStyle.merge so bare Text() widgets and those with inherit:true also render CJK characters correctly. Font discovery first runs `fc-list :lang=zh` (the fontconfig CLI tool is available system-wide even when the engine has no fontconfig support), then falls back to a hardcoded search-path list covering Debian/Ubuntu, Fedora/ RHEL, Arch Linux, and WenQuanYi font layouts. This is an app-level workaround. The engine-level fix is tracked at flutter/flutter#180235 (open as of 2026-06). Fixes rustdesk#10666
|
autosubmit label was removed for flutter/flutter/180235, because - The status or check suite Tree_analyze has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
Hi @jtmcdole The branch was updated after the Could someone please re-apply |
flutter#190935) This builder was recently created in a refactoring of the Linux arm64 builders (see flutter#180235) The builder was not being scheduled in the merge queue because it is marked as "bringup: true" (see flutter#190893)
…15324) * fix(arm64-linux): fix CJK font rendering on flutter-elinux The flutter-elinux engine used for ARM64 Linux builds is compiled without --enable-fontconfig, so Flutter's text shaper cannot discover system fonts. This causes CJK characters to render as tofu boxes even when fonts such as Noto Sans CJK are installed. See flutter/flutter#139293. Fix by loading a CJK font at startup via FontLoader (bypassing fontconfig) and propagating it through two paths so all text widgets are covered: 1. MyTheme.applyFontFallback() — updates textTheme on both light and dark ThemeData so Material components receive the fallback through the theme. 2. _mergeCjkFallback() in GetMaterialApp builders — wraps child widgets in DefaultTextStyle.merge so bare Text() widgets and those with inherit:true also render CJK characters correctly. Font discovery queries fc-list for zh, ja, and ko separately, preferring fonts present in all three sets (true pan-CJK fonts such as NotoSansCJK or SourceHanSans) over Chinese-only fonts that may lack Japanese kana or Korean hangul glyphs. Falls back to a hardcoded search-path list covering Debian/Ubuntu, Fedora/RHEL, Arch Linux, and WenQuanYi font layouts. This is an app-level workaround. The engine-level fix is tracked at flutter/flutter#180235 (open as of 2026-06). Fixes rustdesk#10666 Signed-off-by: Bia503 <yinwenche189@gmail.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: Bia503 <yinwenche189@gmail.com> Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Separate ARM64 Linux Desktop and Embedded engine builds to fix CJK and non-ASCII font rendering
Problem
On ARM64 Linux desktop environments (GNOME, KDE, etc.), Chinese characters and other non-ASCII text render as squares in Flutter applications. This affects production applications like Ubuntu App Center which uses Flutter on ARM64.
Root Cause
The ARM64 Linux engine builds (
linux_arm_host_engine) were missing the--enable-fontconfigflag, unlike x64 Linux builds which have it. Without fontconfig support, the Flutter GTK engine cannot discover and load system fonts properly on desktop Linux distributions.Why This Wasn't Caught Earlier
The same build configuration was used for both:
This conflation meant adding fontconfig would unnecessarily bloat embedded deployments.
Solution
This PR separates ARM64 Linux builds into two distinct configurations, following the same architecture pattern as x64 Linux:
1. Desktop Builds (NEW:
linux_arm_host_desktop_engine)--enable-fontconfigfor proper font renderingflutter_gtklibrary for profile/debug/release modes2. Embedded/IoT Builds (MODIFIED:
linux_arm_host_engine)Changes Made
Created:
engine/src/flutter/ci/builders/linux_arm_host_desktop_engine.json--enable-fontconfigto all build modesflutter_gtklibrariesModified:
engine/src/flutter/ci/builders/linux_arm_host_engine.jsonflutter_gtktargets (moved to desktop config)--enable-fontconfig(not needed for embedded)Modified:
engine/src/flutter/.ci.yamllinux_arm_host_desktop_enginebuilderTesting & Verification
✅ Manual Testing
Before (Official ARM64 build without fontconfig):
After (Custom build with fontconfig):
Test Commands Used
Architecture Benefits
✅ Decoupling: Desktop and embedded builds are now independent
✅ No Breaking Changes: Embedded builds remain unchanged (same targets, no fontconfig)
✅ Transparent: Flutter Tool and VS Code don't need modifications
✅ Consistency: Follows the same pattern as x64 Linux architecture
✅ Minimal Impact: Only adds new builds, doesn't modify existing ones
Downstream Impact
Who Benefits
Who Is NOT Affected
linux_arm_host_engineas before)Related Issues
Fixes #139293 #90951
Checklist
Core Reviewers
@flutter/engine-ci @flutter/linux-desktop
Screenshots
Before (Without Fontconfig)
Chinese text displays as squares in Ubuntu App Center on ARM64:
After (With Fontconfig)
Chinese text renders correctly:
(Actual screenshots can be added to the PR after creation)
Additional Context
This issue was discovered while investigating font rendering problems in Ubuntu App Center on ARM64 systems. The fix has been verified to work with Flutter 3.38.1 on Ubuntu 25.10 ARM64.
The architecture follows the principle of separation of concerns: desktop applications need system font integration via fontconfig, while embedded systems typically use bundled fonts and don't need this dependency.