pub enum FontRelativeLength {
Em(CSSFloat),
Ex(CSSFloat),
Ch(CSSFloat),
Cap(CSSFloat),
Ic(CSSFloat),
Rem(CSSFloat),
Lh(CSSFloat),
Rlh(CSSFloat),
}
Expand description
A font relative length. Note that if any new value is
added here, custom_properties::NonCustomReferences::from_unit
must also be updated. Consult the comment in that function as to why.
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
Lh(CSSFloat)
A “lh” value: https://drafts.csswg.org/css-values/#lh
Rlh(CSSFloat)
A “rlh” value: https://drafts.csswg.org/css-values/#lh
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, ()>
fn map(&self, op: impl FnMut(f32) -> f32) -> Self
sourcepub fn to_computed_value(
&self,
context: &Context<'_>,
base_size: FontBaseSize,
line_height_base: LineHeightBase,
) -> Length
pub fn to_computed_value( &self, context: &Context<'_>, base_size: FontBaseSize, line_height_base: LineHeightBase, ) -> Length
Computes the font-relative length.
sourcefn reference_font_size_and_length(
&self,
context: &Context<'_>,
base_size: FontBaseSize,
line_height_base: LineHeightBase,
) -> (Length, CSSFloat)
fn reference_font_size_and_length( &self, context: &Context<'_>, base_size: FontBaseSize, line_height_base: LineHeightBase, ) -> (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
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
source§impl PartialEq for FontRelativeLength
impl PartialEq for FontRelativeLength
source§fn eq(&self, other: &FontRelativeLength) -> bool
fn eq(&self, other: &FontRelativeLength) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for FontRelativeLength
impl PartialOrd for FontRelativeLength
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
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 Freeze for FontRelativeLength
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
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>
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>
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