Struct FontMetrics

Source
#[repr(C)]
pub struct FontMetrics {
Show 55 fields pub units_per_em: u16, pub font_flags: u16, pub x_min: i16, pub y_min: i16, pub x_max: i16, pub y_max: i16, pub ascender: i16, pub descender: i16, pub line_gap: i16, pub advance_width_max: u16, pub min_left_side_bearing: i16, pub min_right_side_bearing: i16, pub x_max_extent: i16, pub caret_slope_rise: i16, pub caret_slope_run: i16, pub caret_offset: i16, pub num_h_metrics: u16, pub x_avg_char_width: i16, pub us_weight_class: u16, pub us_width_class: u16, pub fs_type: u16, pub y_subscript_x_size: i16, pub y_subscript_y_size: i16, pub y_subscript_x_offset: i16, pub y_subscript_y_offset: i16, pub y_superscript_x_size: i16, pub y_superscript_y_size: i16, pub y_superscript_x_offset: i16, pub y_superscript_y_offset: i16, pub y_strikeout_size: i16, pub y_strikeout_position: i16, pub s_family_class: i16, pub panose: [u8; 10], pub ul_unicode_range1: u32, pub ul_unicode_range2: u32, pub ul_unicode_range3: u32, pub ul_unicode_range4: u32, pub ach_vend_id: u32, pub fs_selection: u16, pub us_first_char_index: u16, pub us_last_char_index: u16, pub s_typo_ascender: OptionI16, pub s_typo_descender: OptionI16, pub s_typo_line_gap: OptionI16, pub us_win_ascent: OptionU16, pub us_win_descent: OptionU16, pub ul_code_page_range1: OptionU32, pub ul_code_page_range2: OptionU32, pub sx_height: OptionI16, pub s_cap_height: OptionI16, pub us_default_char: OptionU16, pub us_break_char: OptionU16, pub us_max_context: OptionU16, pub us_lower_optical_point_size: OptionU16, pub us_upper_optical_point_size: OptionU16,
}

Fields§

§units_per_em: u16§font_flags: u16§x_min: i16§y_min: i16§x_max: i16§y_max: i16§ascender: i16§descender: i16§line_gap: i16§advance_width_max: u16§min_left_side_bearing: i16§min_right_side_bearing: i16§x_max_extent: i16§caret_slope_rise: i16§caret_slope_run: i16§caret_offset: i16§num_h_metrics: u16§x_avg_char_width: i16§us_weight_class: u16§us_width_class: u16§fs_type: u16§y_subscript_x_size: i16§y_subscript_y_size: i16§y_subscript_x_offset: i16§y_subscript_y_offset: i16§y_superscript_x_size: i16§y_superscript_y_size: i16§y_superscript_x_offset: i16§y_superscript_y_offset: i16§y_strikeout_size: i16§y_strikeout_position: i16§s_family_class: i16§panose: [u8; 10]§ul_unicode_range1: u32§ul_unicode_range2: u32§ul_unicode_range3: u32§ul_unicode_range4: u32§ach_vend_id: u32§fs_selection: u16§us_first_char_index: u16§us_last_char_index: u16§s_typo_ascender: OptionI16§s_typo_descender: OptionI16§s_typo_line_gap: OptionI16§us_win_ascent: OptionU16§us_win_descent: OptionU16§ul_code_page_range1: OptionU32§ul_code_page_range2: OptionU32§sx_height: OptionI16§s_cap_height: OptionI16§us_default_char: OptionU16§us_break_char: OptionU16§us_max_context: OptionU16§us_lower_optical_point_size: OptionU16§us_upper_optical_point_size: OptionU16

Implementations§

Source§

impl FontMetrics

Source

pub const fn zero() -> FontMetrics

Only for testing, zero-sized font, will always return 0 for every metric (units_per_em = 1000)

Source

pub fn use_typo_metrics(&self) -> bool

If set, use OS/2.sTypoAscender - OS/2.sTypoDescender + OS/2.sTypoLineGap to calculate the height

See USE_TYPO_METRICS

Source

pub fn get_ascender_unscaled(&self) -> i16

Source

pub fn get_descender_unscaled(&self) -> i16

NOTE: descender is NEGATIVE

Source

pub fn get_line_gap_unscaled(&self) -> i16

Source

pub fn get_ascender(&self, target_font_size: f32) -> f32

Source

pub fn get_descender(&self, target_font_size: f32) -> f32

Source

pub fn get_line_gap(&self, target_font_size: f32) -> f32

Source

pub fn get_x_min(&self, target_font_size: f32) -> f32

Source

pub fn get_y_min(&self, target_font_size: f32) -> f32

Source

pub fn get_x_max(&self, target_font_size: f32) -> f32

Source

pub fn get_y_max(&self, target_font_size: f32) -> f32

Source

pub fn get_advance_width_max(&self, target_font_size: f32) -> f32

Source

pub fn get_min_left_side_bearing(&self, target_font_size: f32) -> f32

Source

pub fn get_min_right_side_bearing(&self, target_font_size: f32) -> f32

Source

pub fn get_x_max_extent(&self, target_font_size: f32) -> f32

Source

pub fn get_x_avg_char_width(&self, target_font_size: f32) -> f32

Source

pub fn get_y_subscript_x_size(&self, target_font_size: f32) -> f32

Source

pub fn get_y_subscript_y_size(&self, target_font_size: f32) -> f32

Source

pub fn get_y_subscript_x_offset(&self, target_font_size: f32) -> f32

Source

pub fn get_y_subscript_y_offset(&self, target_font_size: f32) -> f32

Source

pub fn get_y_superscript_x_size(&self, target_font_size: f32) -> f32

Source

pub fn get_y_superscript_y_size(&self, target_font_size: f32) -> f32

Source

pub fn get_y_superscript_x_offset(&self, target_font_size: f32) -> f32

Source

pub fn get_y_superscript_y_offset(&self, target_font_size: f32) -> f32

Source

pub fn get_y_strikeout_size(&self, target_font_size: f32) -> f32

Source

pub fn get_y_strikeout_position(&self, target_font_size: f32) -> f32

Source

pub fn get_s_typo_ascender(&self, target_font_size: f32) -> Option<f32>

Source

pub fn get_s_typo_descender(&self, target_font_size: f32) -> Option<f32>

Source

pub fn get_s_typo_line_gap(&self, target_font_size: f32) -> Option<f32>

Source

pub fn get_us_win_ascent(&self, target_font_size: f32) -> Option<f32>

Source

pub fn get_us_win_descent(&self, target_font_size: f32) -> Option<f32>

Source

pub fn get_sx_height(&self, target_font_size: f32) -> Option<f32>

Source

pub fn get_s_cap_height(&self, target_font_size: f32) -> Option<f32>

Trait Implementations§

Source§

impl Clone for FontMetrics

Source§

fn clone(&self) -> FontMetrics

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FontMetrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for FontMetrics

Source§

fn default() -> FontMetrics

Returns the “default value” for a type. Read more
Source§

impl Hash for FontMetrics

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for FontMetrics

Source§

fn cmp(&self, other: &FontMetrics) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for FontMetrics

Source§

fn eq(&self, other: &FontMetrics) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for FontMetrics

Source§

fn partial_cmp(&self, other: &FontMetrics) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for FontMetrics

Source§

impl Eq for FontMetrics

Source§

impl StructuralPartialEq for FontMetrics

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IsDefault for T
where T: Default + PartialEq + Copy,

Source§

fn is_default(&self) -> bool

Checks that type has a default value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool