FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    FontVariationSettings

    struct · ferroui-base · v0.5.0

    struct FontVariationSettings
    

    An immutable, value-equal set of variable-font axis settings in user-space coordinates (e.g. wght=650,wdth=85). This is the public input form; values are normalized against a specific font's fvar/avar when applied.

    Cloning is cheap (one reference count). Variations are stored sorted by axis tag so that equality and hashing are independent of the order they were specified in.

    View source

    Members

    empty

    fn empty() -> FontVariationSettings
    

    The empty settings: no axis is varied.

    Source

    new

    fn new(variations: impl IntoIterator<Item = FontVariation>) -> Self
    

    Initializes a new instance of the FontVariationSettings class.

    When a tag appears more than once, the last occurrence wins.

    Panics when a variation's value is NaN.

    Source

    variations

    fn variations(self: &Self) -> &[FontVariation]
    

    The axis settings, sorted by axis tag.

    Source

    is_empty

    fn is_empty(self: &Self) -> bool
    

    Gets whether no axis is varied.

    Source

    try_get_value

    fn try_get_value(self: &Self, tag: OpenTypeTag) -> Option<f64>
    

    Tries to get the user-space value for an axis.

    Source

    parse

    fn parse(s: &str) -> Result<FontVariationSettings, FormatError>
    

    Parses a comma-separated list of tag=value pairs, e.g. "wght=650,wdth=85". Values use the invariant culture.

    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
    • ToString
    • ErasedDestructor
    • IntoEither
    • Clone
    • Debug
    • Default
    • FromStr
    • Display
    • PartialEq
    • Eq
    • Hash

    Availability

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