You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Default font stack falls back to PingFang SC before Menlo on macOS, causing wide letter spacing #22
On macOS, the terminal renders Latin text with very wide letter spacing (e.g. r o o t @ c o d e r), and the glyphs are clearly not a monospace font.
Cause
DEFAULT_FONT_FAMILY in src/prefs.ts lists CJK fonts before the macOS monospace fonts:
"Cascadia Mono", Consolas, "DejaVu Sans Mono", "Liberation Mono", "Noto Sans Mono",
"Noto Sans Mono CJK JP", "Noto Sans CJK JP", "Microsoft YaHei", "MS Gothic", Meiryo,
"PingFang SC", "Hiragino Sans GB", "Noto Color Emoji", Menlo, Monaco, "Courier New", monospace
A stock macOS install has none of the first five fonts, but it does have PingFang SC, so the browser falls back to PingFang (a proportional font) before reaching Menlo. xterm.js sizes each cell from the widest glyph, so narrow letters end up surrounded by large gaps.
The same can happen on Windows with Microsoft YaHei if Cascadia Mono / Consolas are missing.
Suggested fix
Put all monospace fonts ahead of the CJK fallbacks, e.g.:
exportconstDEFAULT_FONT_FAMILY='"Cascadia Mono", Consolas, "SF Mono", Menlo, Monaco, "DejaVu Sans Mono", "Liberation Mono", '+'"Noto Sans Mono", "Courier New", "Noto Sans Mono CJK JP", "Noto Sans CJK JP", "Microsoft YaHei", '+'"MS Gothic", Meiryo, "PingFang SC", "Hiragino Sans GB", "Noto Color Emoji", monospace';
It would also help to expose a font-family field in the settings popover (currently only font size is adjustable; fontFamily can only be changed by editing localStorage['web-terminal-prefs']).
Activity