diff --git a/crates/texrra-tex-core/src/paragraph.rs b/crates/texrra-tex-core/src/paragraph.rs index 4dfeb12..b5c88ad 100755 --- a/crates/texrra-tex-core/src/paragraph.rs +++ b/crates/texrra-tex-core/src/paragraph.rs @@ -331,6 +331,33 @@ mod tests { assert!(paragraph.line_count() >= 2); } + #[test] + fn cmr10_breaks_match_pdftex_at_180pt() { + let font = crate::cmr10::Cmr10Metrics::new(); + let style = ParagraphStyle { + line_width: 180 * 65_536, + ..ParagraphStyle::default() + }; + let paragraph = layout_paragraph_with_font( + "alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu nu xi omicron pi rho sigma tau upsilon phi chi psi omega", + &style, + &font, + ); + let mut words: Vec = paragraph + .lines + .iter() + .map(|line| { + line.iter() + .filter(|item| matches!(item, HorizontalItem::Glue { .. })) + .count() + }) + .collect(); + if let Some(last) = words.last_mut() { + *last += 1; + } + assert_eq!(words, vec![7, 7, 8]); + } + #[test] fn cmr10_breaks_match_a_pdftex_fixture() { let font = crate::cmr10::Cmr10Metrics::new();