Skip to main content

Standard14

Enum Standard14 

Source
pub enum Standard14 {
Show 14 variants Helvetica, HelveticaBold, HelveticaOblique, HelveticaBoldOblique, TimesRoman, TimesBold, TimesItalic, TimesBoldItalic, Courier, CourierBold, CourierOblique, CourierBoldOblique, Symbol, ZapfDingbats,
}
Expand description

One of the fourteen standard fonts every PDF consumer provides.

Variants§

§

Helvetica

Helvetica.

§

HelveticaBold

Helvetica-Bold.

§

HelveticaOblique

Helvetica-Oblique.

§

HelveticaBoldOblique

Helvetica-BoldOblique.

§

TimesRoman

Times-Roman.

§

TimesBold

Times-Bold.

§

TimesItalic

Times-Italic.

§

TimesBoldItalic

Times-BoldItalic.

§

Courier

Courier.

§

CourierBold

Courier-Bold.

§

CourierOblique

Courier-Oblique.

§

CourierBoldOblique

Courier-BoldOblique.

§

Symbol

Symbol (font-specific encoding).

§

ZapfDingbats

ZapfDingbats (font-specific encoding).

Implementations§

Source§

impl Standard14

Source

pub const ALL: [Standard14; 14]

All fourteen, in ISO 32000 listing order.

Source

pub fn base_font(self) -> &'static str

The PostScript base font name, e.g. "Helvetica-Bold".

Source

pub fn from_base_font(name: &str) -> Option<Standard14>

Parses a PostScript base font name back to the variant. Exact names only — aliases and subset-tagged forms are the reading side’s business, not the writer’s.

Source

pub fn encode(self, text: &str) -> Result<Vec<u8>>

Encodes text to font code bytes: WinAnsi for the twelve text faces, the font-specific built-in encoding for Symbol and ZapfDingbats. A character without a code is an Error::Unencodable (crate::Error::Unencodable) — never silently dropped or replaced. Symbol and ZapfDingbats currently reject every character: their encoding tables come with a later phase.

Source

pub fn width(self, ch: char) -> Option<f32>

Advance width of one character in units per 1000 of font size, from the AFM metrics. None when the character has no code or metric.

Source

pub fn text_width(self, text: &str, size: f32) -> Result<f32>

Width of a whole string at size, in text-space units. Errors on unencodable characters, like encode; an encodable character whose glyph has no AFM metric is an Error::Other naming the glyph. No kerning — the AFM kern pairs are not bundled, so this is the sum of bare advance widths.

Trait Implementations§

Source§

impl Clone for Standard14

Source§

fn clone(&self) -> Standard14

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Standard14

Source§

impl Debug for Standard14

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Standard14

Source§

impl Hash for Standard14

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Standard14

Source§

fn eq(&self, other: &Standard14) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Standard14

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.