pub struct FontMetrics {
pub family: String,
pub style: String,
pub weight: u16,
pub units_per_em: Option<u16>,
pub ascender: Option<i32>,
pub descender: Option<i32>,
}Expand description
Font metrics for exact text reproduction.
Fields§
§family: StringFont family name.
style: StringFont style (normal, italic).
weight: u16Font weight (100-900).
units_per_em: Option<u16>Units per em.
ascender: Option<i32>Ascender height in font units.
descender: Option<i32>Descender depth in font units (typically negative).
Implementations§
Source§impl FontMetrics
impl FontMetrics
Sourcepub fn with_style(self, style: impl Into<String>) -> Self
pub fn with_style(self, style: impl Into<String>) -> Self
Set font style.
Sourcepub fn with_weight(self, weight: u16) -> Self
pub fn with_weight(self, weight: u16) -> Self
Set font weight.
Sourcepub fn with_metrics(
self,
units_per_em: u16,
ascender: i32,
descender: i32,
) -> Self
pub fn with_metrics( self, units_per_em: u16, ascender: i32, descender: i32, ) -> Self
Set detailed font metrics.
Trait Implementations§
Source§impl Clone for FontMetrics
impl Clone for FontMetrics
Source§fn clone(&self) -> FontMetrics
fn clone(&self) -> FontMetrics
Returns a duplicate 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<'de> Deserialize<'de> for FontMetrics
impl<'de> Deserialize<'de> for FontMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for FontMetrics
impl PartialEq for FontMetrics
Source§impl Serialize for FontMetrics
impl Serialize 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§
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