pub struct PdfFont {Show 15 fields
pub name: String,
pub base_font: String,
pub subtype: String,
pub widths: HashMap<u32, f64>,
pub default_width: f64,
pub to_unicode: HashMap<u32, String>,
pub encoding: String,
pub is_standard: bool,
pub flags: u32,
pub italic_angle: f64,
pub weight: f64,
pub bytes_per_code: u8,
pub ascent: f64,
pub descent: f64,
pub font_bbox: [f64; 4],
}Expand description
Represents a resolved PDF font with metrics and encoding info.
Fields§
§name: StringResource name (e.g., “F1”)
base_font: StringBase font name (e.g., “Helvetica”, “ArialMT”)
subtype: StringFont subtype (Type1, TrueType, Type0, Type3)
widths: HashMap<u32, f64>Glyph widths indexed by character code
default_width: f64Default width for missing glyphs
to_unicode: HashMap<u32, String>ToUnicode mapping: character code → Unicode string
encoding: StringEncoding name
is_standard: boolWhether this is a standard 14 font
flags: u32Font descriptor flags
italic_angle: f64Italic angle
weight: f64Font weight (estimated)
bytes_per_code: u8Bytes per character code (1 for Type1/TrueType, 2 for Type0/CID)
ascent: f64Font ascent in glyph-space units (per-mille, i.e. 1000 = 1 em)
descent: f64Font descent in glyph-space units (negative, per-mille)
font_bbox: [f64; 4]Font bounding box [llx, lly, urx, ury] in glyph-space units
Implementations§
Source§impl PdfFont
impl PdfFont
Sourcepub fn default_font(name: &str) -> Self
pub fn default_font(name: &str) -> Self
Create a default font with standard metrics.
Sourcepub fn glyph_width(&self, char_code: u32) -> f64
pub fn glyph_width(&self, char_code: u32) -> f64
Get glyph width for a character code (in glyph space, typically 1/1000 of text space).
Sourcepub fn decode_char(&self, char_code: u32) -> String
pub fn decode_char(&self, char_code: u32) -> String
Get Unicode string for a character code.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PdfFont
impl RefUnwindSafe for PdfFont
impl Send for PdfFont
impl Sync for PdfFont
impl Unpin for PdfFont
impl UnsafeUnpin for PdfFont
impl UnwindSafe for PdfFont
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<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>
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>
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 more