# FontVariationSettings

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/struct-fontvariationsettings/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/font_variation_settings.rs#L96)

## Members

- [`empty`](#function-empty)
- [`new`](#function-new)
- [`variations`](#function-variations)
- [`is_empty`](#function-is_empty)
- [`try_get_value`](#function-try_get_value)
- [`parse`](#function-parse)

<a id="function-empty"></a>

### empty

```rust
fn empty() -> FontVariationSettings
```

The empty settings: no axis is varied.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/font_variation_settings.rs#L109)

<a id="function-new"></a>

### new

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/font_variation_settings.rs#L122)

<a id="function-variations"></a>

### variations

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

The axis settings, sorted by axis tag.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/font_variation_settings.rs#L145)

<a id="function-is_empty"></a>

### is_empty

```rust
fn is_empty(self: &Self) -> bool
```

Gets whether no axis is varied.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/font_variation_settings.rs#L150)

<a id="function-try_get_value"></a>

### try_get_value

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/font_variation_settings.rs#L155)

<a id="function-parse"></a>

### parse

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/font_variation_settings.rs#L161)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-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](/docs/0.5.0/api/).
