Skip to main content

Encoding

Struct Encoding 

Source
pub struct Encoding { /* private fields */ }
Expand description

An encoding that can map character codes to Unicode strings.

Implementations§

Source§

impl Encoding

Source

pub fn from_name(name: &[u8]) -> Self

Create an encoding from a PDF encoding name.

Source

pub fn win_ansi() -> Self

Create WinAnsiEncoding (Windows code page 1252).

Source

pub fn mac_roman() -> Self

Create MacRomanEncoding.

Source

pub fn standard() -> Self

Create StandardEncoding (Adobe’s standard encoding for Type 1 fonts).

Source

pub fn zapf_dingbats() -> Self

Create ZapfDingbats encoding.

ZapfDingbats uses its own character set where ASCII letters map to various symbols (arrows, stars, diamonds, etc.).

Source

pub fn symbol() -> Self

Create Symbol encoding (Adobe Symbol font).

Source

pub fn apply_differences(&mut self, differences: &[PdfObject])

Apply a Differences array to modify this encoding.

Source

pub fn decode_char(&self, code: u8) -> Option<&str>

Map a character code to a Unicode string.

Source

pub fn decode_bytes(&self, data: &[u8]) -> String

Decode a byte sequence to a Unicode string.

Trait Implementations§

Source§

impl Debug for Encoding

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.