Skip to content

Commit

Permalink
Handle unknown fontawesome glyph names
Browse files Browse the repository at this point in the history
We put an empty string into the unicode map for these situations.

Fixes #76
  • Loading branch information
jrmuizel committed Dec 28, 2023
1 parent aa3cc45 commit 7f079a7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,22 @@ impl<'a> PdfSimpleFont<'a> {
}
}
}
} else {
match unicode_map {
Some(ref mut unicode_map) if base_name.contains("FontAwesome") => {
// the fontawesome tex package will use glyph names that don't have a corresponding unicode
// code point, so we'll use an empty string instead. See issue #76
match unicode_map.entry(code as u32) {
Entry::Vacant(v) => { v.insert("".to_owned()); }
Entry::Occupied(e) => {
panic!("unexpected entry in unicode map")
}
}
}
_ => {
println!("unknown glyph name '{}' for font {}", name, base_name);
}
}
}
dlog!("{} = {} ({:?})", code, name, unicode);
if let Some(ref mut unicode_map) = unicode_map {
Expand Down

0 comments on commit 7f079a7

Please sign in to comment.