Struct FontMetrics
pub struct FontMetrics {
pub top: f32,
pub ascent: f32,
pub descent: f32,
pub bottom: f32,
pub leading: f32,
pub avg_char_width: f32,
pub max_char_width: f32,
pub x_min: f32,
pub x_max: f32,
pub x_height: f32,
pub cap_height: f32,
/* private fields */
}Fields§
§top: f32Greatest extent above origin of any glyph bounding box, typically negative; deprecated with variable fonts.
ascent: f32Distance to reserve above baseline, typically negative.
descent: f32Distance to reserve below baseline, typically positive.
bottom: f32Greatest extent below origin of any glyph bounding box, typically positive; deprecated with variable fonts.
leading: f32Distance to add between lines, typically positive or zero.
avg_char_width: f32Average character width, zero if unknown.
max_char_width: f32Maximum character width, zero if unknown.
x_min: f32Greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with variable fonts.
x_max: f32Greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with variable fonts.
x_height: f32Height of lower-case ‘x’, zero if unknown, typically negative.
cap_height: f32Height of an upper-case letter, zero if unknown, typically negative.
Implementations§
§impl FontMetrics
impl FontMetrics
pub fn underline_thickness(&self) -> Option<f32>
pub fn underline_thickness(&self) -> Option<f32>
Returns Some(thickness) if the font metrics have a valid underline thickness, otherwise
None.
pub fn underline_position(&self) -> Option<f32>
pub fn underline_position(&self) -> Option<f32>
Returns Some(position) if the font metrics have a valid underline position, otherwise
None.
pub fn strikeout_thickness(&self) -> Option<f32>
pub fn strikeout_thickness(&self) -> Option<f32>
Returns Some(thickness) if the font metrics have a valid strikeout thickness, otherwise
None.
pub fn strikeout_position(&self) -> Option<f32>
pub fn strikeout_position(&self) -> Option<f32>
Returns Some(position) if the font metrics have a valid strikeout position, otherwise
None.
pub fn has_bounds(&self) -> bool
pub fn has_bounds(&self) -> bool
Returns true if the font metrics have a valid top, bottom, x_min, and x_max. If the
bounds are not valid, returns false.
Trait Implementations§
§impl Clone for FontMetrics
impl Clone for FontMetrics
§fn clone(&self) -> FontMetrics
fn clone(&self) -> FontMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FontMetrics
§impl Debug for FontMetrics
impl Debug for FontMetrics
§impl Default for FontMetrics
impl Default for FontMetrics
§fn default() -> FontMetrics
fn default() -> FontMetrics
§impl PartialEq for FontMetrics
impl PartialEq 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 UnsafeUnpin for FontMetrics
impl UnwindSafe for FontMetrics
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.