Honour finite parfillskip on the last line

This commit is contained in:
gloamxun committed 2026-10-23 01:22:16 +08:00
1 parent 8993186005
commit bd109d03c5
6 files changed
+146 -16

No files matched your search

+16
View File
@@ -333,6 +333,22 @@ fn hang_indent_shifts_lines_like_tex() {
);
}
/// A paragraph whose `\parfillskip` has no `fil` must justify its final
/// line, so every line matches pdfLaTeX.
#[test]
fn parfillskip_without_fil_justifies_the_last_line() {
let width = 120;
let Some(reference) = pdftex_lines(&paragraph_fixture_with(WORDS, width, "\\parfillskip=0pt "))
else {
eprintln!("skipping: pdflatex/pdftotext are not installed");
return;
};
let ours = route_d_lines_with(WORDS, f64::from(width), |style| {
style.par_fillskip_fil = false;
});
assert_lines_match("parfillskip 120pt", &ours, &reference);
}
#[test]
fn paragraph_breaks_match_pdftex_at_150pt() {
compare_fixture(WORDS, 150);
+12
View File
@@ -18,6 +18,9 @@ fn body_style() -> ParagraphStyle {
hang_indent: 0,
hang_after: 1,
par_shape: Vec::new(),
par_fillskip: 0,
par_fillskip_stretch: 0,
par_fillskip_fil: true,
par_indent: 0,
emergencystretch: 0,
pretolerance: 100,
@@ -167,6 +170,9 @@ fn route_d_page_matches_pdftex_raster_geometry() {
hang_indent: 0,
hang_after: 1,
par_shape: Vec::new(),
par_fillskip: 0,
par_fillskip_stretch: 0,
par_fillskip_fil: true,
par_indent: 0,
emergencystretch: 0,
pretolerance: 100,
@@ -327,6 +333,9 @@ fn route_d_two_pages_match_pdftex_raster_geometry() {
hang_indent: 0,
hang_after: 1,
par_shape: Vec::new(),
par_fillskip: 0,
par_fillskip_stretch: 0,
par_fillskip_fil: true,
par_indent: 0,
emergencystretch: 0,
pretolerance: 100,
@@ -617,6 +626,9 @@ fn route_d_multiline_bands_track_pdftex() {
hang_indent: 0,
hang_after: 1,
par_shape: Vec::new(),
par_fillskip: 0,
par_fillskip_stretch: 0,
par_fillskip_fil: true,
par_indent: 0,
emergencystretch: 0,
pretolerance: 100,