Table of Contents

Class FontPaletteInfo

Namespace
Egami.Fonts
Assembly
Egami.Fonts.dll

One CPAL palette of a face.

public sealed record FontPaletteInfo : IEquatable<FontPaletteInfo>
Inheritance
FontPaletteInfo
Implements
Inherited Members

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);

Constructors

FontPaletteInfo(string?, bool, bool, IReadOnlyList<Rgba8>)

One CPAL palette of a face.

public FontPaletteInfo(string? Name, bool UsableWithLightBackground, bool UsableWithDarkBackground, IReadOnlyList<Rgba8> Colors)

Parameters

Name string

The palette's English name from the name table, or null.

UsableWithLightBackground bool

Whether CPAL flags it for light backgrounds.

UsableWithDarkBackground bool

Whether CPAL flags it for dark backgrounds.

Colors IReadOnlyList<Rgba8>

The entries' colors, straight alpha.

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);

Properties

Colors

The entries' colors, straight alpha.

public IReadOnlyList<Rgba8> Colors { get; init; }

Property Value

IReadOnlyList<Rgba8>

Name

The palette's English name from the name table, or null.

public string? Name { get; init; }

Property Value

string

UsableWithDarkBackground

Whether CPAL flags it for dark backgrounds.

public bool UsableWithDarkBackground { get; init; }

Property Value

bool

UsableWithLightBackground

Whether CPAL flags it for light backgrounds.

public bool UsableWithLightBackground { get; init; }

Property Value

bool