Logs page renders blank when LANG is a CJK locale on Flatpak (monospace resolves to proportional Noto Sans CJK)

Aperta Adatta ai principianti
#8,107 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, typescript
Ambito
desktop, frontend

Direzione di ricerca

Inizia da packages/ui/src/composables/terminal.ts, dove secondo l’issue il terminale imposta la famiglia di caratteri generica monospace; controlla come la pagina Logs configura xterm.js e se i test vicini coprono il rendering del terminale. Riproduci il problema con un LANG CJK in Flatpak e confronta con en_US.UTF-8. Il lavoro è completato quando i log e lo stato vuoto vengono visualizzati con un locale CJK.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Please confirm the following
  • I checked the existing issues for duplicate problems
  • I have tried resolving the issue using the support portal
  • I have ensured my Modrinth App installation is up to date
What version of the Modrinth App are you using?

0.22.0 (Flathub, com.modrinth.ModrinthApp, runtime org.gnome.Platform/x86_64/49)

What operating systems are you seeing the problem on?

Linux — Fedora 44, KDE Plasma (Wayland), system locale zh_CN.UTF-8

Describe the bug

When the system/process locale is Chinese (LANG=zh_CN.UTF-8), the instance Logs page renders an entirely blank terminal, even though the logs are read successfully.

The page chrome (search box, level filters, log-source dropdown) works, and the dropdown correctly lists latest.log, crash reports, and rotated .log.gz files. Selecting any of them still leaves the terminal blank. The empty-state message/frog does not appear either, which suggests the xterm.js terminal never renders any text.

Launching the same Flatpak with LANG=en_US.UTF-8 makes the Logs page work normally, so the data/back-end side is fine — this is a rendering issue.

The same instance shows:

  • LANG=zh_CN.UTF-8: an empty white terminal area
Image
  • LANG=en_US.UTF-8: empty-state bubble and log contents render normally
Image
Steps to reproduce
  1. Use a system with LANG=zh_CN.UTF-8 (or any CJK locale), and install Modrinth App from Flathub.
  2. Open an instance that has logs (or launch the instance once so logs exist).
  3. Go to the instance Logs tab.
  4. Observe that the terminal area is completely blank, including no empty-state text.

Optional control:

flatpak run --env=LANG=en_US.UTF-8 com.modrinth.ModrinthApp

→ the Logs page renders correctly.

Expected behavior

The Logs page should display the live log / selected log file regardless of the system locale.

Additional context / root cause analysis

Inside the Flatpak sandbox, fontconfig resolves the generic monospace family differently depending on locale:

$ flatpak run --command=sh com.modrinth.ModrinthApp -c \
    'LANG=en_US.UTF-8 fc-match monospace; LANG=zh_CN.UTF-8 fc-match monospace'
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
NotoSansCJK-VF.ttc: "Noto Sans CJK SC" "Regular"

Noto Sans CJK SC is a proportional CJK font, not a monospace font. The console component hard-codes the generic family:

// packages/ui/src/composables/terminal.ts (v0.22.0)
fontFamily: 'monospace',

xterm.js requires a monospace font for its character-width measurement. When the generic monospace alias resolves to a proportional (and variable) CJK font, the terminal produces no visible output at all — not even the empty-state bubble.

Note that the actual monospace CJK font is present in the sandbox (fc-list shows Noto Sans Mono CJK SC); fontconfig just prefers the proportional Noto Sans CJK SC under zh_CN.

Workaround (app-local, does not affect other apps):

Create ~/.var/app/com.modrinth.ModrinthApp/config/fontconfig/fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test qual="any" name="family"><string>monospace</string></test>
    <edit name="family" mode="prepend" binding="strong">
      <string>DejaVu Sans Mono</string>
    </edit>
  </match>
</fontconfig>

After this, LANG=zh_CN.UTF-8 fc-match monospace inside the sandbox returns DejaVu Sans Mono and the Logs page renders again (CJK characters fall back to Noto CJK automatically).

Suggested fix: don't rely on the bare generic monospace alias for the terminal. Use an explicit monospace stack, e.g.

fontFamily: "'DejaVu Sans Mono', 'Noto Sans Mono', 'Noto Sans Mono CJK SC', 'Liberation Mono', monospace",

and/or ship a known monospace font with the app. It may also be worth checking whether xterm.js needs a guard against a resolved proportional font.

Lingua principale
Rust
Stelle
2.5k
Fork
663
Merge medio
2g 11h
PR unite (30g)
122

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modrinth/code

Tutte le issue di modrinth/code

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.