FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Typeface

    struct · ferroui-base · v0.5.0

    struct Typeface
    

    Represents a typeface: a font family with a style, weight and stretch.

    View source

    Members

    new

    fn new(font_family: FontFamily) -> Self
    

    Creates a normal typeface of a font family.

    Source

    with_style

    fn with_style(font_family: FontFamily, style: FontStyle, weight: FontWeight, stretch: FontStretch) -> Self
    

    Creates a typeface.

    Panics when weight is not positive.

    Source

    from_name

    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.

    Source

    from_name_with_style

    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.

    Source

    default_typeface

    fn default_typeface() -> Typeface
    

    The default typeface: the default font family, normal style.

    Source

    font_family

    fn font_family(self: &Self) -> &FontFamily
    

    Gets the font family.

    Source

    style

    fn style(self: &Self) -> FontStyle
    

    Gets the font style.

    Source

    weight

    fn weight(self: &Self) -> FontWeight
    

    Gets the font weight.

    Source

    stretch

    fn stretch(self: &Self) -> FontStretch
    

    Gets the font stretch.

    Source

    glyph_typeface

    fn glyph_typeface(self: &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.

    Source

    normalize

    fn normalize(self: &Self) -> (Typeface, String)
    

    Splits style, weight and stretch words (e.g. "Bold", "Italic") out of the primary family name. Returns the typeface with the matched values applied and the family name without the matched words.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ResourceKeyObject
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • From<&Typeface>
    • Clone
    • Debug
    • StructuralPartialEq
    • PartialEq
    • Eq
    • Default
    • Hash
    • From<FontFamily>

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.