From 8a604cbecaca6dc7ae546de6c271c28b03cbd3a6 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sun, 1 Nov 2026 17:43:08 +0700 Subject: [PATCH] Build without the Latin font catalog when craft-fonts predates it --- crates/ui-egui/build.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/build.rs b/crates/ui-egui/build.rs index 1fff0a01..9383827c 100644 --- a/crates/ui-egui/build.rs +++ b/crates/ui-egui/build.rs @@ -11,8 +11,10 @@ use std::path::PathBuf; const MANIFESTS: &[(&str, Faces, Faces)] = &[ ("fonts/manifest.txt", &[("BIZ UDPGothic", "Regular"), ("Noto Sans CJK SC", "Regular")], &[("BIZ UDPGothic", "Regular")]), // The interface font: one variable file for every weight (0.5 MB), and the numbers' face. - ("fonts/latin-manifest.txt", LATIN, LATIN), + (LATIN_MANIFEST, LATIN, LATIN), ]; +/// Newer than the core catalog: a checkout without it keeps the default interface font. +const LATIN_MANIFEST: &str = "fonts/latin-manifest.txt"; const LATIN: Faces = &[("IBM Plex Sans", "Variable"), ("IBM Plex Mono", "Regular")]; /// (family, style) pairs of a manifest. type Faces = &'static [(&'static str, &'static str)]; @@ -41,6 +43,9 @@ fn main() { fn craft_fonts(dir: &std::path::Path, rel: &str, desktop: &[(&str, &str)], web: &[(&str, &str)]) -> Result { let manifest = dir.join(rel); println!("cargo::rerun-if-changed={}", manifest.display()); + if rel == LATIN_MANIFEST && !manifest.exists() { + return Ok(String::new()); + } let text = std::fs::read_to_string(&manifest).map_err(|e| format!("{}: {e}", manifest.display()))?; let wasm = std::env::var("CARGO_CFG_TARGET_ARCH").is_ok_and(|a| a == "wasm32"); let wanted = if wasm { web } else { desktop };