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.
Members
empty
fn empty() -> FontVariationSettings
The empty settings: no axis is varied.
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.
variations
fn variations(self: &Self) -> &[FontVariation]
The axis settings, sorted by axis tag.
is_empty
fn is_empty(self: &Self) -> bool
Gets whether no axis is varied.
try_get_value
fn try_get_value(self: &Self, tag: OpenTypeTag) -> Option<f64>
Tries to get the user-space value for an axis.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeResourceKeyObjectPropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherCloneDebugDefaultFromStrDisplayPartialEqEqHash
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.