use freetype for font display

This commit is contained in:
2026-08-01 15:03:55 +02:00
parent 4a08d19365
commit f5a0b6136f
11 changed files with 605 additions and 292 deletions
+9 -4
View File
@@ -191,9 +191,13 @@ onto a tag nobody is viewing leaves both the order and focus alone.
**tabbed** — same geometry as monocle, minus a strip at the top where att_wm
draws one tab per window, the focused one highlighted. Each tab is clickable and
carries the window's title, elided with an ellipsis when the tab is too narrow.
Titles are drawn in a 5x8 bitmap font built into the binary (`src/font.zig`) —
a font stack for one strip of pixels would be a poor trade — scaled by whole
pixels to suit `tabbar_height`, or by `tab_font_scale` if you would rather say.
Titles are drawn with FreeType in whatever font the fontconfig pattern
`tab_font` matches (`"sans:size=11"` by default, so `fc-match 'sans:size=11'`
shows what you will get), antialiased and subpixel positioned, shrunk to fit
when `tabbar_height` leaves no room for the size asked for. Codepoints the
matched font has no glyph for send att_wm back to fontconfig for one that does,
so a CJK or emoji title is not a row of boxes; there is no shaping, so scripts
that need it come out as unjoined letters.
The same window list is published over IPC, so a bar can draw its own tab strip
alongside (the bundled quickshell config does). Set `tabbar_height = 0` to drop
the built-in strip entirely and let the bar own it.
@@ -492,7 +496,8 @@ river's identifier is shared between them.
| `src/config.zig` | Compile-time configuration |
| `src/ipc.zig` | Socket server and JSON encoding |
| `src/shm.zig` | memfd buffers for the tab bar, and drawing into them |
| `src/font.zig` | The built-in 5x8 bitmap font — no Wayland, unit tested |
| `src/Face.zig` | The tab bar's font: fontconfig matching, FreeType rasterising |
| `src/font.zig` | Measuring and eliding titles — no font needed, unit tested |
| `src/sys.zig` | Thin Linux syscall wrappers |
The single most important invariant: **river only permits window management