#[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: Panose,
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,
}Expand description
Font metrics structure containing all font-related measurements from the font file tables (head, hhea, and os/2 tables).
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: Panose§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: OptionU16Implementations§
Source§impl FontMetrics
impl FontMetrics
Sourcepub const fn zero() -> Self
pub const fn zero() -> Self
Only for testing, zero-sized font, will always return 0 for every metric
(units_per_em = 1000)
Sourcepub fn get_ascender(&self) -> i16
pub fn get_ascender(&self) -> i16
Returns the ascender value from the hhea table
Sourcepub fn get_descender(&self) -> i16
pub fn get_descender(&self) -> i16
Returns the descender value from the hhea table
Sourcepub fn get_line_gap(&self) -> i16
pub fn get_line_gap(&self) -> i16
Returns the line gap value from the hhea table
Sourcepub fn get_advance_width_max(&self) -> u16
pub fn get_advance_width_max(&self) -> u16
Returns the maximum advance width from the hhea table
Sourcepub fn get_min_left_side_bearing(&self) -> i16
pub fn get_min_left_side_bearing(&self) -> i16
Returns the minimum left side bearing from the hhea table
Sourcepub fn get_min_right_side_bearing(&self) -> i16
pub fn get_min_right_side_bearing(&self) -> i16
Returns the minimum right side bearing from the hhea table
Sourcepub fn get_x_max_extent(&self) -> i16
pub fn get_x_max_extent(&self) -> i16
Returns the maximum extent in the x direction from the hhea table
Sourcepub fn get_x_avg_char_width(&self) -> i16
pub fn get_x_avg_char_width(&self) -> i16
Returns the average character width from the os/2 table
Sourcepub fn get_y_subscript_x_size(&self) -> i16
pub fn get_y_subscript_x_size(&self) -> i16
Returns the subscript x size from the os/2 table
Sourcepub fn get_y_subscript_y_size(&self) -> i16
pub fn get_y_subscript_y_size(&self) -> i16
Returns the subscript y size from the os/2 table
Sourcepub fn get_y_subscript_x_offset(&self) -> i16
pub fn get_y_subscript_x_offset(&self) -> i16
Returns the subscript x offset from the os/2 table
Sourcepub fn get_y_subscript_y_offset(&self) -> i16
pub fn get_y_subscript_y_offset(&self) -> i16
Returns the subscript y offset from the os/2 table
Sourcepub fn get_y_superscript_x_size(&self) -> i16
pub fn get_y_superscript_x_size(&self) -> i16
Returns the superscript x size from the os/2 table
Sourcepub fn get_y_superscript_y_size(&self) -> i16
pub fn get_y_superscript_y_size(&self) -> i16
Returns the superscript y size from the os/2 table
Sourcepub fn get_y_superscript_x_offset(&self) -> i16
pub fn get_y_superscript_x_offset(&self) -> i16
Returns the superscript x offset from the os/2 table
Sourcepub fn get_y_superscript_y_offset(&self) -> i16
pub fn get_y_superscript_y_offset(&self) -> i16
Returns the superscript y offset from the os/2 table
Sourcepub fn get_y_strikeout_size(&self) -> i16
pub fn get_y_strikeout_size(&self) -> i16
Returns the strikeout size from the os/2 table
Sourcepub fn get_y_strikeout_position(&self) -> i16
pub fn get_y_strikeout_position(&self) -> i16
Returns the strikeout position from the os/2 table
Sourcepub fn use_typo_metrics(&self) -> bool
pub fn use_typo_metrics(&self) -> bool
Returns whether typographic metrics should be used (from fs_selection flag)
Trait Implementations§
Source§impl Clone for FontMetrics
impl Clone for FontMetrics
Source§fn clone(&self) -> FontMetrics
fn clone(&self) -> FontMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more