Apply TeX sentence spacing to interword glue

This commit is contained in:
gloamxun committed 2026-10-23 01:26:04 +08:00
1 parent bd109d03c5
commit 295c934438
8 files changed
+137 -23

No files matched your search

+14
View File
@@ -349,6 +349,20 @@ fn parfillskip_without_fil_justifies_the_last_line() {
assert_lines_match("parfillskip 120pt", &ours, &reference);
}
/// Sentence punctuation changes the space factor, so the interword glue and
/// the resulting line breaks must match pdfLaTeX.
#[test]
fn sentence_spacing_matches_pdftex_at_150pt() {
let width = 150;
let text = "alpha. beta gamma, delta; epsilon: zeta eta theta iota kappa lambda mu";
let Some(reference) = pdftex_lines(&paragraph_fixture_with(text, width, "")) else {
eprintln!("skipping: pdflatex/pdftotext are not installed");
return;
};
let ours = route_d_lines_with(text, f64::from(width), |_| {});
assert_lines_match("sentence spacing 150pt", &ours, &reference);
}
#[test]
fn paragraph_breaks_match_pdftex_at_150pt() {
compare_fixture(WORDS, 150);
+4
View File
@@ -21,6 +21,7 @@ fn body_style() -> ParagraphStyle {
par_fillskip: 0,
par_fillskip_stretch: 0,
par_fillskip_fil: true,
frenchspacing: false,
par_indent: 0,
emergencystretch: 0,
pretolerance: 100,
@@ -173,6 +174,7 @@ fn route_d_page_matches_pdftex_raster_geometry() {
par_fillskip: 0,
par_fillskip_stretch: 0,
par_fillskip_fil: true,
frenchspacing: false,
par_indent: 0,
emergencystretch: 0,
pretolerance: 100,
@@ -336,6 +338,7 @@ fn route_d_two_pages_match_pdftex_raster_geometry() {
par_fillskip: 0,
par_fillskip_stretch: 0,
par_fillskip_fil: true,
frenchspacing: false,
par_indent: 0,
emergencystretch: 0,
pretolerance: 100,
@@ -629,6 +632,7 @@ fn route_d_multiline_bands_track_pdftex() {
par_fillskip: 0,
par_fillskip_stretch: 0,
par_fillskip_fil: true,
frenchspacing: false,
par_indent: 0,
emergencystretch: 0,
pretolerance: 100,