Apply native automatic kerns and protrusion at real line edges

This commit is contained in:
gloamxun committed 2026-11-21 06:00:55 +08:00
1 parent f66a5a7e20
commit 1822ab2d32
22 files changed
+260 -36

No files matched your search

+33
View File
@@ -262,3 +262,36 @@ fn redirected_show_uses_the_open_stream_without_setting_the_cli_error_status() {
fs::remove_dir_all(root).unwrap();
fs::remove_dir_all(oracle).unwrap();
}
#[test]
fn automatic_kerns_preserve_raw_ligature_and_hyphen_margin_order() {
let root = directory();
let oracle = directory();
let entry = "automatic-kerns.tex";
let input = r"\catcode123=1 \catcode125=2
\pdfoutput=1
\font\roman=cmr10 \roman \hyphenchar\roman=45
\pdfprependkern=1 \pdfappendkern=1 \pdfprotrudechars=2
\knbccode\roman65=80 \knaccode\roman65=150
\knbccode\roman86=120 \knaccode\roman86=-50 \knbccode\roman12=200
\knbccode\roman45=95 \knaccode\roman45=105 \rpcode\roman45=100
\hsize=32pt \parindent=0pt \pretolerance=-1 \tolerance=10000 \exhyphenpenalty=0
\immediate\openout3=lists.dat \showstream=3
\showboxbreadth=100 \showboxdepth=10
\setbox0=\hbox{AV fi AA\-VV} \showbox0
\setbox1=\vbox{\noindent AA-VV VV\par} \showbox1
\immediate\closeout3
\end";
fs::write(root.join(entry), input).unwrap();
fs::write(oracle.join(entry), input).unwrap();
let expected = reference(&oracle, entry);
let actual = native(&root, entry);
assert!(expected.status.success(), "{expected:?}");
assert!(actual.status.success(), "{actual:?}");
assert_eq!(
fs::read_to_string(root.join("lists.dat")).unwrap(),
fs::read_to_string(oracle.join("lists.dat")).unwrap()
);
fs::remove_dir_all(root).unwrap();
fs::remove_dir_all(oracle).unwrap();
}