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
impl Standard14
Sourcepub const ALL: [Standard14; 14]
pub const ALL: [Standard14; 14]
All fourteen, in ISO 32000 listing order.
Sourcepub fn from_base_font(name: &str) -> Option<Standard14>
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.
Sourcepub fn encode(self, text: &str) -> Result<Vec<u8>>
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.
Sourcepub fn width(self, ch: char) -> Option<f32>
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.
Sourcepub fn text_width(self, text: &str, size: f32) -> Result<f32>
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
impl Clone for Standard14
Source§fn clone(&self) -> Standard14
fn clone(&self) -> Standard14
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more