Web build: ask for the interface language's font when the manifest arrives

serve_fonts asks for the interface language's served script font once per
language, but the font manifest loads asynchronously: when the first frame
ran before it arrived, no fallback was registered yet, the request found
nothing, and an Arabic interface on an English browser stayed without its
font until the language changed. The manifest load now asks for the
interface language's font along with the browser languages'.

Review finding on #10006.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
David MannandClaude Opus 5.5 committed 2026-10-28 23:41:38 +01:00
1 parent 250940a4f5
commit 71dda79330
1 file changed
+4 -1
+4 -1
View File
@@ -224,7 +224,10 @@ fn load_font_manifest(served: Served, ctx: egui::Context) {
served_fonts::add_fonts(&fonts);
// Fetch now the fallbacks of the scripts the browser's languages use (an Arabic reader gets
// the Arabic font before typing); the rest is fetched when text or a font menu needs it.
served_fonts::request_for_languages(browser_languages().iter().map(String::as_str));
// Also the interface language's: `serve_fonts` asked for it once already, maybe before
// this manifest arrived, when no fallback was registered yet.
let ui_language = photocraft_ui_egui::i18n::current().code();
served_fonts::request_for_languages(browser_languages().iter().map(String::as_str).chain([ui_language]));
ctx.request_repaint();
});
}