Struct GlyphExtents
A box around ink, such as a glyph's outline, with y up in font units or in a Font's size.
public readonly record struct GlyphExtents : IEquatable<GlyphExtents>
- Implements
- Inherited Members
Examples
// Character map, advance, ink box and kerning, all in font units with y up.
ushort a = face.GetGlyph('A'), v = face.GetGlyph('V');
float advance = face.GetAdvance(a);
GlyphExtents ink = face.GetGlyphExtents(a);
float kern = face.GetKerning(a, v);
FontExtents extents = face.Extents;
// An outline arrives through a sink: lines and quadratics for TrueType, lines and cubics for CFF.
var counter = new SegmentCounter();
face.GetGlyphOutline(a, counter);
Constructors
GlyphExtents(float, float, float, float)
A box around ink, such as a glyph's outline, with y up in font units or in a Font's size.
public GlyphExtents(float XMin, float YMin, float XMax, float YMax)
Parameters
XMinfloatThe left edge.
YMinfloatThe bottom edge.
XMaxfloatThe right edge.
YMaxfloatThe top edge.
Examples
// Character map, advance, ink box and kerning, all in font units with y up.
ushort a = face.GetGlyph('A'), v = face.GetGlyph('V');
float advance = face.GetAdvance(a);
GlyphExtents ink = face.GetGlyphExtents(a);
float kern = face.GetKerning(a, v);
FontExtents extents = face.Extents;
// An outline arrives through a sink: lines and quadratics for TrueType, lines and cubics for CFF.
var counter = new SegmentCounter();
face.GetGlyphOutline(a, counter);
Properties
Empty
Gets an empty box, the extents of a glyph with no outline such as the space.
public static GlyphExtents Empty { get; }
Property Value
Height
Gets the height.
public float Height { get; }
Property Value
IsEmpty
Gets whether the box has no area.
public bool IsEmpty { get; }
Property Value
Width
Gets the width.
public float Width { get; }
Property Value
XMax
The right edge.
public float XMax { get; init; }
Property Value
XMin
The left edge.
public float XMin { get; init; }
Property Value
YMax
The top edge.
public float YMax { get; init; }
Property Value
YMin
The bottom edge.
public float YMin { get; init; }
Property Value
Methods
Scale(float)
Returns the box scaled by scale.
public GlyphExtents Scale(float scale)
Parameters
scalefloatThe factor, such as a font size over units per em.
Returns
- GlyphExtents
The scaled box.