pub struct FontWeight(/* private fields */);Expand description
A value for the font-weight property per:
https://drafts.csswg.org/css-fonts-4/#propdef-font-weight
cbindgen:derive-lt cbindgen:derive-lte cbindgen:derive-gt cbindgen:derive-gte
Implementations§
Source§impl FontWeight
impl FontWeight
Sourcepub const NORMAL: FontWeight
pub const NORMAL: FontWeight
The normal keyword.
Sourcepub const BOLD: FontWeight
pub const BOLD: FontWeight
The bold value.
Sourcepub const BOLD_THRESHOLD: FontWeight
pub const BOLD_THRESHOLD: FontWeight
The threshold from which we consider a font bold.
Sourcepub const PREFER_BOLD_THRESHOLD: FontWeight
pub const PREFER_BOLD_THRESHOLD: FontWeight
The threshold above which CSS font matching prefers bolder faces over lighter ones.
Sourcepub fn normal() -> FontWeight
pub fn normal() -> FontWeight
Returns the normal keyword value.
Sourcepub fn from_float(v: f32) -> FontWeight
pub fn from_float(v: f32) -> FontWeight
Construct a valid weight from a float value.
Sourcepub fn bolder(self) -> FontWeight
pub fn bolder(self) -> FontWeight
Return the bolder weight.
See the table in: https://drafts.csswg.org/css-fonts-4/#font-weight-numeric-values
Sourcepub fn lighter(self) -> FontWeight
pub fn lighter(self) -> FontWeight
Return the lighter weight.
See the table in: https://drafts.csswg.org/css-fonts-4/#font-weight-numeric-values
Trait Implementations§
Source§impl Clone for FontWeight
impl Clone for FontWeight
Source§fn clone(&self) -> FontWeight
fn clone(&self) -> FontWeight
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 ComputeSquaredDistance for FontWeight
impl ComputeSquaredDistance for FontWeight
Source§fn compute_squared_distance(
&self,
other: &FontWeight,
) -> Result<SquaredDistance, ()>
fn compute_squared_distance( &self, other: &FontWeight, ) -> Result<SquaredDistance, ()>
Computes the squared distance between two animatable values.
Source§impl Debug for FontWeight
impl Debug for FontWeight
Source§impl<'de> Deserialize<'de> for FontWeight
impl<'de> Deserialize<'de> for FontWeight
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FontWeight, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FontWeight, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for FontWeight
impl Hash for FontWeight
Source§impl MallocSizeOf for FontWeight
impl MallocSizeOf for FontWeight
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 for FontWeight
impl PartialEq for FontWeight
Source§impl PartialOrd for FontWeight
impl PartialOrd for FontWeight
Source§impl Serialize for FontWeight
impl Serialize for FontWeight
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl ToAnimatedValue for FontWeight
impl ToAnimatedValue for FontWeight
Source§type AnimatedValue = f32
type AnimatedValue = f32
The type of the animated value.
Source§fn to_animated_value(
self,
_: &Context<'_>,
) -> <FontWeight as ToAnimatedValue>::AnimatedValue
fn to_animated_value( self, _: &Context<'_>, ) -> <FontWeight as ToAnimatedValue>::AnimatedValue
Converts this value to an animated value.
Source§fn from_animated_value(
animated: <FontWeight as ToAnimatedValue>::AnimatedValue,
) -> FontWeight
fn from_animated_value( animated: <FontWeight as ToAnimatedValue>::AnimatedValue, ) -> FontWeight
Converts back an animated value into a computed value.
Source§impl ToCss for FontWeight
impl ToCss for FontWeight
Source§fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Result<(), Error>where
W: Write,
fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Result<(), Error>where
W: Write,
Serialize
self in CSS syntax, writing to dest.Source§fn to_css_string(&self) -> String
fn to_css_string(&self) -> String
Serialize
self in CSS syntax and return a string. Read moreSource§fn to_css_cssstring(&self) -> String
fn to_css_cssstring(&self) -> String
Serialize
self in CSS syntax and return a CssString. Read moreSource§impl ToResolvedValue for FontWeightwhere
FixedPoint<u16, style::::values::computed::font::FontWeightFixedPoint::{constant#0}>: ToResolvedValue<ResolvedValue = FixedPoint<u16, style::::values::computed::font::FontWeightFixedPoint::{constant#0}>>,
impl ToResolvedValue for FontWeightwhere
FixedPoint<u16, style::::values::computed::font::FontWeightFixedPoint::{constant#0}>: ToResolvedValue<ResolvedValue = FixedPoint<u16, style::::values::computed::font::FontWeightFixedPoint::{constant#0}>>,
Source§type ResolvedValue = FontWeight
type ResolvedValue = FontWeight
The resolved value type we’re going to be converted to.
Source§fn from_resolved_value(
from: <FontWeight as ToResolvedValue>::ResolvedValue,
) -> FontWeight
fn from_resolved_value( from: <FontWeight as ToResolvedValue>::ResolvedValue, ) -> FontWeight
Convert a resolved value to resolved value form.
Source§fn to_resolved_value(
self,
context: &Context<'_>,
) -> <FontWeight as ToResolvedValue>::ResolvedValue
fn to_resolved_value( self, context: &Context<'_>, ) -> <FontWeight as ToResolvedValue>::ResolvedValue
Convert a resolved value to a resolved value.
Source§impl ToTyped for FontWeight
impl ToTyped for FontWeight
Source§fn to_typed(&self) -> Option<TypedValue>
fn to_typed(&self) -> Option<TypedValue>
impl Copy for FontWeight
impl StructuralPartialEq for FontWeight
Auto Trait Implementations§
impl Freeze for FontWeight
impl RefUnwindSafe for FontWeight
impl Send for FontWeight
impl Sync for FontWeight
impl Unpin for FontWeight
impl UnsafeUnpin for FontWeight
impl UnwindSafe for FontWeight
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<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