Skip to content

Use the Material Linux fallback font as the theme font on Linux - #2078

Merged
crossle merged 2 commits into
mainfrom
fix/linux-latin-font
Oct 23, 2026
Merged

crossle merged 2 commits into
mainfrom
fix/linux-latin-font

Conversation

@YeungKC

@YeungKC YeungKC commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

After #2070, Latin text and shared punctuation (—, “ ”) on Linux use the Noto Sans CJK glyphs, so the dashes and quotes in Chinese text are full width.

Before #2070, the theme kept the Material fallbacks for Linux ('Ubuntu', 'Adwaita Sans', 'Cantarell', 'DejaVu Sans', …), and Latin text used the first installed one. #2070 replaced these fallbacks with the CJK and emoji families. 77b8484 restored 'Roboto' as the main family, but 'Roboto' is not installed, so the CJK family still draws Latin text.

 withFallbackFonts() on Linux
-  fontFamily: loadedFallbackFonts            // null → 'Roboto', not installed
+  fontFamily: loadedFallbackFonts ?? fc-match('Ubuntu,Adwaita Sans,Cantarell,…')
-  fontFamilyFallback: [CJK family, emoji family]
+  fontFamilyFallback: [emoji family, CJK family]

Evidence

Arch Linux, system language en_US. A small entry point renders fixed sample text (English, Chinese, mixed, emoji with and without U+FE0F, CJK symbols; weights 400, 500, 700; app locale zh_CN and en_US) with the app's loadFallbackFonts() and withFallbackFonts() from each version:

Before #2070 (594e4dd^) After #2070 (594e4dd)
Before #2070 After #2070
main (77b8484) This PR
main 77b8484e This PR
  • flutter analyze: no issues. flutter test: 327 passed.

Not tested on Ubuntu.

Merge Danger

Door: two-way

Blast Radius: Linux text

Only Linux changes. With a non-English system language, the theme still uses the font family that the app loads from fc-match.

After #2070, Latin text and shared punctuation on Linux use the Noto
Sans CJK glyphs, so the dashes and quotes in Chinese text are full
width. Before #2070 the theme kept the Material fallbacks for Linux
('Ubuntu', 'Adwaita Sans', 'Cantarell', 'DejaVu Sans' and others), and
Latin text used the first installed one. #2070 replaced these
fallbacks with the CJK and emoji families. 77b8484 restored 'Roboto'
as the main family, but 'Roboto' is not installed, so the CJK family
still draws Latin text.

Resolve the Material Linux fallbacks with fc-match and use the result
as the theme family. Keep the CJK and emoji families as fallbacks. The
main family is installed, so the first layout does not search for the
missing 'Roboto'.
@YeungKC
YeungKC requested a review from cedricfung October 21, 2026 03:53
@crossle
crossle requested review from boyan01 and a balanced review from Copilot October 21, 2026 09:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change preserves existing font precedence and platform behavior, with no blocking issues identified.

No open issues 🎉

What changed in this PR

Restores Linux’s Material fallback font as the theme’s main font, correcting Latin text and punctuation rendering while retaining CJK and emoji fallbacks.

Changes:

  • Resolves an installed font from Material’s Linux fallback list.
  • Uses the same main font for theme text and font warmup, preserving loaded-font precedence.
File Description
lib/​utils/​system/​system_fonts.dart Resolves and applies the Linux main font consistently.

Review effort: Balanced

The CJK fonts have black and white glyphs for some emoji, for example
U+1F17F. With the CJK family first, these emoji lost their color, but
they were in color before #2070.
@crossle
crossle merged commit 23630dd into main Oct 23, 2026
3 checks passed
@crossle
crossle deleted the fix/linux-latin-font branch October 23, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants