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 <noreply@anthropic.com>
This commit is contained in:
Dominik Strebel
2026-10-22 16:02:58 +02:00
co-authored by Claude Opus 5.5
parent a1c84547e3
commit 5bcbaacce7
+6 -1
View File
@@ -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());