Table of Contents

Class SvgTextRun

Namespace
Egami.Svg
Assembly
Egami.Svg.dll

Text: one run of positioned glyphs in one font with one fill and stroke, drawn with DrawGlyphRun(GlyphRun, Vector2, Paint) so a PDF or SVG canvas keeps real text. A text element becomes a group of these and of the paths of its decorations.

public sealed record SvgTextRun : SvgNode, IEquatable<SvgNode>, IEquatable<SvgTextRun>
Inheritance
SvgTextRun
Implements
Inherited Members

Examples

// The resolved tree: groups, paths with their paints and strokes, images; styles applied and units in pixels.
static void Walk(SvgNode node, int depth)
{
    string what = node switch
    {
        SvgPath path => $"path {path.Path.Bounds} fill {path.Fill}",
        SvgGroup group => $"group of {group.Children.Count}",
        SvgImage image => $"image {image.Destination}",
        _ => node.GetType().Name,
    };
    Console.WriteLine($"{new string(' ', depth * 2)}{node.Id} {what} opacity {node.Opacity}");
    if (node is SvgGroup g)
    {
        foreach (SvgNode child in g.Children)
        {
            Walk(child, depth + 1);
        }
    }
}

Walk(document.RenderTree, 0);

Constructors

SvgTextRun(GlyphRun)

Initializes a new instance of the SvgTextRun class.

public SvgTextRun(GlyphRun run)

Parameters

run GlyphRun

The glyphs, positioned in this node's coordinates.

Properties

Antialias

Gets a value indicating whether glyph edges are antialiased (text-rendering other than optimizeSpeed).

public bool Antialias { get; init; }

Property Value

bool

Fill

Gets the fill, with fill-opacity applied, or null for none.

public Paint? Fill { get; init; }

Property Value

Paint

PaintOrder

Gets the order the fill and stroke are painted in.

public SvgPaintOrder PaintOrder { get; init; }

Property Value

SvgPaintOrder

Run

Gets the glyphs, positioned (and turned, for rotate or textPath) in this node's coordinates.

public GlyphRun Run { get; init; }

Property Value

GlyphRun

Stroke

Gets the stroke geometry, or null when there is no stroke.

public Stroke? Stroke { get; init; }

Property Value

Stroke

StrokePaint

Gets the stroke paint, with stroke-opacity applied, or null for none.

public Paint? StrokePaint { get; init; }

Property Value

Paint