From 3cffb782c2dd7808294e8632acfee017710a9b22 Mon Sep 17 00:00:00 2001 From: Yotam Date: Fri, 17 Jul 2026 11:25:45 +0900 Subject: [PATCH] Fix spaced-out terminal text on Windows: put a Latin monospace before the CJK fallbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows none of the Mac/Linux monospace fonts in the stack are installed, so the first font that resolves is Malgun Gothic (the Windows Korean UI font). xterm.js sizes its character cell from that font's advance width, and Malgun Gothic advances Latin glyphs in a full-width CJK cell — doubling every cell and rendering the whole terminal (and the sidepanel mono UI) as spaced-out text. Insert Consolas (present on every Windows install) and the Cascadia faces ahead of the CJK fonts in both the xterm fontFamily and the --font-mono CSS var. The CJK fonts stay last for actual CJK coverage. No bundled font, no user install needed. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01GKj8Nr8T4GvryTcWBJRMyC --- extension/sidepanel-terminal.js | 8 +++++++- extension/sidepanel.css | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/extension/sidepanel-terminal.js b/extension/sidepanel-terminal.js index e6287abca..bf041d412 100644 --- a/extension/sidepanel-terminal.js +++ b/extension/sidepanel-terminal.js @@ -391,7 +391,13 @@ function ensureXterm() { if (term) return; term = new Terminal({ - fontFamily: '"JetBrains Mono", "SF Mono", Menlo, "Noto Sans Mono CJK KR", "Malgun Gothic", monospace', + // Windows Latin monospace (Consolas, always present; Cascadia ships with Terminal/VS) + // MUST precede the CJK fallbacks: xterm sizes the character cell from the first + // resolved font's advance width, and Malgun Gothic (the Windows Korean UI font, the + // first that resolves here when the Mac/Linux fonts are absent) advances Latin glyphs + // in a full-width CJK cell — doubling every cell into spaced-out text. The CJK fonts + // stay last for actual CJK glyph coverage. + fontFamily: '"JetBrains Mono", "SF Mono", "Cascadia Mono", "Cascadia Code", Consolas, Menlo, "DejaVu Sans Mono", "Noto Sans Mono CJK KR", "Malgun Gothic", monospace', fontSize: 13, theme: { background: '#0a0a0a', foreground: '#e5e5e5' }, cursorBlink: true, diff --git a/extension/sidepanel.css b/extension/sidepanel.css index 0bc306b25..69fe81106 100644 --- a/extension/sidepanel.css +++ b/extension/sidepanel.css @@ -38,7 +38,9 @@ /* Typography */ --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; - --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', 'Noto Sans Mono CJK KR', 'Malgun Gothic', monospace; + /* Consolas (always on Windows) before the CJK fallbacks — else Latin text resolves to + Malgun Gothic and renders full-width/spaced-out. Same fix as the xterm fontFamily. */ + --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Mono', 'Cascadia Code', Consolas, 'DejaVu Sans Mono', 'Noto Sans Mono CJK KR', 'Malgun Gothic', monospace; /* Radius */ --radius-sm: 4px;