pub enum LineHeight {
Normal,
Px(f32),
}Expand description
CSS line-height value.
Normal defers resolution to the point where font metrics are available,
computing (ascent + |descent| + lineGap) / upem * fontSize.
Px is an already-resolved pixel value from an explicit CSS declaration
(e.g. line-height: 1.5 → Px(fontSize * 1.5)).
Variants§
Normal
line-height: normal — resolve from font metrics at layout time
Px(f32)
Pre-resolved pixel value (from CSS line-height: <number|length|percentage>)
Implementations§
Source§impl LineHeight
impl LineHeight
Sourcepub fn resolve(
&self,
font_size_px: f32,
ascent: f32,
descent: f32,
line_gap: f32,
units_per_em: u16,
) -> f32
pub fn resolve( &self, font_size_px: f32, ascent: f32, descent: f32, line_gap: f32, units_per_em: u16, ) -> f32
Resolve to a pixel value, using font metrics when Normal.
ascent, descent (negative in OpenType convention), line_gap are in font units.
font_size_px and units_per_em are used to scale.
Sourcepub fn resolve_with_metrics(
&self,
font_size_px: f32,
metrics: &LayoutFontMetrics,
) -> f32
pub fn resolve_with_metrics( &self, font_size_px: f32, metrics: &LayoutFontMetrics, ) -> f32
Resolve using a LayoutFontMetrics struct for convenience.
Trait Implementations§
Source§impl Clone for LineHeight
impl Clone for LineHeight
Source§fn clone(&self) -> LineHeight
fn clone(&self) -> LineHeight
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 LineHeight
impl Debug for LineHeight
Source§impl Default for LineHeight
impl Default for LineHeight
Source§impl Hash for LineHeight
impl Hash for LineHeight
Source§impl PartialEq for LineHeight
impl PartialEq for LineHeight
impl Copy for LineHeight
impl Eq for LineHeight
Auto Trait Implementations§
impl Freeze for LineHeight
impl RefUnwindSafe for LineHeight
impl Send for LineHeight
impl Sync for LineHeight
impl Unpin for LineHeight
impl UnsafeUnpin for LineHeight
impl UnwindSafe for LineHeight
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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 more