Keep font kerns at the start of wrapped TeX lines

This commit is contained in:
gloamxun committed 2026-11-29 08:34:22 +08:00
1 parent 57ce7116ad
commit a8dfa14b7e
5 files changed
+38 -2

No files matched your search

@@ -612,7 +612,7 @@ fn discardable(n: &TextNode) -> bool {
| TextNode::NamedGlue(_, _)
| TextNode::ConditionalMathGlue
| TextNode::Leaders(_)
| TextNode::Kern { .. }
| TextNode::Kern { explicit: true, .. }
| TextNode::SpaceAdjustment(_)
| TextNode::MathBoundary { .. }
| TextNode::Direction(_)
@@ -219,7 +219,7 @@ impl BreakNode {
matches!(
self,
Self::Glue(_)
| Self::Kern { .. }
| Self::Kern { explicit: true, .. }
| Self::SpaceAdjustment(_)
| Self::MathBoundary { .. }
| Self::Direction
@@ -138,6 +138,16 @@ fn explicit_branch_lists_boxes_fonts_groups_and_no_hbox_hook_match_initex() {
let restored: Execution = serde_json::from_slice(&serde_json::to_vec(&e).unwrap()).unwrap();
assert_eq!(e, restored);
}
#[test]
fn line_start_preserves_a_font_kern_and_discards_an_explicit_kern() {
let source = r"
\hsize=12pt \rightskip=0pt plus1fil \exhyphenpenalty=0 \hyphenchar\p=65
\setbox0=\vbox{\noindent AV\par}\showbox0
\setbox0=\vbox{\noindent A\kern1pt V\par}\showbox0
";
compare(source, &["font kern".into(), "explicit kern".into()]);
}
#[test]
fn actual_breaks_transplant_pre_post_skip_replacement_and_consume_penalties() {
let mut body = String::new();