Cover hyphenated breaks and hyphen demerits with pdfLaTeX
This commit is contained in:
1 parent
a6397fcfef
commit
e00e0038c1
3 files changed
+57
-8
No files matched your search
@@ -568,6 +568,52 @@ fn looseness_matches_pdftex() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Hyphenation inserts discretionary breaks; line endings and the resulting
|
||||
/// fragment words must match pdfLaTeX.
|
||||
#[test]
|
||||
fn hyphenated_breaks_match_pdftex() {
|
||||
let text = "hyphenation demonstrates discretionary hyphenation whenever extraordinarily \
|
||||
unpronounceable words appear in a paragraph";
|
||||
for width in [80_u32, 100, 120] {
|
||||
let Some(reference) = pdftex_lines(¶graph_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(&format!("hyphenation {width}pt"), &ours, &reference);
|
||||
}
|
||||
}
|
||||
|
||||
/// `\\doublehyphendemerits` and `\\finalhyphendemerits` change which
|
||||
/// breaks pdfLaTeX picks; both settings must reproduce its lines.
|
||||
#[test]
|
||||
fn hyphen_demerits_change_breaks_like_pdftex() {
|
||||
let text = "hyphenation demonstrates discretionary representation according \
|
||||
extraordinary understanding";
|
||||
for width in [70_u32, 85] {
|
||||
for demerits in [0_i64, 10_000] {
|
||||
let prefix = format!(
|
||||
"\\doublehyphendemerits={demerits} \\finalhyphendemerits={} ",
|
||||
demerits / 2
|
||||
);
|
||||
let Some(reference) = pdftex_lines(¶graph_fixture_with(text, width, &prefix))
|
||||
else {
|
||||
eprintln!("skipping: pdflatex/pdftotext are not installed");
|
||||
return;
|
||||
};
|
||||
let ours = route_d_lines_with(text, f64::from(width), |style| {
|
||||
style.double_hyphen_demerits = demerits;
|
||||
style.final_hyphen_demerits = demerits / 2;
|
||||
});
|
||||
assert_lines_match(
|
||||
&format!("hyphen demerits {demerits} at {width}pt"),
|
||||
&ours,
|
||||
&reference,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Sentence punctuation changes the space factor, so the interword glue and
|
||||
/// the resulting line breaks must match pdfLaTeX.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user