From 5bcbaacce7a9de54c4bd2960f25998a2ecc6a8bb Mon Sep 17 00:00:00 2001 From: Dominik Strebel Date: Thu, 22 Oct 2026 16:02:58 +0200 Subject: [PATCH] Snapshot: catalog installed fonts before rendering The offscreen snapshot never started the background font scan the app runs from its first frame, so a workbook's installed fonts (Helvetica Neue, say) were drawn in the Calibri substitute. Catalog them up front and run a few more frames so they bind, as in the app. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/examples/snapshot.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/examples/snapshot.rs b/crates/ui-egui/examples/snapshot.rs index dcee71173..9eb3cc69c 100644 --- a/crates/ui-egui/examples/snapshot.rs +++ b/crates/ui-egui/examples/snapshot.rs @@ -79,6 +79,9 @@ fn main() { } i += 1; } + // Catalog the installed fonts first (the app scans in the background from its first frame), so + // the workbook's fonts are drawn in their own faces, not a substitute. + let _ = gridcraft_ui_egui::fonts::catalog(); let mut session = Session::new(); if let Some(p) = &input { session.execute("file.open", json!({"path": p})).expect("open"); @@ -127,7 +130,9 @@ fn main() { app }, ); - harness.run_steps(8); + // The workbook's installed fonts bind once the font scan is done; frames past the first few + // apply them, so the snapshot shows them as the app does. + harness.run_steps(14); let img = harness.render().expect("render"); img.save(&out).expect("save png"); eprintln!("wrote {out} ({}x{})", img.width(), img.height());