Execute positioned TeX specials through native PDF devices
This commit is contained in:
1 parent
05e633bb14
commit
ce8a780031
21 files changed
+519
-29
No files matched your search
@@ -704,7 +704,7 @@ fn page_content(
|
||||
pt(n)
|
||||
}
|
||||
};
|
||||
use crate::pdf_device::{PdfGraphics, PdfLiteralMode};
|
||||
use crate::pdf_device::{PdfDriver, PdfGraphics, PdfLiteralMode};
|
||||
use crate::render::DisplayUnits;
|
||||
|
||||
let mut content = PageContent::default();
|
||||
@@ -757,6 +757,8 @@ fn page_content(
|
||||
} = item
|
||||
{
|
||||
NativeTextRun::flush(&mut native_text, &mut content);
|
||||
let previous_origin = content.origin.position();
|
||||
let special_origin = mode.xdv_origin([*x, height - *y], height, list.magnification);
|
||||
match mode {
|
||||
PdfLiteralMode::Direct => {
|
||||
native_text::NativeText::break_string(&mut tex_text, &mut content);
|
||||
@@ -767,9 +769,18 @@ fn page_content(
|
||||
content.move_origin([*x, height - *y], list.units, digits);
|
||||
}
|
||||
}
|
||||
PdfLiteralMode::XdvOrigin | PdfLiteralMode::XdvDirect => {
|
||||
native_text::NativeText::finish(&mut tex_text, &mut content);
|
||||
if let Some(point) = special_origin {
|
||||
content.move_origin(point, list.units, digits);
|
||||
}
|
||||
}
|
||||
}
|
||||
content.bytes.extend_from_slice(bytes);
|
||||
content.push(b'\n');
|
||||
if special_origin.is_some() {
|
||||
content.move_origin(previous_origin, list.units, digits);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if list.units == DisplayUnits::TeX {
|
||||
@@ -810,9 +821,15 @@ fn page_content(
|
||||
} = item
|
||||
{
|
||||
let [h, v] = content.origin.position();
|
||||
native_text::rule(
|
||||
&mut content, *x - h, *y + v, *width, *rule_height, height, digits,
|
||||
);
|
||||
if list.pdf.as_ref().is_some_and(|pdf| pdf.driver == PdfDriver::Xdv) {
|
||||
native_text::xdv_rule(
|
||||
&mut content, *x - h, height - *y - v - *rule_height, *width, *rule_height, digits,
|
||||
);
|
||||
} else {
|
||||
native_text::rule(
|
||||
&mut content, *x - h, *y + v, *width, *rule_height, height, digits,
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user