Interface IColorGlyphRenderer
Draws color glyphs of a format Egami.Drawing does not draw itself, such as the SVG documents of an OpenType SVG table
(Egami.Svg's SvgGlyphRenderer). Set on ColorGlyphRenderer, it is asked first for every glyph
whose font has that format, except where the font has a COLR version 1 glyph, so the order is COLR v1, the renderer, COLR v0,
sbix, CBDT, then the outline.
public interface IColorGlyphRenderer
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.
ColorGlyphFormats Formats { get; }
Property Value
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.
bool TryDraw(Canvas canvas, Font font, ushort glyph, Matrix3x2 transform, Paint paint)
Parameters
canvasCanvasThe canvas to draw on.
fontFontThe font, at its size.
glyphushortThe glyph id.
transformMatrix3x2Maps the glyph's space (its origin on the baseline, the font's size, y down) into the canvas's local coordinates.
paintPaintThe text's paint: its color is the foreground some glyphs draw in.
Returns
- bool
True when the glyph was drawn.