pub enum Font {
Show 15 variants
Helvetica,
HelveticaBold,
HelveticaOblique,
HelveticaBoldOblique,
TimesRoman,
TimesBold,
TimesItalic,
TimesBoldItalic,
Courier,
CourierBold,
CourierOblique,
CourierBoldOblique,
Symbol,
ZapfDingbats,
Custom(String),
}Expand description
PDF fonts - either standard Type 1 fonts or custom fonts.
Standard fonts are guaranteed to be available in all PDF readers and don’t need to be embedded. Custom fonts must be loaded and embedded.
Variants§
Helvetica
Helvetica (sans-serif)
HelveticaBold
Helvetica Bold
HelveticaOblique
Helvetica Oblique (italic)
HelveticaBoldOblique
Helvetica Bold Oblique
TimesRoman
Times Roman (serif)
TimesBold
Times Bold
TimesItalic
Times Italic
TimesBoldItalic
Times Bold Italic
Courier
Courier (monospace)
CourierBold
Courier Bold
CourierOblique
Courier Oblique
CourierBoldOblique
Courier Bold Oblique
Symbol
Symbol font (mathematical symbols)
ZapfDingbats
ZapfDingbats (decorative symbols)
Custom(String)
Custom font loaded from file or bytes
Implementations§
Source§impl Font
impl Font
Sourcepub fn get_metrics(&self) -> Option<&'static StandardFontMetrics>
pub fn get_metrics(&self) -> Option<&'static StandardFontMetrics>
Get the metrics for this font if it’s a standard font
Sourcepub fn get_char_width(&self, ch: u8) -> Option<i32>
pub fn get_char_width(&self, ch: u8) -> Option<i32>
Get the width of a character in font units (1000 units = 1 em)
Sourcepub fn get_string_width(&self, text: &str, font_size: f64) -> Option<f64>
pub fn get_string_width(&self, text: &str, font_size: f64) -> Option<f64>
Get the width of a string in user space units at the given font size
Sourcepub fn is_symbolic(&self) -> bool
pub fn is_symbolic(&self) -> bool
Check if this font is symbolic (doesn’t use text encodings)
Sourcepub fn with_encoding(self, encoding: FontEncoding) -> FontWithEncoding
pub fn with_encoding(self, encoding: FontEncoding) -> FontWithEncoding
Create this font with a specific encoding
Sourcepub fn with_recommended_encoding(self) -> FontWithEncoding
pub fn with_recommended_encoding(self) -> FontWithEncoding
Create this font with recommended encoding
Sourcepub fn without_encoding(self) -> FontWithEncoding
pub fn without_encoding(self) -> FontWithEncoding
Create this font without explicit encoding
Trait Implementations§
Source§impl From<Font> for FontWithEncoding
impl From<Font> for FontWithEncoding
impl Eq for Font
impl StructuralPartialEq for Font
Auto Trait Implementations§
impl Freeze for Font
impl RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin for Font
impl UnwindSafe for Font
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.