Typeface
struct · ferroui-base · v0.5.0
struct Typeface
Represents a typeface: a font family with a style, weight and stretch.
Members
newwith_stylefrom_namefrom_name_with_styledefault_typefacefont_familystyleweightstretchglyph_typefacenormalize
new
fn new(font_family: FontFamily) -> Self
Creates a normal typeface of a font family.
with_style
fn with_style(font_family: FontFamily, style: FontStyle, weight: FontWeight, stretch: FontStretch) -> Self
Creates a typeface.
Panics when weight is not positive.
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.
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.
default_typeface
fn default_typeface() -> Typeface
The default typeface: the default font family, normal style.
font_family
fn font_family(self: &Self) -> &FontFamily
Gets the font family.
style
fn style(self: &Self) -> FontStyle
Gets the font style.
weight
fn weight(self: &Self) -> FontWeight
Gets the font weight.
stretch
fn stretch(self: &Self) -> FontStretch
Gets the font stretch.
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.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeResourceKeyObjectPropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherFrom<&Typeface>CloneDebugStructuralPartialEqPartialEqEqDefaultHashFrom<FontFamily>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.