Honor final pdfTeX font charset and document info omission
This commit is contained in:
1 parent
38c567623a
commit
de481fd762
8 files changed
+92
-26
No files matched your search
@@ -272,7 +272,9 @@ impl Executor {
|
||||
}
|
||||
if !self.pdf_info_tokens.is_empty() {
|
||||
let tokens = std::mem::take(&mut self.pdf_info_tokens);
|
||||
self.state.pdf_info = self.pdf_token_bytes(&tokens)?;
|
||||
if self.read_parameter(Parameter::Pdfomitinfodict).width() == 0 {
|
||||
self.state.pdf_info = self.pdf_token_bytes(&tokens)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ use std::{
|
||||
sync::{Arc, Mutex, OnceLock, Weak},
|
||||
};
|
||||
|
||||
const SCHEMA: u32 = 78;
|
||||
const COMPATIBLE_SCHEMAS: [u32; 45] = [
|
||||
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, SCHEMA,
|
||||
const SCHEMA: u32 = 79;
|
||||
const COMPATIBLE_SCHEMAS: [u32; 46] = [
|
||||
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, SCHEMA,
|
||||
];
|
||||
const ENGINE: &str = concat!("texrra-native/", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
@@ -136,6 +136,9 @@ impl FormatImage {
|
||||
if image.schema < 58 {
|
||||
image.state.restore_legacy_mathcodes()?;
|
||||
}
|
||||
if image.schema < 79 {
|
||||
image.state.restore_legacy_pdf_omission_parameters();
|
||||
}
|
||||
image.schema = SCHEMA;
|
||||
Ok(image)
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ pub enum Parameter {
|
||||
Pdfgentounicode,
|
||||
Pdfsuppresswarningdupmap,
|
||||
Pdfinfoomitdate,
|
||||
Pdfomitcharset,
|
||||
Pdfomitinfodict,
|
||||
Tracingcommands,
|
||||
Tracingrestores,
|
||||
Tracingassigns,
|
||||
@@ -154,6 +156,8 @@ impl Parameter {
|
||||
| Self::Pdfgentounicode
|
||||
| Self::Pdfsuppresswarningdupmap
|
||||
| Self::Pdfinfoomitdate
|
||||
| Self::Pdfomitcharset
|
||||
| Self::Pdfomitinfodict
|
||||
| Self::Pdfhorigin
|
||||
| Self::Pdfvorigin
|
||||
| Self::Pdflinkmargin
|
||||
@@ -192,6 +196,8 @@ impl Parameter {
|
||||
Self::Pdfgentounicode,
|
||||
Self::Pdfsuppresswarningdupmap,
|
||||
Self::Pdfinfoomitdate,
|
||||
Self::Pdfomitcharset,
|
||||
Self::Pdfomitinfodict,
|
||||
Self::Tracingcommands,
|
||||
Self::Tracingrestores,
|
||||
Self::Tracingassigns,
|
||||
|
||||
@@ -1676,15 +1676,26 @@ impl State {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn restore_legacy_pdf_omission_parameters(&mut self) {
|
||||
if self.input_profile != super::InputProfile::XeTeX {
|
||||
for parameter in [Parameter::Pdfomitcharset, Parameter::Pdfomitinfodict] {
|
||||
self.commands
|
||||
.entry(CommandName::Control(parameter.name()))
|
||||
.or_insert(Meaning::Parameter(parameter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_initex(&self) -> bool {
|
||||
self.initex
|
||||
}
|
||||
/// Final font output uses the live table and parameters, not the values
|
||||
/// captured at a page's shipout. The table is global and survives a dump.
|
||||
/// Final PDF output uses the live state after the last page ships out.
|
||||
pub fn pdf_final_options(&self) -> crate::pdf_unicode::PdfFinalOptions<'_> {
|
||||
crate::pdf_unicode::PdfFinalOptions {
|
||||
compression: self.parameter(Parameter::Pdfcompresslevel).width(),
|
||||
generate_unicode: self.parameter(Parameter::Pdfgentounicode).width(),
|
||||
omit_charset: self.parameter(Parameter::Pdfomitcharset).width() != 0,
|
||||
omit_info: self.parameter(Parameter::Pdfomitinfodict).width() != 0,
|
||||
glyph_unicode: &self.glyph_unicode,
|
||||
fonts: &self.fonts,
|
||||
page_tree_attributes: &self.pdf_pages_attributes,
|
||||
|
||||
Reference in new issue
Block a user