Use the desktop's own monospace font in the terminal
Read org.gnome.desktop.interface monospace-font-name at startup rather than hardcoding a family, so the terminal matches GNOME Terminal exactly and keeps matching after the system font changes. Pango reports points and CSS wants pixels, so 13 becomes 17.33px — rendering it as 13px made the terminal a third too small, which reads as the wrong font rather than the wrong size. The size is the trailing number, since families may contain digits. Families are always quoted, because an unquoted "Noto Sans Mono" is a three-family stack to CSS. Also fixes tests/dial.test.ts, which hardcoded the test server's fingerprint and so went red after every /tmp cleanup. It now asks ssh-keygen, which is a stronger assertion anyway: the expected value comes from the reference implementation rather than from this project's own fingerprint code.
This commit is contained in:
@@ -343,6 +343,30 @@ Bytes cross as `Uint8Array`, never as a string. TCP splits UTF-8 characters
|
||||
across chunks routinely, and decoding either half alone corrupts them; the bug
|
||||
appears only with CJK or emoji output, which makes it easy to miss.
|
||||
|
||||
### Terminal font
|
||||
|
||||
The terminal uses **the desktop's own monospace font**, read from
|
||||
`org.gnome.desktop.interface monospace-font-name` at startup. GNOME Terminal
|
||||
defaults to `use-system-font`, so this is literally the same font rather than a
|
||||
lookalike — and it stays the same font after someone changes their system
|
||||
setting, which a hardcoded family would not.
|
||||
|
||||
Two details that are easy to get wrong:
|
||||
|
||||
- **Pango reports points, CSS wants pixels.** A `13` from GSettings is 13pt, and
|
||||
rendering it as 13px makes the terminal a third too small — which reads as
|
||||
"the font is wrong" rather than "the size is wrong". The conversion is 96/72.
|
||||
- **The size is the *trailing* number.** Families legitimately contain digits
|
||||
(`Fira Code 2` is a family), so splitting on the first number would be wrong.
|
||||
|
||||
The family is always quoted in the CSS value. An unquoted `Noto Sans Mono` is a
|
||||
*stack* of three families as far as CSS is concerned, and the terminal would
|
||||
silently fall back to something else.
|
||||
|
||||
A desktop that will not answer — not GNOME-based, or no `gsettings` — falls back
|
||||
to `ui-monospace`, which asks the engine for the system monospace face. Same
|
||||
request, resolved one layer down.
|
||||
|
||||
### Reconnecting
|
||||
|
||||
When a transport drops, the `Session` survives and only the backend beneath it
|
||||
|
||||
Reference in New Issue
Block a user