Use shaped glyph edges for XeTeX protrusion and line breaking

This commit is contained in:
gloamxun committed 2026-11-25 19:09:56 +08:00
1 parent 5df90f113c
commit 6826efbeb1
12 files changed
+231 -39

No files matched your search

@@ -396,3 +396,48 @@ fn xetex_inter_character_lists_follow_text_runs_and_shared_grouping() {
assert!(result.reads.contains(&Dependency::XeCharClass(67)));
assert!(result.reads.contains(&Dependency::XeInterCharTokens(4098)));
}
#[test]
fn xetex_protrusion_level_scopes_and_font_codes_are_job_local() {
let state = State::initex()
.with_etex()
.with_input_profile(InputProfile::XeTeX);
let seed = r"\catcode123=1 \catcode125=2
\XeTeXprotrudechars=2
\lpcode\nullfont65535=-1800
\message{\the\lpcode\nullfont65535}
\dump";
let execution = run(state.clone(), seed);
assert_eq!(messages(&execution), ["-1800"]);
let image = FormatImage::from_dump(execution, Vec::new(), Vec::new())
.unwrap()
.encode()
.unwrap();
let executor = FormatImage::decode(&image)
.unwrap()
.new_job(
state.profile(),
InputProfile::XeTeX,
JobTime::new(2025, 10, 9, 0).unwrap(),
Limits::default(),
|_| Ok(seed.as_bytes().to_vec()),
)
.unwrap();
let result = executor
.with_native_pages()
.run(
source(
r"\message{\the\XeTeXprotrudechars/\the\lpcode\nullfont65535}
\begingroup
\XeTeXprotrudechars=1 \lpcode\nullfont65535=1600
\message{\the\XeTeXprotrudechars/\the\lpcode\nullfont65535}
\endgroup
\message{\the\XeTeXprotrudechars/\the\lpcode\nullfont65535}
\shipout\hbox{\vrule width5pt height3pt depth0pt}
\end",
),
&mut TestDevice,
)
.unwrap();
assert_eq!(messages(&result), ["2/0", "1/1600", "2/1600"]);
}