Struct layout_2013::inline::InlineMetrics
source · pub struct InlineMetrics {
pub space_above_baseline: Au,
pub space_below_baseline: Au,
pub ascent: Au,
}
Expand description
Ascent and space needed above and below the baseline for a fragment. See CSS 2.1 § 10.8.1.
Descent is not included in this structure because it can be computed from the fragment’s border/content box and the ascent.
Fields§
§space_above_baseline: Au
The amount of space above the baseline needed for this fragment.
space_below_baseline: Au
The amount of space below the baseline needed for this fragment.
ascent: Au
The distance from the baseline to the top of this fragment. This can differ from
block_size_above_baseline
if the fragment needs some empty space above it due to
line-height, etc.
Implementations§
source§impl InlineMetrics
impl InlineMetrics
sourcepub fn new(
space_above_baseline: Au,
space_below_baseline: Au,
ascent: Au,
) -> InlineMetrics
pub fn new( space_above_baseline: Au, space_below_baseline: Au, ascent: Au, ) -> InlineMetrics
Creates a new set of inline metrics.
sourcepub fn from_font_metrics(
font_metrics: &FontMetrics,
line_height: Au,
) -> InlineMetrics
pub fn from_font_metrics( font_metrics: &FontMetrics, line_height: Au, ) -> InlineMetrics
Calculates inline metrics from font metrics and line block-size per CSS 2.1 § 10.8.1.
sourcefn space_needed(&self) -> Au
fn space_needed(&self) -> Au
Returns the sum of the space needed above and below the baseline.
Trait Implementations§
source§impl Clone for InlineMetrics
impl Clone for InlineMetrics
source§fn clone(&self) -> InlineMetrics
fn clone(&self) -> InlineMetrics
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 InlineMetrics
impl Debug for InlineMetrics
source§impl Serialize for InlineMetrics
impl Serialize for InlineMetrics
impl Copy for InlineMetrics
Auto Trait Implementations§
impl Freeze for InlineMetrics
impl RefUnwindSafe for InlineMetrics
impl Send for InlineMetrics
impl Sync for InlineMetrics
impl Unpin for InlineMetrics
impl UnwindSafe for InlineMetrics
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert