Files
Kai Evans f6012a5a8d Interface font: bold and medium text use the heavier weight files beside the chosen font file (#12135)
A chosen `Family-Weight.ttf` (or `.otf`) file now brings in its heavier
siblings: the files of the same family in its folder. They lead the medium,
semibold, and bold families, nearest weight first, never a lighter one.
`heavier_faces` reads the folder (at most 4096 entries) and maps weight
suffixes to numbers. It loads the first readable candidate per family.
`with_ui_font_faces` puts each face ahead of the chosen one in its family.
A plain choice drops them again. An installed family name, the built-in
font, and the web app are unchanged. Each keeps one face per weight. Tests: 3 new (2 in ui-egui
fonts, 1 in sketch fonts).
2026-11-12 17:57:25 +00:00

3.4 KiB

Interface fonts

SolidCraft bundles IBM Plex Sans as its default interface font on desktop and web. The unmodified variable font provides regular (400), medium (500), semibold (600) and bold (700) faces. Titles and selected labels use semibold; compass letters and the primary OK action use bold. Selection fields and status messages use medium. Numeric fields and sketch dimensions use IBM Plex Mono Regular.

Both fonts are licensed under the SIL Open Font License 1.1. Their licence texts are in crates/look/fonts/ibm-plex-sans/OFL.txt and crates/look/fonts/ibm-plex-mono/OFL.txt; provenance is recorded in ATTRIBUTION.md.

The ui_font preference puts the chosen font first in every sans family. The three weighted families take a heavier sibling file first when one is there (below). Without one, a chosen static font keeps its own weight; SolidCraft does not simulate bold by drawing text twice. Clearing the preference restores Plex. Monospace fields keep Plex Mono.

A chosen font file named Family-Weight.ttf (or .otf), such as IosevkaAile-Extralight.ttf, brings its heavier sibling files from the same folder into the weighted families, nearest weight first:

Family Uses
medium Medium, else SemiBold, else Bold
semibold SemiBold, else Bold, else Medium
bold Bold, else SemiBold, ExtraBold, Heavy/Black, else Medium

Weight suffixes match case-insensitively, with the usual spellings (Semibold, DemiBold, Extrabold, Ultralight, …). A sibling lighter than the chosen file is never used. Where the chosen file is itself the nearest weight, or none of the listed weights is there, the family keeps the chosen face: with Extralight and Medium beside each other, bold text uses Medium. Italic files and other families in the folder are ignored. A font family name, and the web app, keep one face for every weight.

Egui's symbol and emoji fallbacks remain available. Desktop also appends the available Japanese/Chinese, Hangul and Thai system fonts to every family, ordered for the selected language. The web app installs Plex at startup and adds its bundled Japanese font asynchronously when needed, preserving the interface faces and any font preference.

Type scale and metrics

Text sizes come from theme::Tokens, with identical values in the light and dark palettes in crates/theme/src/palettes.rs. The compact scale runs from font_badge (9.5 pt) through font_heading (14 pt). Special roles preserve the existing designs: font_triad (8), font_compass (13.5), font_subtitle (15), font_intro (16), font_article_heading (17), font_title (22), and font_display (26). Scaled labels derive from these tokens. Weight helpers in ui_kit/type_face.rs (the kit's type API, which holds no font data) choose the family independently of size; fonts.rs embeds and installs the faces.

Dense forms also use tokens for control height/radius, label width, row gap, header/footer/card dimensions, icons, text insets, checkbox and action heights, and section letter spacing. Existing space_* tokens supply shared padding. The font_literals_tests source guard scans production Rust, including the viewport icon sources, and rejects numeric font sizes, private font families outside ui_kit/type_face.rs, and direct dense-form spacing literals. Its small per-file allowance table documents graphic spinner diameters; it permits no text sizes. Run it with cargo test -p solidcraft-ui-egui --lib font_literals_tests.