Skip to content

Update default system font stack to better handle CJK locales on Windows#3729

Merged
delucis merged 5 commits intomainfrom
chris/fix-3721
Mar 11, 2026
Merged

Update default system font stack to better handle CJK locales on Windows#3729
delucis merged 5 commits intomainfrom
chris/fix-3721

Conversation

@delucis
Copy link
Copy Markdown
Member

@delucis delucis commented Feb 25, 2026

Description

Todo

We should try to test on a broad range of browsers and devices:

macOS
  • macOS — English (@HiDeoo & @delucis)
    • Chrome (v145): Tested pages in various languages on an English-language macOS (15.7.3 and 26.3) install, no visual change after this PR
    • Firefox (v148): Same as above
    • Edge (v145): Same as above
    • Safari (v26.2): Same as above
Windows
  • Windows 10 Pro — English (@HiDeoo)
    • Chrome (v145): Tested pages in various languages, no visual change after this PR
    • Firefox (v147): Same as above
    • Edge (v145): Same as above
  • Windows — Japanese (@mehm8128 and @tats-u)
    • 🚨✅ Japanese characters are now displayed with Segoe UI instead of system-ui (see comment)
    • 🚨✅ Firefox: Simplified Chinese characters are now displayed correctly on a Japanese machine (see comment)
  • Windows 11 — Simplified Chinese (@tsavpyn)
    • 🚨✅ Firefox (v147): Latin fontface has changed, Simplified Chinese is unchanged, Japanese characters are now displayed correctly, e.g. image instead of image (see comment)
iOS
  • iOS 26.3 — English (@HiDeoo)
    • Safari (v26.3): Tested pages in various languages, no visual change after this PR
  • ipadOS 26.3 — English (@HiDeoo)
    • Safari (v26.3): Tested pages in various languages, no visual change after this PR
Linux
  • Endeavour OS virtual machine hosted on Windows — English (English host) (@HiDeoo)
    • Firefox (v146): Tested pages in various languages, no visual change after this PR
    • Chrome (v145): Same as above
  • Fedora 43 virtual machine hosted on Windows - English (English host) (@HiDeoo)
    • Firefox (v147): Tested pages in various languages, no visual change after this PR
    • Chrome (v145): Same as above
  • Ubuntu 24.04.4 virtual machine hosted on Windows - English (English host) (@HiDeoo)
    • 🚨❓ Firefox (v147): Tested pages in various languages, some visual change after this PR (see comment)
    • 🚨❓ Chrome (v145): Same as above
Android
  • Android 11 (old!) — English (@delucis)
    • Chrome: Tested pages in various languages, no visual change after this PR
    • Firefox: Same as above

I would love help testing this! I don’t have Windows/Linux boxes to test on personally. And testing on machines in CJK locales would be particularly useful.

To test, you can compare the deploy preview for this PR with the live Starlight docs. Check if appearance of fonts change in multiple languages and note any differences if there are any.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 25, 2026

🦋 Changeset detected

Latest commit: b3af8d3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 25, 2026

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit b3af8d3
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/69b12eef204b1a0008296302
😎 Deploy Preview https://deploy-preview-3729--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented Feb 25, 2026

size-limit report 📦

Path Size
/index.html 5.61 KB (+0.04% 🔺)
/_astro/*.js 26.03 KB (0%)
/_astro/*.css 16.05 KB (-0.02% 🔽)

@HiDeoo
Copy link
Copy Markdown
Member

HiDeoo commented Feb 25, 2026

Here are all the tests I could perform:

  • macOS 26.3 - English
    • Chrome (v145): Tested pages in various languages, no visual change after this PR
    • Firefox (v147): Same as above
    • Safari (v26.3): Same as above
  • Windows 10 Pro - English
    • Chrome (v145): Tested pages in various languages, no visual change after this PR
    • Firefox (v147): Same as above
    • Edge (v145): Same as above
  • iOS 26.3 - English
    • Safari (v26.3): Tested pages in various languages, no visual change after this PR
  • ipadOS 26.3 - English
    • Safari (v26.3): Tested pages in various languages, no visual change after this PR
  • Endeavour OS virtual machine hosted on Windows - English (English host)
    • Firefox (v146): Tested pages in various languages, some visual change after this PR

Sharing here screenshots of the visual change observed in Firefox on Endeavour OS virtual machine:

Language Before After
en en-before en-after
ja ja-before ja-after
zh-cn zh-cn-before zh-cn-after

@delucis
Copy link
Copy Markdown
Member Author

delucis commented Feb 25, 2026

Sharing here screenshots of the visual change observed in Firefox on Endeavour OS virtual machine:

Very interesting! The Latin font change seems like an improvement aesthetically maybe? Hard to tell tbh. I’d be curious why it changes here, what the before/after fonts are, and whether we could/should handle them differently?

@HiDeoo
Copy link
Copy Markdown
Member

HiDeoo commented Feb 25, 2026

Very interesting! The Latin font change seems like an improvement aesthetically maybe? Hard to tell tbh. I’d be curious why it changes here, what the before/after fonts are, and whether we could/should handle them differently?

Yeah, I am planning more investigations tomorrow morning but had to run for today. I'll share here my findings.

Regarding the actual changes, difficult to say, but I think the "before" is closer to what I'm currently seeing on all other OS?

@mehm8128
Copy link
Copy Markdown
Contributor

mehm8128 commented Feb 26, 2026

Hi, I'm Japanese and Windows user. I confirmed that the proper font is applied in Japanese.
If there is other check list that I should check the preview site, I'll check them.!

before after
top page image image
document page image image

@tats-u
Copy link
Copy Markdown
Contributor

tats-u commented Feb 26, 2026

After:

(Japanese + Firefox + sans-serif = Source Han Sans VF ≒ Noto Sans CJK)

image

I think it's fine as long as it's within the scope of simple adjustments.

FYI: (Windows + Chrome + additional manual adjustments (word-break: auto-phrase + font-feature-settings: "palt") for <h1> here + sans-serif = Noto Sans JP)

image

We do not need to add these properties to this PR, I think.

@tsavpyn
Copy link
Copy Markdown
Contributor

tsavpyn commented Feb 26, 2026

Firefox 147.0.4, Windows 11 25H2, zh-CN

Language Production Preview
zh-cn Production in zh-cn Preview in zh-cn
ja Production in ja Preview in ja
en Production in en Preview in en

I have fonts preferences default on browser except having mono font set to JetBrains Mono.

Site Language Character Font Displayed in Preview Font Displayed in Production
zh-cn CJK Microsoft YaHei Microsoft YaHei
zh-cn Latin Segoe UI Microsoft YaHei
ja CJK Yu Gothic Microsoft YaHei
ja Latin Segoe UI Microsoft YaHei
en Latin Segoe UI Microsoft YaHei

Microsoft YaHei is the default font for UI and texts in Simplified Chinese Windows systems.
p.s. I have Noto Sans SC installed but since the variable --__sl-font does not include Noto Sans SC but Noto Sans, it is not applied to the site and yet the production site still appears in Microsoft YaHei in any language.

@tats-u
Copy link
Copy Markdown
Contributor

tats-u commented Feb 26, 2026

it is not applied to the site

It is because Firefox has ridiculously declined to adopt Noto Sans CJK fonts unlike Chromium and is just a expected behavior. FYI, in Japanese sites, Meiryo (Firefox) or Noto Sans JP (Chromium) instead of Yu Gothic will be used after you install Japanese Supplemental Fonts:

Add-WindowsCapability -Online -Name "Language.Fonts.Jpan~~~und-JPAN~0.0.1.0"

This has already been installed in all Japanese Windows machines.

While Yu Gothic is a high-quality font, it can be challenging to fully leverage its potential.

yet the production site still appears in Microsoft YaHei in any language.

It depends on the browser's or OS's preferred languages. If no CJK language is in the list, a Simplified Chinese font, namely Microsoft YaHei (UI), will be assigned. In my environment, Japanese is at the top, so Yu Gothic UI is assigned instead.

@tats-u
Copy link
Copy Markdown
Contributor

tats-u commented Feb 26, 2026

Endeavour OS seems to use the monolithic Noto Sans CJK font as the fallback CJK font in its UI. Linux-based OSes are not affected by this problem as long as they adopt Noto CJK fonts as their UI fonts. However, some cellphone manufacturers seem to adopt other Chinese-or-Japanese-dedicated fonts as UI fonts and trigger this bug.

Do you know what fonts are designated for the sans-serif in Firefox and the default UI font in your Endeavour OS? Have you ever been changed them since install?

@HiDeoo
Copy link
Copy Markdown
Member

HiDeoo commented Feb 26, 2026

Investigated a little bit more.

First, to explain how it works on Linux (at least on EndeavourOS), is that the /etc/fonts/conf.d directory will contains files or symlinks to files that contain XML configuration with different priorities that mostly define font aliases. Such configuration can be tested using the fc-match command, e.g. fc-match "Courier" will return the font that will be used when "Courier" is requested, depending on the configured aliases and font availability.

Current website

The font used for the latin characters is "Noto Sans".

With our previous font stack (before this PR), the first match found is system-ui in a /etc/fonts/conf.d/60-latin.conf file:

<!--
  system-ui
-->
<alias>
  <family>system-ui</family>
  <prefer>
    <family>Adwaita Sasns</family>
    <family>Cantarell</family>
    <family>Noto Sans UI</family>
    <family>Segoe UI</family>
    <family>Segoe UI Historic</family>
    <family>Segoe UI Symbol</family>
  </prefer>
</alias>

On a default EndeavourOS installation, the first installed font that matches this alias is "Noto Sans".

Deploy preview

The font used for the latin characters is "Liberation Sans".

With the new font stack (from this PR), the first match found is Arial in a /etc/fonts/conf.d/30-metric-aliases.conf file:

<!-- Microsoft -->
<alias binding="same">
  <family>Arial</family>
  <accept>
    <family>Arimo</family>
    <family>Liberation Sans</family>
    <family>Albany</family>
    <family>Albany AMT</family>
  </accept>
</alias>

On a default EndeavourOS installation, the first installed font that matches this alias is "Liberation Sans" and as Arial is defined right before 'Noto Sans in the font stack, it is the one that is now used.

Following that logic, I also tested installing Chrome on EndeavourOS and the behavior is the same: the difference is also visible and the same font are used before and after compared to Firefox.

@tats-u
Copy link
Copy Markdown
Contributor

tats-u commented Feb 26, 2026

I see. I think Arial could be stripped or less of a priority nowadays. (Windows → Segoe UI / Apple → -apple-system)

@tats-u
Copy link
Copy Markdown
Contributor

tats-u commented Feb 26, 2026

As I expected, a Chinese font (YaHei or Source Han Sans) is now used even in Japanese Windows (Firefox):

image

Chrome:

image

@delucis
Copy link
Copy Markdown
Member Author

delucis commented Feb 26, 2026

As I expected, a Chinese font (YaHei or Source Han Sans) is now used even in Japanese Windows (Firefox):

@tats-u Is this in the deploy preview? So it’s a problem with this PR?

@tats-u
Copy link
Copy Markdown
Contributor

tats-u commented Feb 26, 2026

This is an expected behavior in the Preview of this PR. It is a Chinese page.

@delucis
Copy link
Copy Markdown
Member Author

delucis commented Feb 26, 2026

This is an expected behavior in the Preview of this PR. It is a Chinese page.

Oh, great, perfect — thank you! Confused myself after looking at so many screenshots 😄

Thank you to everyone who has been sharing. It is very helpful!

@HiDeoo
Copy link
Copy Markdown
Member

HiDeoo commented Feb 27, 2026

Here are more results following the change from 069ec02:

  • Endeavour OS virtual machine hosted on Windows - English (English host)
    • Firefox (v146): Tested pages in various languages, no visual change after this PR
    • Chrome (v145): Same as above
  • Fedora 43 virtual machine hosted on Windows - English (English host)
    • Firefox (v147): Tested pages in various languages, no visual change after this PR
    • Chrome (v145): Same as above
  • Ubuntu 24.04.4 virtual machine hosted on Windows - English (English host)
    • Firefox (v147): Tested pages in various languages, some visual change after this PR
    • Chrome (v145): Same as above

Sharing here screenshots of the visual change observed in Firefox and Chrome on the Ubuntu 24.04.4 virtual machine:

Language Before After
en en-before en-after
zh-cn zh-cn-before zh-cn-after
  • Current website: the font used for the latin characters is "Ubuntu Sans".
  • Deploy website: the font used for the latin characters is "Noto Sans".

In this case, this is explained by Ubuntu/Gnome overriding system-ui to include the Gnome default font, which is "Ubuntu Sans". In the deploy preview, system-ui is no longer used so we fall back in the stack until we reach "Noto Sans", like on the other distributions I tested.

@delucis
Copy link
Copy Markdown
Member Author

delucis commented Feb 27, 2026

In this case, this is explained by Ubuntu/Gnome overriding system-ui to include the Gnome default font, which is "Ubuntu Sans". In the deploy preview, system-ui is no longer used so we fall back in the stack until we reach "Noto Sans", like on the other distributions I tested.

This seems like an acceptable change I guess? In theory, we could add Ubuntu Sans to the font stack, but I did a quick search and this does not seem to be a common thing people do, so probably not necessary.

@tats-u
Copy link
Copy Markdown
Contributor

tats-u commented Feb 27, 2026

It would be endless if we were to list every default UI font for each OS individually.

@HiDeoo
Copy link
Copy Markdown
Member

HiDeoo commented Feb 27, 2026

This seems like an acceptable change I guess? In theory, we could add Ubuntu Sans to the font stack, but I did a quick search and this does not seem to be a common thing people do, so probably not necessary.

From the quick research I did, yeah, I came to the same conclusion and I think this may be acceptable.

@liruifengv
Copy link
Copy Markdown
Member

The font in zh-cn looks great together

@tats-u
Copy link
Copy Markdown
Contributor

tats-u commented Feb 28, 2026

@liruifengv What is your OS? Have you tweaked the font config in your browser? Probably it's the behavior I expect.

@liruifengv
Copy link
Copy Markdown
Member

liruifengv commented Mar 1, 2026

@liruifengv What is your OS? Have you tweaked the font config in your browser? Probably it's the behavior I expect.

MacOS and Windows. I don't remember if I changed the font.

MacOS:
image

Windows:
image

Windows Chrome config:
image

@tats-u
Copy link
Copy Markdown
Contributor

tats-u commented Mar 1, 2026

@liruifengv Thank you. It is the behavior that we exactly expect.

Windows Chrome config:

Probably you have not changed them. Noto is default in Chromium-based browsers if installed. Windows bundles Noto fonts that match with your language. Those of the other languages are required to be manually appended: https://learn.microsoft.com/windows/deployment/windows-missing-fonts?pivots=windows-11 (Noto are not listed there but probably included)

HiDeoo
HiDeoo previously approved these changes Mar 5, 2026
Copy link
Copy Markdown
Member

@HiDeoo HiDeoo left a comment

Choose a reason for hiding this comment

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

After all this testing, I think we've landed up on a great set of changes providing good improvements.

Thanks everyone for all the tests and feedback 🙌

@delucis delucis added the ✅ approved Pull requests that have been approved and are ready to merge when next cutting a release label Mar 5, 2026
@delucis delucis merged commit 3642625 into main Mar 11, 2026
16 checks passed
@delucis delucis deleted the chris/fix-3721 branch March 11, 2026 09:04
@astrobot-houston astrobot-houston mentioned this pull request Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✅ approved Pull requests that have been approved and are ready to merge when next cutting a release 🌟 core Changes to Starlight’s main package 🌟 minor Change that triggers a minor release

Projects

None yet

7 participants