Share packed box diagnostics across native execution

This commit is contained in:
gloamxun committed 2026-11-28 07:43:44 +08:00
1 parent 526ec9b3b0
commit ca3730338e
13 files changed
+126 -22

No files matched your search

@@ -1,6 +1,7 @@
//! Owned native boxes. Packing follows tex.web hpack/vpackage, not page costs.
use super::*;
use crate::{HorizontalBox, HorizontalItem, Paragraph, ParagraphFont};
use std::sync::Arc;
mod interword;
mod tail;
pub(super) use tail::TailNodeRef;
@@ -56,8 +57,8 @@ pub struct NativeBox {
pub height: i64,
pub depth: i64,
pub content: BoxContent,
/// Original horizontal semantics, retained before paint-time glue setting.
pub diagnostic: Vec<super::diagnostics::DiagnosticNode>,
/// Original horizontal semantics, shared by box copies and diagnostic views.
pub diagnostic: Arc<[super::diagnostics::DiagnosticNode]>,
pub setting: GlueSetting,
// Prepared only on the disposable shipout box after its glue is set.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
@@ -662,7 +663,7 @@ pub(super) fn vpack(
depth,
shift: 0,
content: BoxContent::Vertical(nodes),
diagnostic: Vec::new(),
diagnostic: Arc::default(),
setting: set,
interword_runs: Vec::new(),
badness,
@@ -766,7 +767,7 @@ pub(super) fn hpack_with_direction_report(
depth: None,
}));
}
let diagnostic = super::diagnostics::text_nodes(&nodes);
let diagnostic = super::diagnostics::text_nodes(&nodes).into();
Ok((NativeBox {
kind: BoxKind::Horizontal,
display: false,