Save the TeX cursor in native shipout order
This commit is contained in:
1 parent
555a029505
commit
413939911f
12 files changed
+173
-28
No files matched your search
@@ -192,7 +192,7 @@ impl WalkBudget<'_> {
|
||||
|
||||
pub(super) struct LeaderEffects {
|
||||
pub outputs: Vec<OutputNode>,
|
||||
pub graphics_positions: Vec<[i64; 2]>,
|
||||
pub output_positions: Vec<[i64; 2]>,
|
||||
pub work: usize,
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ impl NativeBox {
|
||||
cancellation: Option<&Cancellation>,
|
||||
) -> Result<LeaderEffects, &'static str> {
|
||||
let mut outputs = Vec::new();
|
||||
let mut graphics_positions = Vec::new();
|
||||
let mut output_positions = Vec::new();
|
||||
let mut budget = WalkBudget {
|
||||
remaining: limit,
|
||||
cancellation,
|
||||
@@ -270,15 +270,15 @@ impl NativeBox {
|
||||
};
|
||||
self.walk_at(0, 0, 0, false, &mut budget, &mut |x, y, item| {
|
||||
if let BoxPaint::Output(o) = item {
|
||||
if o.is_pdf_graphics() {
|
||||
graphics_positions.push([x, y]);
|
||||
if o.needs_shipout_position() {
|
||||
output_positions.push([x, y]);
|
||||
}
|
||||
outputs.push(o.clone());
|
||||
}
|
||||
})?;
|
||||
Ok(LeaderEffects {
|
||||
outputs,
|
||||
graphics_positions,
|
||||
output_positions,
|
||||
work: limit - budget.remaining,
|
||||
})
|
||||
}
|
||||
@@ -762,15 +762,15 @@ impl NativeBox {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn pdf_graphics_positions(&self) -> Vec<[i64; 2]> {
|
||||
let mut all = Vec::new();
|
||||
pub(super) fn positioned_outputs(&self) -> Vec<[i64; 2]> {
|
||||
let mut positions = Vec::new();
|
||||
self.walk(0, 0, &mut |x, y, node| {
|
||||
if matches!(node, BoxPaint::PdfGraphics) {
|
||||
all.push([x, y]);
|
||||
if matches!(node, BoxPaint::Output(node) if node.needs_shipout_position()) {
|
||||
positions.push([x, y]);
|
||||
}
|
||||
})
|
||||
.expect("graphics traversal of an already measured list");
|
||||
all
|
||||
.expect("output traversal of an already measured list");
|
||||
positions
|
||||
}
|
||||
|
||||
fn walk(
|
||||
|
||||
Reference in new issue
Block a user