pub struct FontMetrics {
pub font_size: usize,
pub x_ppem: u16,
pub y_ppem: u16,
pub x_scale: i64,
pub y_scale: i64,
pub ascender: i64,
pub descender: i64,
pub height: i64,
pub max_advance: i64,
}
Fields§
§font_size: usize
Font size that these metrics were created for, usually 1000px (so every metric has to be divided by 1000 before it can be used for measurements)
x_ppem: u16
§y_ppem: u16
§x_scale: i64
§y_scale: i64
§ascender: i64
§descender: i64
§height: i64
§max_advance: i64
Implementations§
Source§impl FontMetrics
impl FontMetrics
pub fn zero() -> FontMetrics
pub fn get_x_ppem(&self, target_font_size: f32) -> f32
pub fn get_y_ppem(&self, target_font_size: f32) -> f32
pub fn get_x_scale(&self, target_font_size: f32) -> f32
pub fn get_y_scale(&self, target_font_size: f32) -> f32
pub fn get_ascender(&self, target_font_size: f32) -> f32
pub fn get_descender(&self, target_font_size: f32) -> f32
pub fn get_height(&self, target_font_size: f32) -> f32
pub fn get_max_advance(&self, target_font_size: f32) -> f32
Trait Implementations§
Source§impl Clone for FontMetrics
impl Clone for FontMetrics
Source§fn clone(&self) -> FontMetrics
fn clone(&self) -> FontMetrics
Returns a copy 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 moreSource§impl Debug for FontMetrics
impl Debug for FontMetrics
Source§impl Hash for FontMetrics
impl Hash for FontMetrics
Source§impl Ord for FontMetrics
impl Ord for FontMetrics
Source§fn cmp(&self, other: &FontMetrics) -> Ordering
fn cmp(&self, other: &FontMetrics) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for FontMetrics
impl PartialEq for FontMetrics
Source§impl PartialOrd for FontMetrics
impl PartialOrd for FontMetrics
impl Copy for FontMetrics
impl Eq for FontMetrics
impl StructuralPartialEq for FontMetrics
Auto Trait Implementations§
impl Freeze for FontMetrics
impl RefUnwindSafe for FontMetrics
impl Send for FontMetrics
impl Sync for FontMetrics
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)