pub struct Typeface { /* private fields */ }Expand description
Represents a typeface: a font family with a style, weight and stretch.
Implementations§
Source§impl Typeface
impl Typeface
Sourcepub fn new(font_family: FontFamily) -> Self
pub fn new(font_family: FontFamily) -> Self
Creates a normal typeface of a font family.
Sourcepub fn with_style(
font_family: FontFamily,
style: FontStyle,
weight: FontWeight,
stretch: FontStretch,
) -> Self
pub fn with_style( font_family: FontFamily, style: FontStyle, weight: FontWeight, stretch: FontStretch, ) -> Self
Creates a typeface.
Panics when weight is not positive.
Sourcepub fn from_name(font_family_name: &str) -> Self
pub fn from_name(font_family_name: &str) -> Self
Creates a normal typeface from a font family name; an empty name gives the default font family.
Sourcepub fn from_name_with_style(
font_family_name: &str,
style: FontStyle,
weight: FontWeight,
stretch: FontStretch,
) -> Self
pub fn from_name_with_style( font_family_name: &str, style: FontStyle, weight: FontWeight, stretch: FontStretch, ) -> Self
Creates a typeface from a font family name; an empty name gives the default font family.
Sourcepub fn default_typeface() -> Typeface
pub fn default_typeface() -> Typeface
The default typeface: the default font family, normal style.
Sourcepub fn font_family(&self) -> &FontFamily
pub fn font_family(&self) -> &FontFamily
Gets the font family.
Sourcepub fn weight(&self) -> FontWeight
pub fn weight(&self) -> FontWeight
Gets the font weight.
Sourcepub fn stretch(&self) -> FontStretch
pub fn stretch(&self) -> FontStretch
Gets the font stretch.
Sourcepub fn glyph_typeface(&self) -> Rc<GlyphTypeface>
pub fn glyph_typeface(&self) -> Rc<GlyphTypeface>
Gets the glyph typeface.
Panics when the font manager cannot create one (C# throws
InvalidOperationException); use
FontManager::try_get_glyph_typeface to handle that case.
Trait Implementations§
impl Eq for Typeface
Source§impl From<&Typeface> for FontCollectionKey
impl From<&Typeface> for FontCollectionKey
Source§impl From<FontFamily> for Typeface
impl From<FontFamily> for Typeface
Source§fn from(font_family: FontFamily) -> Self
fn from(font_family: FontFamily) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Typeface
Auto Trait Implementations§
impl !Send for Typeface
impl !Sync for Typeface
impl Freeze for Typeface
impl RefUnwindSafe for Typeface
impl Unpin for Typeface
impl UnsafeUnpin for Typeface
impl UnwindSafe for Typeface
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more