Promote verified native PDF and box capacity support

This commit is contained in:
gloamxun committed 2026-11-19 14:39:39 +08:00
1 parent 3706afa483
commit 72ed779749
31 files changed
+1042 -78

No files matched your search

@@ -257,10 +257,7 @@ impl Executor {
"improper native discretionary material: only glyphs, boxes, rules and kerns are allowed",
);
}
self.box_nodes_created = self.box_nodes_created.saturating_add(part.len());
if self.box_nodes_created > self.limits.tokens {
return self.fail("native discretionary node capacity exceeded");
}
self.charge_box_material(part.len(), "native discretionary node capacity exceeded")?;
disc.parts.push(part);
if disc.parts.len() < 3 {
return self.begin_discretionary_part(disc, files);
@@ -313,10 +310,18 @@ impl Executor {
}
}
pub(super) fn account_box(&mut self, b: &NativeBox) -> Result<(), Error> {
self.box_nodes_created = self.box_nodes_created.saturating_add(b.node_count());
if self.box_nodes_created > self.limits.tokens {
return self.fail("native box node capacity exceeded");
};
self.charge_box_material(b.node_count(), "native box node capacity exceeded")
}
pub(super) fn charge_box_material(
&mut self,
nodes: usize,
error: &'static str,
) -> Result<(), Error> {
self.box_nodes_created = self.box_nodes_created.saturating_add(nodes);
if nodes > self.limits.tokens {
return self.fail(error);
}
self.material_charge = self.material_charge.saturating_add(nodes);
Ok(())
}
pub(super) fn scan_box(