TextLine Struct

A line of a TextLayout: the part of the text it holds and where it is.

public readonly struct TextLine : IEquatable<TextLine>

Remarks

The line of a vertical layout (TextLayoutOptions.WritingMode) is a column: TextLine.X, TextLine.Y, TextLine.Width and TextLine.Height are still the rectangle of its text on the image, so its height is the length of its text and its width is its thickness.

Implements

Properties

NameDescription
BaselineGets the distance from the top of the line to its baseline, in pixels. In a vertical layout, it is the distance from the left of the column to its central baseline.
HeightGets the height of the line, in pixels. In a vertical layout, it is the length of the text of the column, without the spaces that end it.
IsRightToLeftGets a value indicating whether the paragraph of the line is laid out from right to left.
LengthGets the number of characters of the line, in UTF-16 code units, with the spaces and the line break that end it. The lines of a layout follow each other in the text.
StartGets the index of the first character of the line in the text.
WidthGets the width of the text of the line, in pixels, without the spaces that end it. In a vertical layout, it is the width of the column.
XGets the distance from the left of the layout to the left of the text of the line, in pixels: where the alignment puts it. In a vertical layout, it is the left of the column.
YGets the distance from the top of the layout to the top of the line, in pixels. In a vertical layout, it is where the text of the column starts: where the alignment puts it.

Baseline

TextLine.cs

Gets the distance from the top of the line to its baseline, in pixels. In a vertical layout, it is the distance from the left of the column to its central baseline.

public double Baseline { get; }

Property value

double

Gets the height of the line, in pixels. In a vertical layout, it is the length of the text of the column, without the spaces that end it.

public double Height { get; }

Property value

double

IsRightToLeft

TextLine.cs

Gets a value indicating whether the paragraph of the line is laid out from right to left.

public bool IsRightToLeft { get; }

Property value

bool

Gets the number of characters of the line, in UTF-16 code units, with the spaces and the line break that end it. The lines of a layout follow each other in the text.

public int Length { get; }

Property value

int

Gets the index of the first character of the line in the text.

public int Start { get; }

Property value

int

Gets the width of the text of the line, in pixels, without the spaces that end it. In a vertical layout, it is the width of the column.

public double Width { get; }

Property value

double

Gets the distance from the left of the layout to the left of the text of the line, in pixels: where the alignment puts it. In a vertical layout, it is the left of the column.

public double X { get; }

Property value

double

Gets the distance from the top of the layout to the top of the line, in pixels. In a vertical layout, it is where the text of the column starts: where the alignment puts it.

public double Y { get; }

Property value

double

Methods

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

TextLine.cs

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

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

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

Equals(object?)

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

TextLine.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 ==(TextLine, TextLine)Determines whether two lines are the same.
operator !=(TextLine, TextLine)Determines whether two lines differ.

operator ==(TextLine, TextLine)

TextLine.cs

Determines whether two lines are the same.

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

Parameters

left TextLine
right TextLine

Returns

bool

operator !=(TextLine, TextLine)

TextLine.cs

Determines whether two lines differ.

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

Parameters

left TextLine
right TextLine

Returns

bool