Table of Contents

Class SvgGlyphRenderer

Namespace
Egami.Svg
Assembly
Egami.Svg.dll

Draws the glyphs of an OpenType SVG table (question 20): each glyph's document is read once per font and kept, and the element glyphid is drawn in the font's units, its origin on the baseline. Set it on ColorGlyphRenderer; Rasterize<TPixel>(SvgRenderOptions?) uses it already.

public sealed class SvgGlyphRenderer : IColorGlyphRenderer
Inheritance
SvgGlyphRenderer
Implements
Inherited Members

Examples

// Emoji and other glyphs from an OpenType SVG table draw in color on a canvas given the renderer.
using (RasterCanvas<Rgba8> canvas = raster.CreateCanvas(new CanvasOptions { ColorGlyphRenderer = SvgGlyphRenderer.Instance }))
{
    canvas.DrawText("Hello", new System.Numerics.Vector2(10, 35), font, new SolidPaint(new RgbaF32(0, 0, 0, 1)));
}

Properties

Formats

Gets the color formats the renderer draws, such as Svg.

public ColorGlyphFormats Formats { get; }

Property Value

ColorGlyphFormats

Instance

Gets the renderer.

public static SvgGlyphRenderer Instance { get; }

Property Value

SvgGlyphRenderer

Methods

TryDraw(Canvas, Font, ushort, Matrix3x2, Paint)

Draws one glyph, or returns false when the font has nothing of the renderer's formats for it.

public bool TryDraw(Canvas canvas, Font font, ushort glyph, Matrix3x2 transform, Paint paint)

Parameters

canvas Canvas

The canvas to draw on.

font Font

The font, at its size.

glyph ushort

The glyph id.

transform Matrix3x2

Maps the glyph's space (its origin on the baseline, the font's size, y down) into the canvas's local coordinates.

paint Paint

The text's paint: its color is the foreground some glyphs draw in.

Returns

bool

True when the glyph was drawn.