Class GlyphOutline
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
codepointintThe Unicode code point the outline was looked up for.
glyphIndexuintThe font's own index of the glyph; 0 is the font's "missing glyph" box.
advancefloatHow far the pen moves right after this glyph, in EM units.
boundsMinVector2The bottom-left of the outline's bounds, in EM units.
boundsMaxVector2The top-right of the outline's bounds, in EM units.
contoursIEnumerable<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
BoundsMax
The top-right of the outline's bounds, in EM units; zero when there is no outline.
public Vector2 BoundsMax { get; }
Property Value
BoundsMin
The bottom-left of the outline's bounds, in EM units; zero when there is no outline.
public Vector2 BoundsMin { get; }
Property Value
Codepoint
The Unicode code point the outline was looked up for.
public int Codepoint { get; }
Property Value
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
GlyphIndex
The font's own index of the glyph.
public uint GlyphIndex { get; }
Property Value
IsEmpty
Whether there is nothing to draw: a space, or a control character.
public bool IsEmpty { get; }
Property Value
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
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
curveQualityintHow 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.