PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
refactor(ui-egui): move system_fonts.rs into platform/
aiongg80c4572cfaf5
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 5da9751cf..591aca49f 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -50,8 +50,6 @@ mod panels;pub use print_ui::{Handling as PrintHandling, OptionsSource, PrintDraft, PrinterSource, Which as PrintWhich, system_printers};pub use redact_ui::{HiddenDraft, PagesDraft as RedactPagesDraft, RedactPrefs, SearchDraft as RedactSearchDraft, SearchMode as RedactSearchMode};pub mod i18n;-#[cfg(not(target_arch = "wasm32"))]-mod system_fonts;mod tab_context;pub mod theme;mod widgets;@@ -122,6 +120,8 @@ use platform::open_worker;#[cfg(not(target_arch = "wasm32"))]use platform::pickers;pub use platform::portable;+#[cfg(not(target_arch = "wasm32"))]+use platform::system_fonts;pub use platform::ui_scale;pub use platform::updates;pub use platform::window_controls;diff --git a/crates/ui-egui/src/platform.rs b/crates/ui-egui/src/platform.rsindex 56096f5a3..129f622f5 100644--- a/crates/ui-egui/src/platform.rs+++ b/crates/ui-egui/src/platform.rs@@ -9,6 +9,8 @@ pub(super) mod open_worker;#[cfg(not(target_arch = "wasm32"))]pub(super) mod pickers;pub mod portable;+#[cfg(not(target_arch = "wasm32"))]+pub(super) mod system_fonts;pub mod ui_scale;pub mod updates;pub mod window_controls;diff --git a/crates/ui-egui/src/system_fonts.rs b/crates/ui-egui/src/platform/system_fonts.rssimilarity index 99%rename from crates/ui-egui/src/system_fonts.rsrename to crates/ui-egui/src/platform/system_fonts.rsindex 971683887..4b5e1eca7 100644--- a/crates/ui-egui/src/system_fonts.rs+++ b/crates/ui-egui/src/platform/system_fonts.rs@@ -472,7 +472,7 @@ mod tests {#[test]fn a_face_without_the_probe_is_rejected() {// Inter is Latin, Greek and Cyrillic only.- let inter = include_bytes!("../../../assets/fonts/Inter-Regular.ttf");+ let inter = include_bytes!("../../../../assets/fonts/Inter-Regular.ttf");assert_eq!(face_with(inter, PROBE), None);assert_eq!(face_with(inter, HANS_PROBE), None);assert_eq!(face_with(inter, HANT_PROBE), None);@@ -561,7 +561,7 @@ mod tests {assert!(path.extension().is_some_and(|e| e == "ttf" || e == "ttc"), "{path:?}");}// Inter has no Hangul.- let inter = include_bytes!("../../../assets/fonts/Inter-Regular.ttf");+ let inter = include_bytes!("../../../../assets/fonts/Inter-Regular.ttf");assert_eq!(face_with(inter, HANGUL_PROBE), None);}@@ -612,7 +612,7 @@ mod tests {std::fs::create_dir_all(&supplemental).expect("build a temp macOS-shaped font tree");let dirs = [root.to_string_lossy().to_string(), supplemental.to_string_lossy().to_string()];let names: Vec<&str> = dirs.iter().map(|d| d.as_str()).collect();- let inter: &[u8] = include_bytes!("../../../assets/fonts/Inter-Regular.ttf");+ let inter: &[u8] = include_bytes!("../../../../assets/fonts/Inter-Regular.ttf");let spaced = "Devanagari Sangam MN.ttc";std::fs::write(supplemental.join(spaced), inter).expect("place a face at the spaced path");let found = macos_families_in(&names, &[spaced]).iter().any(|p| read(p, 'A', MAX_BYTES).is_some());diff --git a/crates/ui-egui/src/system_fonts/fontconfig.rs b/crates/ui-egui/src/platform/system_fonts/fontconfig.rssimilarity index 100%rename from crates/ui-egui/src/system_fonts/fontconfig.rsrename to crates/ui-egui/src/platform/system_fonts/fontconfig.rs