Skip to content

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

Merge nobreak-justify: jidori runs keep their width; tests for nonbreaking-space lines

aionggd5fb84d5e1ed
diff --cc crates/compose/src/breaker.rs
index f6d583db5,6b0654388..8ae6a75b9
--- a/crates/compose/src/breaker.rs
+++ b/crates/compose/src/breaker.rs
@@@ -96,13 -88,14 +96,14 @@@ impl Spacing
}
let natural = g.adv / self.glyph_desired.max(0.01);
(
- [0.0, g.space * (self.letter_max - self.letter_desired).max(0.0), natural * (self.glyph_max - self.glyph_desired).max(0.0)],
- [0.0, g.space * (self.letter_desired - self.letter_min).max(0.0), natural * (self.glyph_desired - self.glyph_min).max(0.0)],
+ [moji_stretch, g.space * (self.letter_max - self.letter_desired).max(0.0), natural * (self.glyph_max - self.glyph_desired).max(0.0)],
+ [moji_shrink, g.space * (self.letter_desired - self.letter_min).max(0.0), natural * (self.glyph_desired - self.glyph_min).max(0.0)],
)
}
- /// Word-space stretch and shrink of space glyph `g` (see [`Glyph::is_word_space`]).
+ /// Word-space stretch and shrink of space glyph `g` (see [`Glyph::is_word_space`]); none
+ /// inside a jidori run, whose width is fitted.
fn space_elastic(&self, g: &Glyph) -> (f64, f64) {
- if !g.is_word_space() {
+ if !g.is_word_space() || g.locked_advance {
return (0.0, 0.0);
}
(g.space * (self.word_max - self.word_desired).max(0.0), g.space * (self.word_desired - self.word_min).max(0.0))