pub enum Encoding {
Standard,
Expert,
IsoLatin1,
Custom(Box<[Option<Box<str>>; 256]>),
}Expand description
The font’s built-in character-code → glyph-name mapping.
The Custom case stores names rather than glyph ids so a caller can ask
what a code means even when the /CharStrings dictionary has no such
glyph — which is exactly the situation a subsetted font leaves behind.
Variants§
Standard
Adobe StandardEncoding.
Expert
Adobe ExpertEncoding.
IsoLatin1
Adobe ISOLatin1Encoding.
Custom(Box<[Option<Box<str>>; 256]>)
A vector the font built itself. Entries the font left at .notdef are
None.
Implementations§
Source§impl Encoding
impl Encoding
Sourcepub fn glyph_name(&self, code: u8) -> Option<&str>
pub fn glyph_name(&self, code: u8) -> Option<&str>
The glyph name a character code selects, or None where the vector is
.notdef.
use pdfrum_type1::Encoding;
assert_eq!(Encoding::Standard.glyph_name(b'A'), Some("A"));
assert_eq!(Encoding::Standard.glyph_name(b'\''), Some("quoteright"));
assert_eq!(Encoding::Standard.glyph_name(0), None); // .notdefSourcepub fn predefined(&self) -> Option<PredefinedEncoding>
pub fn predefined(&self) -> Option<PredefinedEncoding>
Whether this is one of the three predefined vectors, and which.
pdfrum-font needs this to reproduce PDFium’s UseType1Charmap
decision, which turns on whether the face carries a built-in Adobe
encoding rather than a font-specific one.
Trait Implementations§
impl Eq for Encoding
impl StructuralPartialEq for Encoding
Auto Trait Implementations§
impl Freeze for Encoding
impl RefUnwindSafe for Encoding
impl Send for Encoding
impl Sync for Encoding
impl Unpin for Encoding
impl UnsafeUnpin for Encoding
impl UnwindSafe for Encoding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more