Expose active insertion height to pdfTeX macros
This commit is contained in:
1 parent
2fa11fb971
commit
7707cd9b09
7 files changed
+70
-4
No files matched your search
@@ -77,6 +77,21 @@ impl Executor {
|
||||
.dimension(p.page_dimension().unwrap());
|
||||
i32::try_from(value).map_err(|_| self.error("native page dimension overflow", self.current))
|
||||
}
|
||||
pub(super) fn expand_pdf_insertion_height(
|
||||
&mut self, token: &Token, files: &mut impl SourceProvider,
|
||||
) -> Result<(), Error> {
|
||||
let index = self.register_index(files)?;
|
||||
self.reads.insert(Dependency::PageState);
|
||||
let height = u8::try_from(index).ok().and_then(|class| {
|
||||
self.native_page.as_ref()?.insertions.height(class)
|
||||
});
|
||||
let value = height.map_or_else(
|
||||
|| "0pt".to_owned(),
|
||||
|size| format!("{}pt", super::super::registers::print_scaled_wide(size)),
|
||||
);
|
||||
self.print_tokens(&value, token)
|
||||
}
|
||||
|
||||
pub(super) fn request_page(&mut self) {
|
||||
if self.outer_vertical() {
|
||||
if let Some(page) = self.native_page.as_mut() {
|
||||
|
||||
Reference in new issue
Block a user