FontVariationSetting Struct

The value of an axis of a variable font: a weight of 650 (wght), a width of 80 (wdth).

public readonly struct FontVariationSetting : IEquatable<FontVariationSetting>

Remarks

The tags and the ranges of the axes of a font are in Font.VariationAxes.

Implements

Constructors

NameDescription
FontVariationSetting(string, double)Initializes a new instance of the FontVariationSetting struct.

FontVariationSetting(string, double)

FontVariationSetting.cs

Initializes a new instance of the FontVariationSetting struct.

public FontVariationSetting(string tag, double value)

Parameters

tag string
The tag of the axis: four printable ASCII characters, such as wght.
value double
The value, in the units of the axis.

Exceptions

ArgumentNullException
tag is null.
ArgumentException
tag is not four printable ASCII characters, or value is not a finite number.

Properties

NameDescription
TagGets the tag of the axis.
ValueGets the value, in the units of the axis.

Gets the tag of the axis.

public string Tag { get; }

Property value

string

Gets the value, in the units of the axis.

public double Value { get; }

Property value

double

Methods

NameDescription
Equals(FontVariationSetting)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
GetHashCode()Returns the hash code for this instance.
ToString()Returns the setting in the syntax of CSS: "wght" 650.

Equals overloads

Equals(FontVariationSetting)

FontVariationSetting.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(FontVariationSetting other)
Parameters
other FontVariationSetting
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

Returns the setting in the syntax of CSS: "wght" 650.

public override string ToString()

Returns

string

Operators

NameDescription
operator ==(FontVariationSetting, FontVariationSetting)Tells whether two settings are the same axis and the same value.
operator !=(FontVariationSetting, FontVariationSetting)Tells whether two settings differ.

operator ==(FontVariationSetting, FontVariationSetting)

FontVariationSetting.cs

Tells whether two settings are the same axis and the same value.

public static bool operator ==(FontVariationSetting left, FontVariationSetting right)

operator !=(FontVariationSetting, FontVariationSetting)

FontVariationSetting.cs

Tells whether two settings differ.

public static bool operator !=(FontVariationSetting left, FontVariationSetting right)