Fix: list and render installed system fonts (#4)

The font dropdown showed a hardcoded 17-name list and cells always
rendered in the built-in Calibri/role font, so a font installed on the
machine could not be listed or chosen. Both trace to one constraint:
egui panics when asked for a FontFamily::Name that was never bound to
font data, so only the 8 built-in roles were ever bound.

Scan the platform font folders for installed families (a bounded read of
each file's name table via skrifa, already compiled transitively through
epaint), bind the faces a workbook actually uses into egui as
fnt:{family}:{b|n}{i|n} roles chained to the defaults, and offer the
installed families in the font combos after the standard set. cell_family
returns the installed role when it is bound, else the previous bucketing,
so it never names an unbound family. The scan runs in the background and
the first frame that rebinds skips painting, like the existing startup
gate. Native only; wasm keeps the standard list.

Incidental: newer local clippy flagged pre-existing lints in untouched
crates (no toolchain is pinned); fixed behavior-preservingly so the gate
passes.
This commit is contained in:
justinjohn0306
2026-10-08 16:04:14 +05:30
parent c6b6f4177c
commit f654615640
17 changed files with 577 additions and 30 deletions
Generated
+2
View File
@@ -1522,12 +1522,14 @@ version = "0.1.0"
dependencies = [
"egui",
"egui_kittest",
"epaint_default_fonts",
"gridcraft-chart",
"gridcraft-engine",
"image",
"log",
"serde",
"serde_json",
"skrifa",
"toml",
]