DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge #287: Fonts: the Document Fonts folder is found whatever its case
aionggc8bdb259105e
diff --cc crates/engine/src/cmd/file.rsindex 9c4dc9683,c549cff61..da0bfbd09--- a/crates/engine/src/cmd/file.rs+++ b/crates/engine/src/cmd/file.rs@@@ -199,11 -198,27 +199,28 @@@ pub(crate) fn load_document_fonts(d: &m}}+ /// The `Document Fonts` folder in `dir`, matched without regard to case: packages name it+ /// `Document fonts`, and file systems on Linux are case-sensitive. The exact name wins.+ #[cfg(not(target_arch = "wasm32"))]+ fn document_fonts_folder(dir: &std::path::Path) -> std::path::PathBuf {+ use designcraft_fonts::DOCUMENT_FONTS_FOLDER;+ let exact = dir.join(DOCUMENT_FONTS_FOLDER);+ if exact.is_dir() {+ return exact;+ }+ std::fs::read_dir(dir)+ .into_iter()+ .flatten()+ .flatten()+ .find(|e| e.file_name().to_str().is_some_and(|n| n.eq_ignore_ascii_case(DOCUMENT_FONTS_FOLDER)) && e.path().is_dir())+ .map_or(exact, |e| e.path())+ }+fn file_open_bytes(s: &mut Session, p: &Value) -> Result<Value> {let b = base64_decode(str_param(p, "base64").unwrap_or(""));- // IDML packages are recognised by their stored `mimetype` first entry.- if designcraft_idml::is_idml(&b) {+ // IDML packages are recognised by their stored `mimetype` first entry, INDD files by their+ // signature (or their name).+ if designcraft_idml::is_idml(&b) || super::interchange::is_indd(str_param(p, "name").unwrap_or_default(), &b) {return super::interchange::open_idml(s, p);}let mut d = from_bytes(&b)?;