mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-11-06 08:15:35 +00:00
* fix(fonts): turn stroke thickening off in gpui, not through AppleFontSmoothing font_thicken: false pinned AppleFontSmoothing to 0 in the process's argument domain. That never left the process, but AppKit reads the same preference, so tty7's native menus and alerts lost their smoothing too, most visibly dark text in light mode. The terminal's own dark text looked unchanged, since gpui never thickens it in the first place. The gpui fork now exposes set_glyph_dilation, which reaches its rasterizer alone; apply_font_thicken calls that and writes no preference. A test checks that turning thickening off leaves AppleFontSmoothing alone (red on the old implementation). Fixes #1119 * test(fonts): keep the font_thicken test out of config_reload_tests' doc comment
128 lines
4.8 KiB
Plaintext
128 lines
4.8 KiB
Plaintext
---
|
||
title: "Fonts"
|
||
description: "The bundled default, fallback chains, ligatures, and why CJK needs a word."
|
||
---
|
||
|
||
**Settings → Appearance → Terminal text** covers the everyday choices; the rest is
|
||
`config.json`.
|
||
|
||
| Setting | Default | |
|
||
|---|---|---|
|
||
| **Font family** | Hack | Picked from fonts installed on your system |
|
||
| **Font size** | 15 px | The terminal grid |
|
||
| **Interface font size** | 16 px | Everything outside the grid (12–24) |
|
||
| **Interface font family** | system UI font | The face for everything outside the grid |
|
||
| **Line height** | 1.4 | A multiple of the font size |
|
||
| **Bold font** / **Italic font** | — | Distinct faces, when you want them |
|
||
| **Font ligatures** | off | `calt`, `liga` and `clig` all stay off unless you ask |
|
||
| **Thicken strokes** | on | macOS only — see [Stroke weight on macOS](#stroke-weight-on-macos) |
|
||
|
||
## Hack is bundled
|
||
|
||
The default font ships inside the binary. It renders identically on every
|
||
machine without relying on a system install, so a fresh laptop looks like the
|
||
one you set up last year.
|
||
|
||
## Fallbacks
|
||
|
||
`font_family` is the primary face; `font_fallbacks` is an ordered list tried in
|
||
turn for anything the primary lacks.
|
||
|
||
```json
|
||
{
|
||
"font_family": "JetBrains Mono",
|
||
"font_fallbacks": ["Maple Mono NF CN", "PingFang SC", "Apple Color Emoji"]
|
||
}
|
||
```
|
||
|
||
Leave `font_fallbacks` out and you get the platform's default chain:
|
||
|
||
| | Default fallbacks, in order |
|
||
|---|---|
|
||
| **macOS** | Menlo · Hasklug Nerd Font Mono · Maple Mono NF CN · PingFang SC · Apple Color Emoji |
|
||
| **Windows** | Maple Mono NF CN · Cascadia Mono · Microsoft YaHei · Segoe UI Emoji |
|
||
| **Linux** | Maple Mono NF CN · DejaVu Sans Mono · Noto Sans CJK SC · Noto Color Emoji |
|
||
|
||
Each ends in faces the host OS actually ships, and those stock names are
|
||
appended to whatever list you write yourself — so a `config.json` copied from
|
||
another platform still resolves.
|
||
|
||
## OpenType features
|
||
|
||
`font_features` passes tags straight through to the shaper:
|
||
|
||
```json
|
||
{
|
||
"font_features": { "calt": true, "liga": 1, "ss01": true, "zero": false }
|
||
}
|
||
```
|
||
|
||
A tag must be four alphanumeric characters; `true`/`false` map to `1`/`0`.
|
||
Anything malformed is skipped with a log line rather than failing the whole
|
||
config.
|
||
|
||
Writing *any* tag hands the whole feature set to you: the terminal only names
|
||
`calt: 0`, `liga: 0` and `clig: 0` itself while `font_features` is unset. So
|
||
`{"font_features": {"zero": 1}}` turns slashed zeroes on **and** ligatures back
|
||
on. Name them explicitly if you want both:
|
||
|
||
```json
|
||
{
|
||
"font_features": { "zero": 1, "calt": 0, "liga": 0, "clig": 0 }
|
||
}
|
||
```
|
||
|
||
## Stroke weight on macOS
|
||
|
||
macOS font smoothing thickens glyph strokes, and by how much depends on the
|
||
text colour: the lighter the text, the bolder it draws. That is why light text
|
||
on a dark theme can look heavier in tty7 than in a terminal that turns the
|
||
effect off, and why a thinner weight of the same family does not fully make up
|
||
for it.
|
||
|
||
**Settings → Appearance → Terminal text → Thicken strokes** (`font_thicken`)
|
||
turns it off, so glyphs draw at the face's own weight whatever their colour:
|
||
|
||
```json
|
||
{
|
||
"font_thicken": false
|
||
}
|
||
```
|
||
|
||
<Note>
|
||
The change applies the next time tty7 starts. It covers the terminal and
|
||
tty7's own interface text alone: menus and other native macOS controls, other
|
||
apps, and the system-wide setting all keep their look. Dark text is barely
|
||
thickened to begin with, so on a light theme the difference is small.
|
||
</Note>
|
||
|
||
Leaving it on changes nothing, so an existing
|
||
`defaults write com.github.tty7 AppleFontSmoothing -int 0` keeps working. This
|
||
is the same switch as Ghostty's `font-thicken` and iTerm2's thin strokes, with
|
||
tty7 defaulting to the macOS look. Windows and Linux do not thicken strokes, so
|
||
the key does nothing there.
|
||
|
||
## CJK and the two-column grid
|
||
|
||
<Info>
|
||
A cell is one advance of the primary face, and a wide (CJK) character is
|
||
pinned to exactly two of them. A CJK fallback sits flush in its slot only if
|
||
its ideographs advance **twice** the primary's Latin advance.
|
||
</Info>
|
||
|
||
Bundled Hack advances 0.60205em, so a two-column slot is 1.2041em — while every
|
||
stock CJK face (Microsoft YaHei, PingFang SC, Noto Sans CJK) advances 1.0em.
|
||
Those glyphs get left-aligned in the slot, leaving a ~0.2em gap on the right of
|
||
every character.
|
||
|
||
[Maple Mono NF CN](https://github.com/subframe7536/maple-font) is in every
|
||
platform's default chain for exactly this reason: 0.6em Latin, 1.2em CJK, an
|
||
exact two-cell fit against Hack. It leads the chain on Windows and Linux, and on
|
||
macOS sits behind Menlo and Hasklug, which cover Latin and Nerd Font glyphs
|
||
first. It is referenced by name only, never bundled (~20 MB per weight) —
|
||
install it and tty7 picks it up with no config change.
|
||
|
||
If you want CJK set *tight* rather than merely even, change the **primary** face
|
||
instead. One that advances 0.5em — Sarasa Mono SC, say — makes two columns
|
||
exactly 1.0em.
|