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

@@ -69,6 +69,35 @@ impl Executor {
}
Ok(())
}
pub(super) fn scan_pdf_space(
&mut self,
command: Primitive,
span: Span,
files: &mut impl SourceProvider,
) -> Result<(), Error> {
use crate::pdf_device::text_spaces::{SpaceFontRequest, SpaceOperation};
if self.read_parameter(Parameter::Pdfoutput).width() <= 0 {
return self.fail("PDF text space operation not allowed in DVI mode");
}
let operation = match command {
Primitive::Pdfspacefont => {
let tokens = self.scan_expanded_group(files)?;
self.pdf_space_font = Some(SpaceFontRequest {
name: self.token_list_text(&tokens),
from: self.source_name(span),
});
return Ok(());
}
Primitive::Pdfinterwordspaceon => SpaceOperation::Automatic(true),
Primitive::Pdfinterwordspaceoff => SpaceOperation::Automatic(false),
Primitive::Pdffakespace => SpaceOperation::Explicit,
_ => unreachable!(),
};
self.defer_output(OutputNode {
operation: OutputOperation::PdfTextSpace(operation),
span,
})
}
pub(super) fn pdf_page_data(
&mut self,
files: &mut impl SourceProvider,