Firefox font rendering on CJK characters totally borken in pre block

  • NixOS version 24.05.20240507.b211b39 (Uakari)
  • Firefox version 125.0.3 (x64)
  • fontconfig is configured through system’s configuration.nix only, the related fragment is somehow like:
    fonts.fontconfig.hinting.style = "full"; #1
    fonts.fontconfig.hinting.enable = true;
    fonts.fontconfig.defaultFonts = {
     # ...
    monospace = ["Sarasa Mono SC"] # from pkgs.sarasa-gothic
     # ...
    };
    

Then:

  • Note: rendering is also broken in firefox’s inspector
  • source code:
    <body>
    <pre>这是一些中文字符ここにいくつかの日本語の文字があります</pre>
    </body>
    

the second character(“是”) is squeezed which is abnormal:
2024-05-12_06-30_1

All extensions are disabled.

  • Note: if I alter the hinting.style in #1 to “slight” (defaulted value) then everything is OK.
  • I’m not sure is this a firefox’s issue or nix’s, since Chromium has no such issue.