UI: share the Japanese fallback font with printcraft-fonts (one 8.7 MB copy, not two)

The UI theme include_bytes!'d ShipporiMincho-Regular.ttf, which
printcraft-fonts already embeds as SHIPPORI_MINCHO for Japanese text in
PDFs, so the app carried two copies. ui-egui now depends on printcraft-fonts
(layer 2, wasm-clean) and uses its static. The desktop app binary drops from
85.8 MB to 77.5 MB (debug build; one copy of the font left, counted).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-05 17:34:51 -04:00
parent 7b85af8785
commit 73fdb261ef
3 changed files with 4 additions and 1 deletions

1
Cargo.lock generated
View File

@ -4088,6 +4088,7 @@ dependencies = [
"png 0.18.1", "png 0.18.1",
"printcraft-cos", "printcraft-cos",
"printcraft-engine", "printcraft-engine",
"printcraft-fonts",
"printcraft-model", "printcraft-model",
"printcraft-render", "printcraft-render",
"rfd", "rfd",

View File

@ -9,6 +9,7 @@ license.workspace = true
workspace = true workspace = true
[dependencies] [dependencies]
printcraft-fonts = { workspace = true }
printcraft-engine = { workspace = true } printcraft-engine = { workspace = true }
printcraft-render = { workspace = true } printcraft-render = { workspace = true }
egui = { workspace = true } egui = { workspace = true }

View File

@ -113,7 +113,8 @@ pub fn install_fonts(ctx: &egui::Context) {
add(&mut fonts, "Inter-Medium", include_bytes!("../../../assets/fonts/Inter-Medium.ttf")); add(&mut fonts, "Inter-Medium", include_bytes!("../../../assets/fonts/Inter-Medium.ttf"));
add(&mut fonts, "Inter-SemiBold", include_bytes!("../../../assets/fonts/Inter-SemiBold.ttf")); add(&mut fonts, "Inter-SemiBold", include_bytes!("../../../assets/fonts/Inter-SemiBold.ttf"));
add(&mut fonts, "JetBrainsMono", include_bytes!("../../../assets/fonts/JetBrainsMono-Regular.ttf")); add(&mut fonts, "JetBrainsMono", include_bytes!("../../../assets/fonts/JetBrainsMono-Regular.ttf"));
add(&mut fonts, "ShipporiMincho", include_bytes!("../../../assets/fonts/ShipporiMincho-Regular.ttf")); // The same bytes printcraft-fonts embeds for Japanese text in PDFs: one 8.7 MB copy, not two.
add(&mut fonts, "ShipporiMincho", printcraft_fonts::SHIPPORI_MINCHO);
fonts.families.entry(FontFamily::Proportional).or_default().insert(0, "Inter".to_owned()); fonts.families.entry(FontFamily::Proportional).or_default().insert(0, "Inter".to_owned());
fonts.families.entry(FontFamily::Proportional).or_default().push("ShipporiMincho".to_owned()); fonts.families.entry(FontFamily::Proportional).or_default().push("ShipporiMincho".to_owned());
fonts.families.entry(FontFamily::Monospace).or_default().insert(0, "JetBrainsMono".to_owned()); fonts.families.entry(FontFamily::Monospace).or_default().insert(0, "JetBrainsMono".to_owned());