Chinese characters invisible on Chromium/Brave

While browsing this random issue: Bug: AI 一直循环回复总结提示,无法正常回答问题 · Issue #18096 · anomalyco/opencode · GitHub

I see that in Brave and Chromium, I cannot see characters. In Firefox and GNOME Web, I see them but are ugly. In Chrome they look OK:

I wouldn’t understand a single word of Chinese, but still I’d like to at least see something, not only whitespace, while browsing with Brave or Chromium.

Any ideas on what’s happening or how to fix it? Thanks!

2 Likes

Okay, that sucks. But, what is it? Obviously, you have some fonts for those glyphs. So that’s not it. Hey, would you mind running fc-cache -fv and restarting those browsers and trying again to see whether you get a different result?

1 Like

It’s possible firefox/gnome web/chrome are bundled with such fonts.

In fact, I’d consider this likely; noto cjk is almost definitely included in chrome, and would explain why the font looks “good” there but not elsewhere (since github uses noto, making it match closely, but likely doesn’t serve a cjk font).

1 Like

Set up fontconfig.
Mine is probably overkill but has pretty decent coverage.
(I wanted more langs + math symbols.)

The “Source Han *” fonts provide the CJK coverage here.

{ pkgs, ... }:
{
  fonts = {
    enableDefaultPackages = false;

    fontconfig = {
      defaultFonts =
        let
          _fallbacks = [
            "Symbols Nerd Font"
            "Nom Na Tong"
            "Lohit Bengali"
            "Lohit Assamese"
            "Lohit Devanagari"
            "Lohit Kannada"
            "Lohit Malayalam"
            "Lohit Tamil"
            "Scheherezade New"
            "Nafees Nastaleeq"
            "Noto Color Emoji"
          ];
        in
        {
          monospace = [
            "Source Code Pro Medium"
            "Source Han Mono"
          ]
          ++ _fallbacks;
          sansSerif = [
            "Source Sans"
            "Source Han Sans"
          ]
          ++ _fallbacks;
          serif = [
            "Source Serif"
            "Source Han Serif"
          ]
          ++ _fallbacks;
        };
    };

    packages = attrValues {
      inherit (pkgs)
        nafees
        nomnatong
        noto-fonts-color-emoji
        scheherazade-new
        source-code-pro
        source-han-mono
        source-han-sans
        source-han-serif
        source-sans
        source-serif
        unifont
        xits-math
        ;

      inherit (pkgs.lohit-fonts)
        assamese
        bengali
        devanagari
        kannada
        malayalam
        tamil
        ;
    };
  };
}
3 Likes