pub struct FontMetrics { /* private fields */ }Expand description
Font metrics extracted from a PDF font dictionary.
Stores glyph widths and font descriptor information (ascent, descent, bounding box) needed to calculate character bounding boxes.
Width values are in glyph space units (1/1000 of text space).
Implementations§
Source§impl FontMetrics
impl FontMetrics
Sourcepub fn new(
widths: Vec<f64>,
first_char: u32,
last_char: u32,
missing_width: f64,
ascent: f64,
descent: f64,
font_bbox: Option<[f64; 4]>,
) -> Self
pub fn new( widths: Vec<f64>, first_char: u32, last_char: u32, missing_width: f64, ascent: f64, descent: f64, font_bbox: Option<[f64; 4]>, ) -> Self
Create FontMetrics from parsed PDF font dictionary values.
Sourcepub fn default_metrics() -> Self
pub fn default_metrics() -> Self
Create default FontMetrics for when font info is unavailable.
Sourcepub fn get_width(&self, char_code: u32) -> f64
pub fn get_width(&self, char_code: u32) -> f64
Get the width for a character code in glyph space (1/1000 of text space).
Sourcepub fn font_bbox(&self) -> Option<[f64; 4]>
pub fn font_bbox(&self) -> Option<[f64; 4]>
Font bounding box [llx, lly, urx, ury] in glyph space units.
Sourcepub fn missing_width(&self) -> f64
pub fn missing_width(&self) -> f64
Missing width used for characters outside the widths range.
Sourcepub fn first_char(&self) -> u32
pub fn first_char(&self) -> u32
First character code in the widths array.
Trait Implementations§
Source§impl Clone for FontMetrics
impl Clone for FontMetrics
Source§fn clone(&self) -> FontMetrics
fn clone(&self) -> FontMetrics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FontMetrics
impl RefUnwindSafe for FontMetrics
impl Send for FontMetrics
impl Sync for FontMetrics
impl Unpin for FontMetrics
impl UnsafeUnpin for FontMetrics
impl UnwindSafe for FontMetrics
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
Mutably borrows from an owned value. Read more