Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

fix(compose): Words in capitals hyphenate like capitalized words

moppeeerd6ddf749fecb
diff --git a/ROADMAP.md b/ROADMAP.md
index 9a0f71e70..031e04489 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -129,6 +129,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.m
Newest first.
+- **2026-10-12** · Words in capitals hyphenate like capitalized words (FERRUM COM-MODI), as in InDesign; Hyphenate Capitalized Words off keeps them whole. No readiness percentage change.
- **2026-10-10 (UI.4–UI.5):** Panel tabs can move into other groups, split the dock, float, resize and return to their saved locations through shared docking transactions. Layouts persist in custom workspaces; UI and control commands share the same validated action path. Shared pane geometry and widget-state theme application retain all five palettes and local fonts. Split panes send keyboard input only to the focused canvas and scope contextual toolbar IDs per pane. No readiness percentage change.
- **2026-10-10** · Version 0.6.0; releases add a Linux riscv64 tar.gz (cross-compiled, CLI
smoke-tested under QEMU).
diff --git a/crates/compose/src/hyphen/mod.rs b/crates/compose/src/hyphen/mod.rs
index 22644eb70..a4c7657de 100644
--- a/crates/compose/src/hyphen/mod.rs
+++ b/crates/compose/src/hyphen/mod.rs
@@ -232,9 +232,8 @@ pub fn hyphen_points_in(word: &str, lim: &Limits, lang: Lang) -> Vec<usize> {
if letters < lim.min_word.max(2) {
return false;
}
- if letters > 1 && run.iter().filter(|c| c.is_alphabetic()).all(|c| c.is_uppercase()) {
- return false;
- }
+ // Words in capitals (FERRUM COMMODI) hyphenate like capitalized words, as InDesign's: Hyphenate
+ // Capitalized Words off keeps both, acronyms included, whole.
if !lim.capitalized && run[0].is_uppercase() {
return false;
}
@@ -332,7 +331,10 @@ mod tests {
#[test]
fn case_apostrophes_and_punctuation() {
assert_eq!(h("Typography"), "Ty-pog-ra-phy");
- assert_eq!(h("TYPOGRAPHY"), "TYPOGRAPHY");
+ assert_eq!(h("TYPOGRAPHY"), "TY-POG-RA-PHY");
+ assert_eq!(h("COMMODI"), "COM-MO-DI");
+ let whole = Limits { capitalized: false, ..Limits::default() };
+ assert_eq!(hyphenate_word("TYPOGRAPHY", &whole), "TYPOGRAPHY", "Hyphenate Capitalized Words off");
assert_eq!(h("typography,"), "ty-pog-ra-phy,");
assert_eq!(h("“typography”"), "“ty-pog-ra-phy”");
assert_eq!(h("typography's"), "ty-pog-ra-phy's");