Allocate dedicated PDF spaces in the native font catalog at shipout

This commit is contained in:
gloamxun committed 2026-11-21 07:11:48 +08:00
1 parent 4bd7f1e08e
commit 584b708487
11 files changed
+339 -93

No files matched your search

@@ -40,6 +40,15 @@ fn pdf_resource_entries_empty(entries: &Arc<[u8]>) -> bool {
impl NativeShipout {
pub fn display_list(&self) -> Result<crate::render::DisplayList, String> {
self.display_list_prefix(None)
}
/// Use the same packed geometry up to, but excluding, a deferred output
/// that is about to expand tokens against the live TeX state.
pub(super) fn display_list_prefix(
&self,
before_output: Option<usize>,
) -> Result<crate::render::DisplayList, String> {
let mut page = crate::render::DisplayList {
width: self.device.page_width,
height: self.device.page_height,
@@ -67,8 +76,18 @@ impl NativeShipout {
let mut invalid_geometry = false;
let mut missing_color_step = false;
let mut missing_graphics_step = false;
let mut output_index = 0;
let mut reached_boundary = false;
self.box_node.visit_geometry(|item| {
if reached_boundary {
return;
}
let p = match item {
boxes::GeometryItem::Output => {
reached_boundary = before_output == Some(output_index);
output_index += 1;
return;
}
boxes::GeometryItem::Paint(p) => p,
boxes::GeometryItem::PdfColor => {
match color_steps.next() {
@@ -141,6 +160,9 @@ impl NativeShipout {
}
});
})?;
if before_output.is_some() && !reached_boundary {
return Err("missing deferred output boundary in its packed list".into());
}
if invalid_geometry {
return Err("native shipout requires actual native glyph resources".into());
}