Table of Contents

Struct FontStretch

Namespace
Xui.Core.Canvas
Assembly
Core.dll

Represents the stretch or width percentage of a font, relative to its normal width (100%).

public readonly struct FontStretch : IComparable<FontStretch>, IEquatable<FontStretch>
Implements
Inherited Members

Remarks

Values less than 100 represent condensed fonts; values greater than 100 are expanded. Font stretch supports comparison operators for ordering and matching.

Constructors

FontStretch(NFloat)

Initializes a new FontStretch with the specified numeric value.

public FontStretch(NFloat value)

Parameters

value NFloat

The numeric width percentage (e.g., 100 = normal).

Fields

Condensed

Font stretch 75% – Condensed. Common for space-constrained text.

public static readonly FontStretch Condensed

Field Value

FontStretch

Expanded

Font stretch 125% – Expanded. Wider glyph appearance.

public static readonly FontStretch Expanded

Field Value

FontStretch

ExtraCondensed

Font stretch 62.5% – Extra Condensed. Narrower than Condensed.

public static readonly FontStretch ExtraCondensed

Field Value

FontStretch

ExtraExpanded

Font stretch 150% – Extra Expanded. Significantly wider.

public static readonly FontStretch ExtraExpanded

Field Value

FontStretch

Normal

Font stretch 100% – Normal. Default glyph width.

public static readonly FontStretch Normal

Field Value

FontStretch

SemiCondensed

Font stretch 87.5% – Semi Condensed. Slightly narrower than normal.

public static readonly FontStretch SemiCondensed

Field Value

FontStretch

SemiExpanded

Font stretch 112.5% – Semi Expanded. Slightly wider than normal.

public static readonly FontStretch SemiExpanded

Field Value

FontStretch

UltraCondensed

Font stretch 50% – Ultra Condensed. Very narrow glyph width.

public static readonly FontStretch UltraCondensed

Field Value

FontStretch

UltraExpanded

Font stretch 200% – Ultra Expanded. Very wide glyphs.

public static readonly FontStretch UltraExpanded

Field Value

FontStretch

Value

The numeric percentage value of the font stretch.

public readonly NFloat Value

Field Value

NFloat

Methods

CompareTo(FontStretch)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(FontStretch other)

Parameters

other FontStretch

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

Equals(object?)

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.

Equals(FontStretch)

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

public bool Equals(FontStretch other)

Parameters

other FontStretch

An object to compare with this object.

Returns

bool

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

GetHashCode()

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.

Operators

operator ==(FontStretch, FontStretch)

Returns true if two stretch values are equal.

public static bool operator ==(FontStretch a, FontStretch b)

Parameters

a FontStretch
b FontStretch

Returns

bool

operator >(FontStretch, FontStretch)

Returns true if the left stretch is greater than the right.

public static bool operator >(FontStretch a, FontStretch b)

Parameters

a FontStretch
b FontStretch

Returns

bool

operator >=(FontStretch, FontStretch)

Returns true if the left stretch is greater than or equal to the right.

public static bool operator >=(FontStretch a, FontStretch b)

Parameters

a FontStretch
b FontStretch

Returns

bool

implicit operator FontStretch(int)

Implicitly converts an int to FontStretch.

public static implicit operator FontStretch(int value)

Parameters

value int

Returns

FontStretch

implicit operator FontStretch(NFloat)

Implicitly converts a NFloat to FontStretch.

public static implicit operator FontStretch(NFloat value)

Parameters

value NFloat

Returns

FontStretch

implicit operator FontStretch(float)

Implicitly converts a float to FontStretch.

public static implicit operator FontStretch(float value)

Parameters

value float

Returns

FontStretch

implicit operator NFloat(FontStretch)

Implicitly converts a FontStretch to NFloat.

public static implicit operator NFloat(FontStretch stretch)

Parameters

stretch FontStretch

Returns

NFloat

operator !=(FontStretch, FontStretch)

Returns true if two stretch values are not equal.

public static bool operator !=(FontStretch a, FontStretch b)

Parameters

a FontStretch
b FontStretch

Returns

bool

operator <(FontStretch, FontStretch)

Returns true if the left stretch is less than the right.

public static bool operator <(FontStretch a, FontStretch b)

Parameters

a FontStretch
b FontStretch

Returns

bool

operator <=(FontStretch, FontStretch)

Returns true if the left stretch is less than or equal to the right.

public static bool operator <=(FontStretch a, FontStretch b)

Parameters

a FontStretch
b FontStretch

Returns

bool