RichTextKit v0.2

RichString Class

Assembly: Topten.RichTextKit.dll
Namespace: Topten.RichTextKit

Represents a string decorated with rich text information including various helper methods for constructing rich text strings with a fluent-like API.

public class RichString

Inheritance

RichString → object

Constructors

RichString(string)

Constructs a new rich text string

Properties

DefaultAlignment

Sets the default text alignment for cases where the rich text doesn't specify an alignment

DefaultDirection

The default base text direction for cases where the rich text doesn't explicitly specify a text direction

DefaultStyle

The default text style to be used as the current style at the start of the rich string. Subsequent formatting operations will be applied over this base style.

Length

Gets the total length of the string in code points

LineCount

The number of lines in the text

MaxHeight

The maximum height of the TextBlock after which lines will be truncated and the final line will be appended with an ellipsis (...) character.

MaxLines

The maximum number of lines after which lines will be truncated and the final line will be appended with an ellipsis (...) character.

MaxWidth

The max width property sets the maximum width of a line, after which the line will be wrapped onto the next line.

MeasuredHeight

The total height of all lines.

MeasuredLength

Gets the measured length of the string up to the truncation point in code points

MeasuredWidth

The width of the widest line of text.

Revision

Returns the revision number of the content of this rich text string

Truncated

Indicates if the text was truncated due to max height or max lines constraints

Methods

Add(string)

Append text to this RichString

Add(string, string, Nullable<float>, Nullable<int>, Nullable<bool>, Nullable<UnderlineStyle>, Nullable<StrikeThroughStyle>, Nullable<float>, Nullable<SkiaSharp.SKColor>, Nullable<float>, Nullable<FontVariant>, Nullable<TextDirection>)

Adds text with various style attributes changed

Alignment(TextAlignment)

Sets the text alignment of the current paragraph

BaseDirection(TextDirection)

Sets the base text direction of the current paragraph

Bold(bool)

Changes the font weight to bold or normal

DiscardLayout()

Discards all internal layout structures

FontFamily(string)

Changes the font family

FontItalic(bool)

Changes the font italic setting

FontSize(float)

Changes the font size

FontVariant(FontVariant)

Changes the font variant

FontWeight(int)

Changes the font weight

GetCaretInfo(int)

Calculates useful information for displaying a caret

HitTest(float, float)

Hit test this string

LetterSpacing(float)

Changes the character spacing

LineHeight(float)

Changes the line height

MarginBottom(float)

Sets the bottom margin of the current paragraph

MarginLeft(float)

Sets the left margin of the current paragraph

MarginRight(float)

Sets the right margin of the current paragraph

MarginTop(float)

Sets the top margin of the current paragraph

Normal()

Resets to normal font (normal weight, italic off, underline off, strike through off, font variant off

Paint(SkiaSharp.SKCanvas, TextPaintOptions)

Paint this text block

Paint(SkiaSharp.SKCanvas, SkiaSharp.SKPoint, TextPaintOptions)

Paint this text block

Paragraph()

Starts a new text paragraph

Pop()

Restores a previous saved style from the internal stack

Push()

Saves the current style to an internal stack

StrikeThrough(StrikeThroughStyle)

Changes the strike-through style

TextColor(SkiaSharp.SKColor)

Changes the text color

TextDirection(TextDirection)

Changes the text direction

Underline(UnderlineStyle)

Changes the underline style

Overridden & Inherited

ToString()

Provides the plain-text equivalent of this RichString

Subscribe for more like this. No spam, just fun tech stuff :)