Skip to content

Commit

Permalink
"Type" is optional in Encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmuizel committed Aug 29, 2024
1 parent 27743f2 commit 330f9e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ impl<'a> PdfSimpleFont<'a> {
}
}
}
let name = pdf_to_utf8(encoding.get(b"Type").unwrap().as_name().unwrap());
// "Type" is optional
let name = encoding.get(b"Type").and_then(|x| x.as_name()).and_then(|x| Ok(pdf_to_utf8(x)));
dlog!("name: {}", name);

encoding_table = Some(table);
Expand Down

0 comments on commit 330f9e5

Please sign in to comment.