Preserve sparse XDV TrueType glyph subsets

This commit is contained in:
gloamxun committed 2026-11-29 04:03:12 +08:00
1 parent 9efededf6d
commit d6e66cad12
5 files changed
+257 -14

No files matched your search

+6 -4
View File
@@ -30,6 +30,7 @@ mod cff_fonts;
mod cid_cff;
mod legacy_cid;
mod truetype_fonts;
mod xdv_truetype;
#[path = "pdf_opentype.rs"]
mod opentype_fonts;
#[path = "pdf_opentype_unicode.rs"]
@@ -2496,10 +2497,15 @@ fn write_pdf(
}
}
}
let pdf_version = pages
.first()
.and_then(|page| page.pdf.as_ref())
.map_or((1, 4), |pdf| (pdf.file.major, i32::from(pdf.file.minor)));
let opentype = opentype_used.write(
&mut objects,
final_compression.unwrap_or(0).clamp(0, 9) as u8,
unicode,
pdf_version.0 < 2,
)?;
for plan in paint_lists.iter().filter_map(|page| page.pdf_space_plan.as_ref()) {
for id in &plan.in_font {
@@ -2973,10 +2979,6 @@ fn write_pdf(
let mut xdv_annotations = Vec::new();
// Each triple records the bead, its page, and its rectangle object.
let mut thread_rings: BTreeMap<u32, Vec<(usize, usize, usize)>> = BTreeMap::new();
let pdf_version = pages
.first()
.and_then(|page| page.pdf.as_ref())
.map_or((1, 4), |pdf| (pdf.file.major, i32::from(pdf.file.minor)));
let mut unwritten_color_spaces = BTreeMap::new();
let form_ids: BTreeMap<_, _> = images.into_iter().map(|(image, attributes, compression, auxiliary, imports)| {
let physical = |number: u32| device_objects[&number] as usize;