pub enum FontWeight {
UltraLight,
Thin,
Light,
Regular,
Medium,
Semibold,
Bold,
Heavy,
Black,
}Expand description
Font weight, matching UIFont.Weight / SwiftUI Font.Weight (lightest → heaviest).
Ordered by heaviness, so backends can e.g. map >= Semibold to a synthesized bold face.
Variants§
Implementations§
Source§impl FontWeight
impl FontWeight
Sourcepub const ALL: [FontWeight; 9]
pub const ALL: [FontWeight; 9]
Every rung, lightest first.
Sourcepub const fn css(self) -> u16
pub const fn css(self) -> u16
The CSS / OpenType numeric weight (100 … 900), the one number every platform font API
also speaks (Typeface.create(base, weight, italic), QFont::Weight,
DWRITE_FONT_WEIGHT, OH_Drawing_FontWeight), and what the canvas wire carries.
Sourcepub fn from_css(n: u16) -> FontWeight
pub fn from_css(n: u16) -> FontWeight
The nearest rung to a CSS weight (ties round heavier, like CSS font matching); anything outside 100 … 900 clamps.
Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
The English face name for a rung (“Semibold”), for platforms whose enumeration names
no face (see FontFace::synthesized_name).
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for FontWeight
Source§impl Debug for FontWeight
impl Debug for FontWeight
impl Eq for FontWeight
Source§impl Ord for FontWeight
impl Ord for FontWeight
Source§fn cmp(&self, other: &FontWeight) -> Ordering
fn cmp(&self, other: &FontWeight) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for FontWeight
impl PartialEq for FontWeight
Source§impl PartialOrd for FontWeight
impl PartialOrd 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§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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