ColorGlyph Class

A glyph of a color font as a display list: what the COLR table describes as a graph of paints, flattened into operations that are run in order.

public sealed class ColorGlyph

Remarks

The list is built once, when a text is laid out, from the font data, which it validates; drawing it reads the outlines of the glyphs it fills and allocates nothing. Coordinates are font units with the y axis up.

Properties

NameDescription
ClipDepthGets the greatest number of clips that are open at the same time.
ImageGets the image of a glyph the font gives as a bitmap, which the display list draws; null for a glyph made of paints.
IsEmptyGets a value indicating whether the glyph draws nothing.
LayerDepthGets the greatest number of layers that are open at the same time, the surface of the glyph included.
NumbersGets the transformations (six numbers each), the geometry of the gradients and the boxes the operations and the paints refer to.
OpsGets the operations of the display list, in the order they are run.
PaintsGets the paints the operations fill with.
StopsGets the color stops of the gradients, and the colors of the solid paints.
XMaxGets the right of the box that contains everything the glyph draws.
XMinGets the left of the box that contains everything the glyph draws.
YMaxGets the top of the box that contains everything the glyph draws.
YMinGets the bottom of the box that contains everything the glyph draws.

ClipDepth

ColorGlyph.cs

Gets the greatest number of clips that are open at the same time.

public int ClipDepth { get; }

Property value

int

Gets the image of a glyph the font gives as a bitmap, which the display list draws; null for a glyph made of paints.

public ColorImage? Image { get; }

Property value

ColorImage?

Gets a value indicating whether the glyph draws nothing.

public bool IsEmpty { get; }

Property value

bool

LayerDepth

ColorGlyph.cs

Gets the greatest number of layers that are open at the same time, the surface of the glyph included.

public int LayerDepth { get; }

Property value

int

Gets the transformations (six numbers each), the geometry of the gradients and the boxes the operations and the paints refer to.

public ReadOnlySpan<double> Numbers { get; }

Property value

ReadOnlySpan<double>

Gets the operations of the display list, in the order they are run.

public ReadOnlySpan<ColorOp> Ops { get; }

Property value

ReadOnlySpan<ColorOp>

Gets the paints the operations fill with.

public ReadOnlySpan<ColorPaint> Paints { get; }

Gets the color stops of the gradients, and the colors of the solid paints.

public ReadOnlySpan<ColorStop> Stops { get; }

Gets the right of the box that contains everything the glyph draws.

public double XMax { get; }

Property value

double

Gets the left of the box that contains everything the glyph draws.

public double XMin { get; }

Property value

double

Gets the top of the box that contains everything the glyph draws.

public double YMax { get; }

Property value

double

Gets the bottom of the box that contains everything the glyph draws.

public double YMin { get; }

Property value

double

Methods

NameDescription
FromImage(ColorImage, double, double, double, double)Creates the display list of a glyph the font gives as a bitmap: its image, drawn in a rectangle.

FromImage(ColorImage, double, double, double, double)

ColorGlyph.cs

Creates the display list of a glyph the font gives as a bitmap: its image, drawn in a rectangle.

public static ColorGlyph FromImage(ColorImage image, double left, double top, double width, double height)

Parameters

image ColorImage
The decoded image of the glyph.
left double
The left of the rectangle, in font units.
top double
The top of the rectangle, in font units.
width double
The width of the rectangle, in font units.
height double
The height of the rectangle, in font units.

Returns

ColorGlyph

Exceptions

InvalidFontException
The rectangle is outside the coordinates an outline can have.