Table of Contents

Enum ColorGlyphFormats

Namespace
Egami.Fonts
Assembly
Egami.Fonts.dll

The kinds of color glyph data a face holds.

[Flags]
public enum ColorGlyphFormats

Fields

Cbdt = 8

Google's CBDT and CBLC: PNG or BGRA images per size.

ColrV0 = 1

COLR version 0: layers of outlines, each one palette color.

ColrV1 = 2

COLR version 1: a graph of paints with gradients, transforms and compositing.

None = 0

No color data: every glyph is an outline.

Sbix = 4

Apple's sbix: PNG, JPEG or TIFF images per size.

Svg = 16

OpenType SVG documents, exposed by TryGetSvgDocument(ushort, out ReadOnlyMemory<byte>, out ushort, out ushort) but not drawn.

Examples

// Color glyphs draw in color by themselves: COLR (layers and gradients), sbix and CBDT (images), per glyph.
using (RasterCanvas<Rgba8> canvas = image.CreateCanvas())
{
    canvas.DrawText("Ship it", new Vector2(8, 40), new Font(text, 24), Rgba8.Black);
    canvas.DrawText("\U0001F680\U0001F389", new Vector2(100, 42), new Font(emoji, 32), Rgba8.Black);
}

// The palette is a font setting; the paint's color fills a glyph's foreground parts and its alpha the whole glyph.
var darkMode = new Font(emoji, 32) { Palette = FontPalette.Dark };
ColorGlyphFormats formats = emoji.ColorFormats;

// The paint graph is there to walk, for writers that draw color glyphs their own way.
emoji.TryGetColorGlyph(emoji.GetGlyph(0x1F680), darkMode.Palette, out ColorGlyph? rocket);