#[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
impl FontMetrics
Sourcepub const fn zero() -> FontMetrics
pub const fn zero() -> FontMetrics
Only for testing, zero-sized font, will always return 0 for every metric (units_per_em = 1000
)
Sourcepub fn use_typo_metrics(&self) -> bool
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
pub fn get_ascender_unscaled(&self) -> i16
Sourcepub fn get_descender_unscaled(&self) -> i16
pub fn get_descender_unscaled(&self) -> i16
NOTE: descender is NEGATIVE
pub fn get_line_gap_unscaled(&self) -> i16
pub fn get_ascender(&self, target_font_size: f32) -> f32
pub fn get_descender(&self, target_font_size: f32) -> f32
pub fn get_line_gap(&self, target_font_size: f32) -> f32
pub fn get_x_min(&self, target_font_size: f32) -> f32
pub fn get_y_min(&self, target_font_size: f32) -> f32
pub fn get_x_max(&self, target_font_size: f32) -> f32
pub fn get_y_max(&self, target_font_size: f32) -> f32
pub fn get_advance_width_max(&self, target_font_size: f32) -> f32
pub fn get_min_left_side_bearing(&self, target_font_size: f32) -> f32
pub fn get_min_right_side_bearing(&self, target_font_size: f32) -> f32
pub fn get_x_max_extent(&self, target_font_size: f32) -> f32
pub fn get_x_avg_char_width(&self, target_font_size: f32) -> f32
pub fn get_y_subscript_x_size(&self, target_font_size: f32) -> f32
pub fn get_y_subscript_y_size(&self, target_font_size: f32) -> f32
pub fn get_y_subscript_x_offset(&self, target_font_size: f32) -> f32
pub fn get_y_subscript_y_offset(&self, target_font_size: f32) -> f32
pub fn get_y_superscript_x_size(&self, target_font_size: f32) -> f32
pub fn get_y_superscript_y_size(&self, target_font_size: f32) -> f32
pub fn get_y_superscript_x_offset(&self, target_font_size: f32) -> f32
pub fn get_y_superscript_y_offset(&self, target_font_size: f32) -> f32
pub fn get_y_strikeout_size(&self, target_font_size: f32) -> f32
pub fn get_y_strikeout_position(&self, target_font_size: f32) -> f32
pub fn get_s_typo_ascender(&self, target_font_size: f32) -> Option<f32>
pub fn get_s_typo_descender(&self, target_font_size: f32) -> Option<f32>
pub fn get_s_typo_line_gap(&self, target_font_size: f32) -> Option<f32>
pub fn get_us_win_ascent(&self, target_font_size: f32) -> Option<f32>
pub fn get_us_win_descent(&self, target_font_size: f32) -> Option<f32>
pub fn get_sx_height(&self, target_font_size: f32) -> Option<f32>
pub fn get_s_cap_height(&self, target_font_size: f32) -> Option<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 Default for FontMetrics
impl Default for FontMetrics
Source§fn default() -> FontMetrics
fn default() -> FontMetrics
Returns the “default value” for a type. Read more
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§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>
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 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>
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 moreSource§impl<T> IsDefault for T
impl<T> IsDefault for T
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Checks that type has a default value.