Write PDF interword spaces with actual device fonts

This commit is contained in:
gloamxun committed 2026-11-21 03:09:10 +08:00
1 parent b93d5f55da
commit 514a2d3344
24 files changed
+664 -65

No files matched your search

@@ -150,6 +150,7 @@ pub(super) enum BoxPaint<'a> {
Box(&'a HorizontalBox),
PdfColor,
PdfGraphics,
PdfTextSpace(crate::pdf_device::text_spaces::SpaceOperation),
RowStart(RowLayout),
PdfLink(&'a OutputNode, Option<RowLayout>),
Output(&'a OutputNode),
@@ -209,6 +210,7 @@ pub(super) enum GeometryItem {
Paint(crate::math_engine_tex::PositionedItem),
PdfColor,
PdfGraphics { x: i64, y: i64 },
PdfTextSpace { x: i64, y: i64, operation: crate::pdf_device::text_spaces::SpaceOperation },
}
impl NativeBox {
@@ -734,6 +736,10 @@ impl NativeBox {
emit(GeometryItem::PdfGraphics { x, y });
return;
}
BoxPaint::PdfTextSpace(operation) => {
emit(GeometryItem::PdfTextSpace { x, y, operation });
return;
}
BoxPaint::RowStart(_) | BoxPaint::PdfLink(_, _) | BoxPaint::Output(_) => return,
};
if let Some(child) = &b.math_geometry {
@@ -977,6 +983,8 @@ fn walk_output(
emit(x, y, BoxPaint::PdfColor);
} else if node.is_pdf_graphics() {
emit(x, y, BoxPaint::PdfGraphics);
} else if let OutputOperation::PdfTextSpace(operation) = node.operation {
emit(x, y, BoxPaint::PdfTextSpace(operation));
} else if links && node.is_pdf_link() {
emit(x, y, BoxPaint::PdfLink(node, row));
}