Table of Contents

Class GlyphOutline

Namespace
Stride.CommunityToolkit.Rendering.Text
Assembly
Stride.CommunityToolkit.dll

The vector shape of one character in a MeshFont: its contours as curves, how far the pen advances after it, and its bounds. Everything is in EM units, baseline at y = 0, pen at x = 0, y up.

public sealed class GlyphOutline
Inheritance
GlyphOutline

Constructors

GlyphOutline(int, uint, float, Vector2, Vector2, IEnumerable<GlyphContour>)

Creates an outline.

public GlyphOutline(int codepoint, uint glyphIndex, float advance, Vector2 boundsMin, Vector2 boundsMax, IEnumerable<GlyphContour> contours)

Parameters

codepoint int

The Unicode code point the outline was looked up for.

glyphIndex uint

The font's own index of the glyph; 0 is the font's "missing glyph" box.

advance float

How far the pen moves right after this glyph, in EM units.

boundsMin Vector2

The bottom-left of the outline's bounds, in EM units.

boundsMax Vector2

The top-right of the outline's bounds, in EM units.

contours IEnumerable<GlyphContour>

The contours; none for a space.

Exceptions

ArgumentNullException

The contours are null.

Properties

Advance

How far the pen moves right after this glyph, in EM units.

public float Advance { get; }

Property Value

float

BoundsMax

The top-right of the outline's bounds, in EM units; zero when there is no outline.

public Vector2 BoundsMax { get; }

Property Value

Vector2

BoundsMin

The bottom-left of the outline's bounds, in EM units; zero when there is no outline.

public Vector2 BoundsMin { get; }

Property Value

Vector2

Codepoint

The Unicode code point the outline was looked up for.

public int Codepoint { get; }

Property Value

int

Contours

The contours, as curves. A space has none; an A has two, the second being its hole.

public IReadOnlyList<GlyphContour> Contours { get; }

Property Value

IReadOnlyList<GlyphContour>

GlyphIndex

The font's own index of the glyph.

public uint GlyphIndex { get; }

Property Value

uint

IsEmpty

Whether there is nothing to draw: a space, or a control character.

public bool IsEmpty { get; }

Property Value

bool

IsMissing

Whether the font has no glyph for the code point and this is its "missing glyph" shape instead.

public bool IsMissing { get; }

Property Value

bool

Methods

Flatten(int)

Turns the curves into polygons and sorts out which contour is a hole in which: the filled shape of the glyph, ready to triangulate.

public GlyphShape Flatten(int curveQuality = 32)

Parameters

curveQuality int

How many points a full turn of curve gets; see Flatten(int).

Returns

GlyphShape

The glyph as outer polygons, each with its holes.

Exceptions

ArgumentOutOfRangeException

The quality is not positive.