Ship native PDF annotations with reserved object numbers

This commit is contained in:
gloamxun committed 2026-11-28 15:39:27 +08:00
1 parent 975dbc8060
commit de4bd1fa76
14 files changed
+299 -67

No files matched your search

@@ -116,6 +116,7 @@ pub enum Primitive {
Pdfcolorstack,
Pdfsave,
Pdfstartlink,
Pdfannot,
Pdfendlink,
Pdfrunninglinkoff,
Pdfrunninglinkon,
@@ -366,6 +367,7 @@ pub enum Primitive {
Leftmarginkern,
Rightmarginkern,
Pdflastlink,
Pdflastannot,
Special,
Umathcode,
Umathcodenum,
@@ -958,6 +960,7 @@ const PDFTEX_ONLY_PRIMITIVES: &[(&str, Primitive)] = {
("pdfrefobj", Pdfrefobj),
("pdflastobj", Pdflastobj),
("pdflastlink", Pdflastlink),
("pdflastannot", Pdflastannot),
("pdfrandomseed", Pdfrandomseed),
("pdfsetrandomseed", Pdfsetrandomseed),
("pdfuniformdeviate", Pdfuniformdeviate),
@@ -968,6 +971,7 @@ const PDFTEX_ONLY_PRIMITIVES: &[(&str, Primitive)] = {
("pdfcolorstack", Pdfcolorstack),
("pdfsave", Pdfsave),
("pdfstartlink", Pdfstartlink),
("pdfannot", Pdfannot),
("pdfendlink", Pdfendlink),
("pdfrunninglinkoff", Pdfrunninglinkoff),
("pdfrunninglinkon", Pdfrunninglinkon),
@@ -1975,6 +1979,16 @@ impl State {
}
}
pub(super) fn install_pdf_annotation_commands(&mut self) {
let enabled = self.input_profile != super::InputProfile::XeTeX;
for (name, primitive) in [
("pdfannot", Primitive::Pdfannot),
("pdflastannot", Primitive::Pdflastannot),
] {
self.update_profile_command(name, Meaning::Primitive(primitive), enabled);
}
}
fn install_pdftex_primitives(&mut self) {
let enabled = self.input_profile != super::InputProfile::XeTeX;
for &(name, primitive) in PDFTEX_ONLY_PRIMITIVES {