summaryrefslogtreecommitdiffstats
path: root/desktop/modules/fonts/README.md
blob: b88706004b3c50a08f3fa58e76cd38270dbc46cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# fonts

One pixel size for the desktop, in the settings window under Appearance >
Fonts, and an override wherever a system needs its own. Saved as
`~/.config/keystone/fonts.json`:

    { "base": 16, "override": { "qt": 18.67, "rofi:kf-launcher-entry": 22 } }

Everything is stored in px. At scale 1 Wayland's logical DPI is 96
(`gtk-xft-dpi` reads 98304, 96 * 1024), so a point is 4/3 of a pixel and
16 px is 12 pt. Each system is written in its own unit:

| System | Written to | Unit | Seen |
| --- | --- | --- | --- |
| Quickshell | `Theme.fontSize` reads `fonts.json` itself | px | at once |
| Qt | `qt6ct.conf`, `qt5ct.conf`, `general=` and `fixed=` size field | pt | when an app starts |
| GTK | gtk-3.0 and gtk-4.0 `settings.ini`, `.gtkrc-2.0`, gsettings `font-name` | pt | at once for GTK 3 and 4 |
| kitty | `~/.config/keystone/kitty-fonts.conf`, included last by `kitty.conf`; SIGUSR1 reloads | pt | at once |
| Hyprland groupbar | `group:groupbar:font_size` line in `keystone.lua` | px | at once |
| rofi | `~/.config/keystone/rofi-fonts.rasi`, imported by udt's `common.rasi` | pt | next open |
| hyprlock | `~/.config/keystone/hyprlock-fonts.conf`, sourced by `hyprlock.conf` | pt | next lock |

Qt and GTK files are edited in place, size only; the family stays what it
is. unified-desktop-theme's templates no longer carry those keys, so a
re-install does not undo the page. Hyprland's text is pixels
(`pango_font_description_set_absolute_size`), hyprlock's points
(`pango_font_description_set_size`).

rofi and hyprlock are sections: sets of designed sizes that scale together.
Every rofi font in the udt files is `var(kf-<file>-<selector>, "Family N")`,
and every hyprlock label is `font_size = $kf_<label>` over an inline `$kf_...
= N`. The designed value is the fallback, used when the generated file is
absent, and it is also where the page reads the design from, so a new entry
in either file shows up on the page by itself. A section's size is its body
text, the smallest designed entry; every entry keeps its ratio to that unless
given its own size.

With no `fonts.json`, the page starts from what the files say: base 16 px,
and an override for every system at its current size, so the first save
changes nothing.

Not handled: font families; the hard-coded `pixelSize` values in the shells
(21 of them), which do not follow `Theme.fontSize`; and a `keystone.lua`
save from this page and the Options page at the same moment, which can drop
one line.

## Check

    node desktop/modules/fonts/test_fonts.js