pub struct UnicodeEncoder { /* private fields */ }Expand description
Unicode encoder for PDF text strings.
Converts Unicode text to PDF string format for different encodings.
Implementations§
Source§impl UnicodeEncoder
impl UnicodeEncoder
Sourcepub fn encode_identity_h(
&mut self,
text: &str,
glyph_lookup: impl Fn(u32) -> Option<u16>,
) -> String
pub fn encode_identity_h( &mut self, text: &str, glyph_lookup: impl Fn(u32) -> Option<u16>, ) -> String
Sourcepub fn encode_char_identity_h(&self, glyph_id: u16) -> String
pub fn encode_char_identity_h(&self, glyph_id: u16) -> String
Encode a single character to Identity-H format.
Sourcepub fn encode_literal(text: &str) -> String
pub fn encode_literal(text: &str) -> String
Encode text as PDF literal string (for WinAnsi/MacRoman encoding).
Characters outside the encoding are replaced with ‘?’.
Sourcepub fn encode_utf16be(text: &str) -> String
pub fn encode_utf16be(text: &str) -> String
Encode text as PDF hex string for UTF-16BE.
Used for metadata strings and bookmarks that need full Unicode.
Sourcepub fn encode_text(text: &str) -> String
pub fn encode_text(text: &str) -> String
Encode text as PDF literal string if ASCII, otherwise as UTF-16BE hex.
This is the recommended approach for general PDF strings.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the glyph cache.
Sourcepub fn cache_size(&self) -> usize
pub fn cache_size(&self) -> usize
Get cache statistics.
Trait Implementations§
Source§impl Debug for UnicodeEncoder
impl Debug for UnicodeEncoder
Auto Trait Implementations§
impl Freeze for UnicodeEncoder
impl RefUnwindSafe for UnicodeEncoder
impl Send for UnicodeEncoder
impl Sync for UnicodeEncoder
impl Unpin for UnicodeEncoder
impl UnsafeUnpin for UnicodeEncoder
impl UnwindSafe for UnicodeEncoder
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().