Table of Contents

Class FontGlyphMetrics

Namespace
SixLabors.Fonts
Assembly
SixLabors.Fonts.dll

Represents a glyph metric from a particular font face.

public abstract class FontGlyphMetrics
Inheritance
FontGlyphMetrics
Derived
Inherited Members

Properties

AdvanceHeight

Gets the advance height for vertical layout, expressed in font units.

public ushort AdvanceHeight { get; }

Property Value

ushort

AdvanceWidth

Gets the advance width for horizontal layout, expressed in font units.

public ushort AdvanceWidth { get; }

Property Value

ushort

BottomSideBearing

Gets the bottom side bearing for vertical layout, expressed in font units.

public short BottomSideBearing { get; }

Property Value

short

CodePoint

Gets the Unicode codepoint of the glyph.

public CodePoint CodePoint { get; }

Property Value

CodePoint

GlyphId

Gets the id of the glyph within the font tables.

public ushort GlyphId { get; }

Property Value

ushort

GlyphType

Gets the glyph type.

public GlyphType GlyphType { get; }

Property Value

GlyphType

Height

Gets the height, expressed in font units.

public float Height { get; }

Property Value

float

LeftSideBearing

Gets the left side bearing for horizontal layout, expressed in font units.

public short LeftSideBearing { get; }

Property Value

short

RightSideBearing

Gets the right side bearing for horizontal layout, expressed in font units.

public short RightSideBearing { get; }

Property Value

short

ScaleFactor

Gets the scale factor that is applied to all glyphs in this face. Normally calculated as 72 * UnitsPerEm so that 1pt = 1px unless the glyph has TextAttributes that apply scaling adjustment.

public Vector2 ScaleFactor { get; }

Property Value

Vector2

TextAttributes

Gets the text attributes applied to the glyph.

public TextAttributes TextAttributes { get; }

Property Value

TextAttributes

TextDecorations

Gets the text decorations applied to the glyph.

public TextDecorations TextDecorations { get; }

Property Value

TextDecorations

TopSideBearing

Gets the top side bearing for vertical layout, expressed in font units.

public short TopSideBearing { get; }

Property Value

short

UnitsPerEm

Gets the number of font units per EM square for this face.

public ushort UnitsPerEm { get; }

Property Value

ushort

Width

Gets the width, expressed in font units.

public float Width { get; }

Property Value

float

Methods

ShouldSkipGlyphRendering(CodePoint)

Gets a value indicating whether the specified code point should be skipped when rendering: line terminators participate in layout but have no glyph to draw.

protected static bool ShouldSkipGlyphRendering(CodePoint codePoint)

Parameters

codePoint CodePoint

The code point.

Returns

bool

The bool.

TryGetHintedAdvanceWidth(float, float, HintingMode, out float)

Attempts to compute the whole pixel advance width for the glyph under full hinting. Outline formats that grid fit under Full override this so layout can accumulate whole pixel advances matching the fitted outlines. The base implementation never applies: glyphs without fitted outlines keep their shaped fractional advances. Implementations must not execute hinting or touch outline caches, as this runs on the layout hot path.

public virtual bool TryGetHintedAdvanceWidth(float pointSize, float dpi, HintingMode hintingMode, out float advancePx)

Parameters

pointSize float

The font size in pt units.

dpi float

The DPI (Dots Per Inch) to render/measure the glyph at

hintingMode HintingMode

The requested hinting mode.

advancePx float

The advance width in whole device pixels.

Returns

bool

true if a hinted advance applies; otherwise, false.