Table of Contents

Struct GlyphExtents

Namespace
Egami.Fonts
Assembly
Egami.Fonts.dll

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

XMin float

The left edge.

YMin float

The bottom edge.

XMax float

The right edge.

YMax float

The 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

GlyphExtents

Height

Gets the height.

public float Height { get; }

Property Value

float

IsEmpty

Gets whether the box has no area.

public bool IsEmpty { get; }

Property Value

bool

Width

Gets the width.

public float Width { get; }

Property Value

float

XMax

The right edge.

public float XMax { get; init; }

Property Value

float

XMin

The left edge.

public float XMin { get; init; }

Property Value

float

YMax

The top edge.

public float YMax { get; init; }

Property Value

float

YMin

The bottom edge.

public float YMin { get; init; }

Property Value

float

Methods

Scale(float)

Returns the box scaled by scale.

public GlyphExtents Scale(float scale)

Parameters

scale float

The factor, such as a font size over units per em.

Returns

GlyphExtents

The scaled box.