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
@@ -1507,7 +1507,7 @@ fn native_pdf(
|
||||
let (catalog, info) = if raw_objects.is_some() {
|
||||
(
|
||||
unicode.and_then(|options| options.catalog).map(|catalog| catalog.entries.as_slice()),
|
||||
unicode.map(|options| options.info.entries),
|
||||
unicode.filter(|options| !options.omit_info).map(|options| options.info.entries),
|
||||
)
|
||||
} else {
|
||||
(None, None)
|
||||
@@ -2176,7 +2176,8 @@ fn write_pdf(
|
||||
type1_plans.paint(key, program, owner_paint.subset,
|
||||
|| native_type1_parameters(program, owner_paint, owner.metrics()), glyphs);
|
||||
}
|
||||
let type1_references = type1_plans.write(&mut objects, compression)?;
|
||||
let omit_charset = unicode.is_some_and(|options| options.omit_charset);
|
||||
let type1_references = type1_plans.write(&mut objects, compression, omit_charset)?;
|
||||
|
||||
let mut native_font_ids = BTreeMap::new();
|
||||
for (&id, (face, paint, used)) in &native_used {
|
||||
@@ -2936,25 +2937,30 @@ fn write_pdf(
|
||||
|
||||
if let Some(level) = final_compression {
|
||||
let device = pages[0].pdf.as_ref().expect("validated native PDF options");
|
||||
let info = match unicode {
|
||||
Some(options) => {
|
||||
let info = crate::pdf_device::PdfInfo {
|
||||
entries: remapped.as_ref().and_then(|resources| resources.info.as_deref())
|
||||
.unwrap_or(options.info.entries),
|
||||
date: options.info.date,
|
||||
};
|
||||
if device.driver == crate::pdf_device::PdfDriver::Xdv {
|
||||
crate::pdf_device::xdv_document::information_dictionary(info, diagnostics)?
|
||||
} else {
|
||||
native_information_dictionary(info)
|
||||
let info = if unicode.is_some_and(|options| options.omit_info) {
|
||||
None
|
||||
} else {
|
||||
let dictionary = match unicode {
|
||||
Some(options) => {
|
||||
let info = crate::pdf_device::PdfInfo {
|
||||
entries: remapped.as_ref().and_then(|resources| resources.info.as_deref())
|
||||
.unwrap_or(options.info.entries),
|
||||
date: options.info.date,
|
||||
};
|
||||
if device.driver == crate::pdf_device::PdfDriver::Xdv {
|
||||
crate::pdf_device::xdv_document::information_dictionary(info, diagnostics)?
|
||||
} else {
|
||||
native_information_dictionary(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
None => metadata_object(metadata)
|
||||
.map(String::into_bytes)
|
||||
.unwrap_or_else(|| b"<< /Producer (texrra Route-D native) >>".to_vec()),
|
||||
None => metadata_object(metadata)
|
||||
.map(String::into_bytes)
|
||||
.unwrap_or_else(|| b"<< /Producer (texrra Route-D native) >>".to_vec()),
|
||||
};
|
||||
objects.push(dictionary);
|
||||
Some(objects.len())
|
||||
};
|
||||
objects.push(info);
|
||||
return Ok(objects::serialize(&objects, Some(objects.len()), &device.file, level.max(0).min(9) as u8));
|
||||
return Ok(objects::serialize(&objects, info, &device.file, level.clamp(0, 9) as u8));
|
||||
}
|
||||
|
||||
let info_ref = match metadata_object(metadata) {
|
||||
|
||||
Reference in new issue
Block a user