Table of Contents

Class TextShaper

Namespace
SixLabors.Fonts
Assembly
SixLabors.Fonts.dll

Encapsulates logic for shaping text into a positioned glyph stream.

public static class TextShaper
Inheritance
TextShaper
Inherited Members

Remarks

The text and its properties are set on a TextShapingBuffer, the buffer is shaped against a font, and the glyphs are read back from it. Shaping applies the font's substitution and positioning features but does not wrap the text.

Shape(Font, TextShapingBuffer) treats the text as unwrapped logical lines separated by hard breaks and resolves mixed-direction text within each line. ShapeRun(Font, TextShapingBuffer) shapes one directional run that has already been selected by the caller.

Advances and offsets are scaled to the supplied font's size.

Methods

Shape(Font, TextShapingBuffer)

Shapes the buffer's text as unwrapped logical lines separated by hard breaks, replacing the buffer's glyphs with each line's visually ordered glyphs.

public static void Shape(Font font, TextShapingBuffer buffer)

Parameters

font Font

The font to shape against.

buffer TextShapingBuffer

The buffer holding the line, which receives the glyphs.

Shape(Font, TextShapingBuffer, Tag[])

Shapes the buffer's text as unwrapped logical lines separated by hard breaks with the given features turned on, replacing the buffer's glyphs with each line's visually ordered glyphs.

public static void Shape(Font font, TextShapingBuffer buffer, Tag[] features)

Parameters

font Font

The font to shape against.

buffer TextShapingBuffer

The buffer holding the line, which receives the glyphs.

features Tag[]

The feature tags to turn on for the line.

ShapeRun(Font, TextShapingBuffer)

Shapes the buffer's text as one directional run, replacing the buffer's glyphs with the glyphs in reading order.

public static void ShapeRun(Font font, TextShapingBuffer buffer)

Parameters

font Font

The font to shape against.

buffer TextShapingBuffer

The buffer holding the run, which receives the glyphs.

ShapeRun(Font, TextShapingBuffer, Tag[])

Shapes the buffer's text as one directional run with the given features turned on, replacing the buffer's glyphs with the glyphs in reading order.

public static void ShapeRun(Font font, TextShapingBuffer buffer, Tag[] features)

Parameters

font Font

The font to shape against.

buffer TextShapingBuffer

The buffer holding the run, which receives the glyphs.

features Tag[]

The feature tags to turn on for the run.