using System; using System.Collections.Generic; namespace Avalonia.Media.TextFormatting { /// /// Represents a line of text that is used for text rendering. /// public abstract class TextLine { /// /// Gets the text runs that are contained within a line. /// /// /// The contained text runs. /// public abstract IReadOnlyList TextRuns { get; } /// /// Gets the first TextSource position of the current line. /// public abstract int FirstTextSourceIndex { get; } /// /// Gets the total number of TextSource positions of the current line. /// public abstract int Length { get; } /// /// Gets the state of the line when broken by line breaking process. /// /// /// A value that represents the line break. /// public abstract TextLineBreak? TextLineBreak { get; } /// /// Gets the distance from the top to the baseline of the current TextLine object. /// /// /// A that represents the baseline distance. /// public abstract double Baseline { get; } /// /// Gets the distance from the top-most to bottom-most black pixel in a line. /// /// /// A value that represents the extent distance. /// public abstract double Extent { get; } /// /// Gets a value that indicates whether the line is collapsed. /// /// /// true, if the line is collapsed; otherwise, false. /// public abstract bool HasCollapsed { get; } /// /// Gets a value that indicates whether content of the line overflows the specified paragraph width. /// /// /// true, the line overflows the specified paragraph width; otherwise, false. /// public abstract bool HasOverflowed { get; } /// /// Gets the height of a line of text. /// /// /// The text line height. /// public abstract double Height { get; } /// /// Gets the number of newline characters at the end of a line. /// /// /// The number of newline characters. /// public abstract int NewLineLength { get; } /// /// Gets the distance that black pixels extend beyond the bottom alignment edge of a line. /// /// /// The overhang after distance. /// public abstract double OverhangAfter { get; } /// /// Gets the distance that black pixels extend prior to the left leading alignment edge of the line. /// /// /// The overhang leading distance. /// public abstract double OverhangLeading { get; } /// /// Gets the distance that black pixels extend following the right trailing alignment edge of the line. /// /// /// The overhang trailing distance. /// public abstract double OverhangTrailing { get; } /// /// Gets the distance from the start of a paragraph to the starting point of a line. /// /// /// The distance from the start of a paragraph to the starting point of a line. /// public abstract double Start { get; } /// /// Gets the number of whitespace code points beyond the last non-blank character in a line. /// /// /// The number of whitespace code points beyond the last non-blank character in a line. /// public abstract int TrailingWhitespaceLength { get; } /// /// Gets the width of a line of text, excluding trailing whitespace characters. /// /// /// The text line width, excluding trailing whitespace characters. /// public abstract double Width { get; } /// /// Gets the width of a line of text, including trailing whitespace characters. /// /// /// The text line width, including trailing whitespace characters. /// public abstract double WidthIncludingTrailingWhitespace { get; } /// /// Draws the at the given origin. /// /// The drawing context. /// public abstract void Draw(DrawingContext drawingContext, Point lineOrigin); /// /// Create a collapsed line based on collapsed text properties. /// /// A list of /// objects that represent the collapsed text properties. /// /// A value that represents a collapsed line that can be displayed. /// public abstract TextLine Collapse(params TextCollapsingProperties?[] collapsingPropertiesList); /// /// Create a justified line based on justification text properties. /// /// An object that represent the justification text properties. /// /// A value that represents a justified line that can be displayed. /// public abstract void Justify(JustificationProperties justificationProperties); /// /// Gets the character hit corresponding to the specified distance from the beginning of the line. /// /// A value that represents the distance from the beginning of the line. /// The object at the specified distance from the beginning of the line. public abstract CharacterHit GetCharacterHitFromDistance(double distance); /// /// Gets the distance from the beginning of the line to the specified character hit. /// . /// /// The object whose distance you want to query. /// A that represents the distance from the beginning of the line. public abstract double GetDistanceFromCharacterHit(CharacterHit characterHit); /// /// Gets the next character hit for caret navigation. /// /// The current . /// The next . public abstract CharacterHit GetNextCaretCharacterHit(CharacterHit characterHit); /// /// Gets the previous character hit for caret navigation. /// /// The current . /// The previous . public abstract CharacterHit GetPreviousCaretCharacterHit(CharacterHit characterHit); /// /// Gets the previous character hit after backspacing. /// /// The current . /// The after backspacing. public abstract CharacterHit GetBackspaceCaretCharacterHit(CharacterHit characterHit); /// /// Get an array of bounding rectangles of a range of characters within a text line. /// /// index of first character of specified range /// number of characters of the specified range /// an array of bounding rectangles. public abstract IReadOnlyList GetTextBounds(int firstTextSourceCharacterIndex, int textLength); } }