FontFeature Struct

A feature of the OpenType Layout tables of a font, turned on or off for a text: ligatures (liga), kerning (kern), small capitals (smcp), tabular figures (tnum), a stylistic set (ss01)...

public readonly struct FontFeature : IEquatable<FontFeature>

Remarks

A feature is named by its registered tag of four characters. A value of 0 turns it off and 1 turns it on; a larger value selects one of several alternates when the feature offers a choice (salt, cv01). A feature the font does not have changes nothing.

Implements

Constructors

NameDescription
FontFeature(string, int)Initializes a feature setting.

FontFeature(string, int)

FontFeature.cs

Initializes a feature setting.

public FontFeature(string tag, int value = 1)

Parameters

tag string
The tag of the feature: four printable ASCII characters.
value int
0 to turn the feature off, 1 to turn it on, or the number of an alternate.

Exceptions

ArgumentNullException
tag is null.
ArgumentException
tag is not four printable ASCII characters.
ArgumentOutOfRangeException
value is negative or greater than 65535.

Properties

NameDescription
TagGets the tag of the feature.
ValueGets the value of the feature: 0 is off, 1 is on, a larger value is the number of an alternate.

Gets the tag of the feature.

public string Tag { get; }

Property value

string

Gets the value of the feature: 0 is off, 1 is on, a larger value is the number of an alternate.

public int Value { get; }

Property value

int

Methods

NameDescription
Equals(FontFeature)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 feature in the form liga=0.

Equals overloads

Equals(FontFeature)

FontFeature.cs

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

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

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

Equals(object?)

FontFeature.cs

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.

GetHashCode()

FontFeature.cs

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.

ToString()

FontFeature.cs

Returns the feature in the form liga=0.

public override string ToString()

Returns

string

Operators

NameDescription
operator ==(FontFeature, FontFeature)Determines whether two feature settings are the same.
operator !=(FontFeature, FontFeature)Determines whether two feature settings differ.

operator ==(FontFeature, FontFeature)

FontFeature.cs

Determines whether two feature settings are the same.

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

Parameters

left FontFeature
right FontFeature

Returns

bool

operator !=(FontFeature, FontFeature)

FontFeature.cs

Determines whether two feature settings differ.

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

Parameters

left FontFeature
right FontFeature

Returns

bool