FontMetrics Struct

The vertical metrics of a font: in font units for Font.Metrics, in pixels for Font.GetMetrics.

public readonly struct FontMetrics : IEquatable<FontMetrics>

Remarks

Every value is a distance: its direction is the one its description gives, whatever the direction of the y axis.

Implements

Properties

NameDescription
AscentGets the distance from the baseline to the top of a line, above the baseline.
CapHeightGets the height of the capital letters above the baseline, or 0 when the font does not declare it.
DescentGets the distance from the baseline to the bottom of a line, below the baseline.
LineGapGets the additional space the font recommends between two lines.
LineHeightGets the distance between two baselines the font recommends: FontMetrics.Ascent + FontMetrics.Descent + FontMetrics.LineGap.
StrikethroughPositionGets the distance from the baseline to the top of the strikethrough line, above the baseline.
StrikethroughThicknessGets the thickness of the strikethrough line.
UnderlinePositionGets the distance from the baseline to the top of the underline, below the baseline.
UnderlineThicknessGets the thickness of the underline.
XHeightGets the height of the lowercase letter x above the baseline, or 0 when the font does not declare it.

Gets the distance from the baseline to the top of a line, above the baseline.

public double Ascent { get; }

Property value

double

Gets the height of the capital letters above the baseline, or 0 when the font does not declare it.

public double CapHeight { get; }

Property value

double

Gets the distance from the baseline to the bottom of a line, below the baseline.

public double Descent { get; }

Property value

double

Gets the additional space the font recommends between two lines.

public double LineGap { get; }

Property value

double

LineHeight

FontMetrics.cs

Gets the distance between two baselines the font recommends: FontMetrics.Ascent + FontMetrics.Descent + FontMetrics.LineGap.

public double LineHeight { get; }

Property value

double

StrikethroughPosition

FontMetrics.cs

Gets the distance from the baseline to the top of the strikethrough line, above the baseline.

public double StrikethroughPosition { get; }

Property value

double

StrikethroughThickness

FontMetrics.cs

Gets the thickness of the strikethrough line.

public double StrikethroughThickness { get; }

Property value

double

UnderlinePosition

FontMetrics.cs

Gets the distance from the baseline to the top of the underline, below the baseline.

public double UnderlinePosition { get; }

Property value

double

UnderlineThickness

FontMetrics.cs

Gets the thickness of the underline.

public double UnderlineThickness { get; }

Property value

double

Gets the height of the lowercase letter x above the baseline, or 0 when the font does not declare it.

public double XHeight { get; }

Property value

double

Methods

NameDescription
Equals(FontMetrics)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.

Equals overloads

Equals(FontMetrics)

FontMetrics.cs

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

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

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

Equals(object?)

FontMetrics.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()

FontMetrics.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.

Operators

NameDescription
operator ==(FontMetrics, FontMetrics)Determines whether two values are equal.
operator !=(FontMetrics, FontMetrics)Determines whether two values are different.

operator ==(FontMetrics, FontMetrics)

FontMetrics.cs

Determines whether two values are equal.

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

Parameters

left FontMetrics
The first value.
right FontMetrics
The second value.

Returns

bool true when the values are equal.

operator !=(FontMetrics, FontMetrics)

FontMetrics.cs

Determines whether two values are different.

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

Parameters

left FontMetrics
The first value.
right FontMetrics
The second value.

Returns

bool true when the values are different.