Table of Contents

Class GlyphOptions

Namespace
SixLabors.Fonts
Assembly
SixLabors.Fonts.dll

Provides configuration options for rendering a glyph by id.

public class GlyphOptions
Inheritance
GlyphOptions
Derived
Inherited Members

Properties

BaselineOffset

Gets or sets an additional shift of the text away from its anchored position, in pixel units along the block flow axis. Positive values shift toward the text's over side: upward for horizontal layouts, toward the over column side for vertical layouts, and away from the line along its normal when the text follows a path.

public float BaselineOffset { get; set; }

Property Value

float

Remarks

The shift composes with TextBaseline and moves rendered glyphs, ink bounds, and decorations as a unit. The logical advance is unaffected, matching the CSS and SVG baseline-shift model.

ColorFontSupport

Gets or sets the color font support options.

public ColorFontSupport ColorFontSupport { get; set; }

Property Value

ColorFontSupport

Remarks

A text run with a non-null ColorFontSupport value replaces this value over that run.

DecorationPositioningMode

Gets or sets the positioning mode used for rendering decorations.

public DecorationPositioningMode DecorationPositioningMode { get; set; }

Property Value

DecorationPositioningMode

Dpi

Gets or sets the DPI (Dots Per Inch) to render/measure the text at.

Defaults to 72F.

public float Dpi { get; set; }

Property Value

float

Font

Gets or sets the font.

public required Font Font { get; set; }

Property Value

Font

FontPalette

Gets or sets the color palette selection used to resolve COLR glyph colors, or null to use the font's default palette.

public FontPalette? FontPalette { get; set; }

Property Value

FontPalette

Remarks

A text run with a non-null FontPalette value replaces this value over that run.

GraphemeIndex

Gets or sets the zero-based grapheme cluster index represented by the glyph.

public int GraphemeIndex { get; set; }

Property Value

int

Remarks

This value is passed to glyph renderers through GraphemeIndex. Callers rendering shaped glyph runs should set this from the shaping cluster so grapheme-aware renderers can group glyph paths correctly. The default value is suitable for rendering a single isolated glyph.

HintingMode

Gets or sets a value indicating whether to apply hinting - The use of mathematical instructions to adjust the display of an outline font so that it lines up with a rasterized grid.

public HintingMode HintingMode { get; set; }

Property Value

HintingMode

LayoutMode

Gets or sets the layout mode for the text lines.

public LayoutMode LayoutMode { get; set; }

Property Value

LayoutMode

Origin

Gets or sets the rendering origin.

public Vector2 Origin { get; set; }

Property Value

Vector2

TextAttributes

Gets or sets the text attributes applied to the glyph.

public TextAttributes TextAttributes { get; set; }

Property Value

TextAttributes

TextBaseline

Gets or sets which reference line of the glyph's em box is placed at Origin along the block flow axis.

public TextBaseline TextBaseline { get; set; }

Property Value

TextBaseline

Remarks

Baseline positions derive from the metrics of Font. For a single glyph LineBox anchors the top of the em box, matching text layout.

TextDecorationSkipInk

Gets or sets a value indicating whether underline and overline decorations skip over glyph ink, leaving gaps around descenders and ascenders that cross the decoration. Defaults to Auto.

public TextDecorationSkipInk TextDecorationSkipInk { get; set; }

Property Value

TextDecorationSkipInk

TextDecorations

Gets or sets the text decorations applied to the glyph.

public TextDecorations TextDecorations { get; set; }

Property Value

TextDecorations

VisibleBounds

Gets or sets the visible region in pixel units (px) used when rendering the glyph. A glyph that falls outside the region is skipped.

public FontRectangle? VisibleBounds { get; set; }

Property Value

FontRectangle?

Remarks

If value is null then culling is disabled.

Methods

CreateTextRun()

Creates the text run associated with the glyph.

protected virtual TextRun CreateTextRun()

Returns

TextRun

The text run associated with the glyph.