pub enum FontRelativeLength {
Em(CSSFloat),
Ex(CSSFloat),
Ch(CSSFloat),
Cap(CSSFloat),
Ic(CSSFloat),
Rem(CSSFloat),
}
Expand description
A font relative length.
Variants§
Em(CSSFloat)
A “em” value: https://drafts.csswg.org/css-values/#em
Ex(CSSFloat)
A “ex” value: https://drafts.csswg.org/css-values/#ex
Ch(CSSFloat)
A “ch” value: https://drafts.csswg.org/css-values/#ch
Cap(CSSFloat)
A “cap” value: https://drafts.csswg.org/css-values/#cap
Ic(CSSFloat)
An “ic” value: https://drafts.csswg.org/css-values/#ic
Rem(CSSFloat)
A “rem” value: https://drafts.csswg.org/css-values/#rem
Implementations§
source§impl FontRelativeLength
impl FontRelativeLength
sourcefn unitless_value(&self) -> CSSFloat
fn unitless_value(&self) -> CSSFloat
Return the unitless, raw value.
fn unit(&self) -> &'static str
fn try_op<O>(&self, other: &Self, op: O) -> Result<Self, ()>where O: Fn(f32, f32) -> f32,
fn map(&self, op: impl FnMut(f32) -> f32) -> Self
sourcepub fn to_computed_value(
&self,
context: &Context<'_>,
base_size: FontBaseSize
) -> Length
pub fn to_computed_value( &self, context: &Context<'_>, base_size: FontBaseSize ) -> Length
Computes the font-relative length.
sourcefn reference_font_size_and_length(
&self,
context: &Context<'_>,
base_size: FontBaseSize
) -> (Length, CSSFloat)
fn reference_font_size_and_length( &self, context: &Context<'_>, base_size: FontBaseSize ) -> (Length, CSSFloat)
Return reference font size.
We use the base_size flag to pass a different size for computing font-size and unconstrained font-size.
This returns a pair, the first one is the reference font size, and the second one is the unpacked relative length.
Trait Implementations§
source§impl Clone for FontRelativeLength
impl Clone for FontRelativeLength
source§fn clone(&self) -> FontRelativeLength
fn clone(&self) -> FontRelativeLength
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 FontRelativeLength
impl Debug for FontRelativeLength
source§impl MallocSizeOf for FontRelativeLength
impl MallocSizeOf for FontRelativeLength
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl PartialEq<FontRelativeLength> for FontRelativeLength
impl PartialEq<FontRelativeLength> for FontRelativeLength
source§fn eq(&self, other: &FontRelativeLength) -> bool
fn eq(&self, other: &FontRelativeLength) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<FontRelativeLength> for FontRelativeLength
impl PartialOrd<FontRelativeLength> for FontRelativeLength
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl ToCss for FontRelativeLength
impl ToCss for FontRelativeLength
source§impl ToShmem for FontRelativeLength
impl ToShmem for FontRelativeLength
impl Copy for FontRelativeLength
impl StructuralPartialEq for FontRelativeLength
Auto Trait Implementations§
impl RefUnwindSafe for FontRelativeLength
impl Send for FontRelativeLength
impl Sync for FontRelativeLength
impl Unpin for FontRelativeLength
impl UnwindSafe for FontRelativeLength
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> MaybeBoxed<Box<T, Global>> for T
impl<T> MaybeBoxed<Box<T, Global>> for T
source§fn maybe_boxed(self) -> Box<T, Global>
fn maybe_boxed(self) -> Box<T, Global>
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