Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

fix(fonts): let auto-deref pass the candidate objects to the program match

aiongg7eaa20799c91
diff --git a/crates/fonts/src/embedding.rs b/crates/fonts/src/embedding.rs
index 23f34dbb3..2b7b4e17e 100644
--- a/crates/fonts/src/embedding.rs
+++ b/crates/fonts/src/embedding.rs
@@ -290,7 +290,7 @@ impl<'a> ProgramMatch<'a> {
/// Whether the resource's program is this one.
fn written(&mut self, doc: &Document, w: &Written) -> bool {
- w.program.as_ref().is_some_and(|r| self.is(doc, r, &*doc.get(r)))
+ w.program.as_ref().is_some_and(|r| self.is(doc, r, &doc.get(r)))
}
}
@@ -300,7 +300,7 @@ fn existing_program(doc: &Document, fonts: &Dict, programs: &mut ProgramMatch) -
written(doc, fonts)
.find(|w| programs.written(doc, w))
.map(|w| w.program)
- .or_else(|| doc.scan_objects().take(8192).find_map(|(r, o)| programs.is(doc, r, &*o).then_some(Object::Ref(r))))
+ .or_else(|| doc.scan_objects().take(8192).find_map(|(r, o)| programs.is(doc, r, &o).then_some(Object::Ref(r))))
}
/// A `PCFull` resource that [`embed_mapping`] wrote.