Struct DecorationSegment
A piece of a decoration line along a text line: its left and right x.
public readonly record struct DecorationSegment : IEquatable<DecorationSegment>
- Implements
- Inherited Members
Examples
TextStyle underlined = new()
{
FontFamilies = [family],
Decoration = new TextDecoration { Lines = TextDecorationLines.Underline, Style = TextDecorationStyle.Wavy },
};
TextLayout layout = Paragraph.Create("Typography, quickly", new ParagraphStyle { DefaultStyle = underlined }).Layout(400);
foreach (DecorationShape line in layout.Decorations)
{
// Top and Thickness place the line; Segments skip the descenders of y, p, g and q.
System.Console.WriteLine($"{line.Line} at {line.Top}: {line.Segments.Count} pieces");
}
// Or everything as outlines, to fill with any path renderer.
PathRecorder path = new();
layout.ToPath(path);
Constructors
DecorationSegment(float, float)
A piece of a decoration line along a text line: its left and right x.
public DecorationSegment(float Left, float Right)
Parameters
Examples
TextStyle underlined = new()
{
FontFamilies = [family],
Decoration = new TextDecoration { Lines = TextDecorationLines.Underline, Style = TextDecorationStyle.Wavy },
};
TextLayout layout = Paragraph.Create("Typography, quickly", new ParagraphStyle { DefaultStyle = underlined }).Layout(400);
foreach (DecorationShape line in layout.Decorations)
{
// Top and Thickness place the line; Segments skip the descenders of y, p, g and q.
System.Console.WriteLine($"{line.Line} at {line.Top}: {line.Segments.Count} pieces");
}
// Or everything as outlines, to fill with any path renderer.
PathRecorder path = new();
layout.ToPath(path);
Properties
Left
The piece's left x.
public float Left { get; init; }
Property Value
Right
The piece's right x.
public float Right { get; init; }