Table of Contents

Interface IGlyphRenderer

Namespace
SixLabors.Fonts.Rendering
Assembly
SixLabors.Fonts.dll

A surface that can have a glyph rendered to it as a series of actions.

public interface IGlyphRenderer
Extension Methods

Methods

ArcTo(float, float, float, bool, bool, Vector2)

Adds an elliptical arc to the current figure. The arc curves from the last point to point, choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.

The arc sweep is always less than 360 degrees. The method appends a line to the last point if either radii are zero, or if last point is equal to point. In addition the method scales the radii to fit last point and point if both are greater than zero but too small to describe an arc.

void ArcTo(float radiusX, float radiusY, float rotation, bool largeArc, bool sweep, Vector2 point)

Parameters

radiusX float

The x-radius of the ellipsis.

radiusY float

The y-radius of the ellipsis.

rotation float

The rotation along the X-axis; measured in degrees clockwise.

largeArc bool

The large arc flag, and is false if an arc spanning less than or equal to 180 degrees is chosen, or true if an arc spanning greater than 180 degrees is chosen.

sweep bool

The sweep flag, and is false if the line joining center to arc sweeps through decreasing angles, or true if it sweeps through increasing angles.

point Vector2

The end point of the arc.

BeginFigure()

Begins the figure.

void BeginFigure()

BeginGlyph(in FontRectangle, in GlyphRendererParameters)

Begins the glyph.

bool BeginGlyph(in FontRectangle bounds, in GlyphRendererParameters parameters)

Parameters

bounds FontRectangle

The bounds the glyph will be rendered at and at what size.

parameters GlyphRendererParameters

The set of parameters that uniquely represents a version of a glyph at particular font size, font family, font style and DPI.

Returns

bool

Returns true if the glyph should be rendered otherwise it returns false.

BeginLayer(Paint?, FillRule, ClipQuad?)

Begins a new painted layer with the specified paint and fill rule. All geometry commands issued after this call belong to the layer until EndLayer() is called.

void BeginLayer(Paint? paint, FillRule fillRule, ClipQuad? clipBounds)

Parameters

paint Paint

The paint definition.

fillRule FillRule

The fill rule to use when rasterizing this layer.

clipBounds ClipQuad?

The optional clip bounds to apply when rasterizing this layer.

BeginText(in FontRectangle)

Called before any glyphs have been rendered.

void BeginText(in FontRectangle bounds)

Parameters

bounds FontRectangle

The rectangle within the text will be rendered.

CubicBezierTo(Vector2, Vector2, Vector2)

Draw a cubic bezier curve connecting the previous point to point.

void CubicBezierTo(Vector2 secondControlPoint, Vector2 thirdControlPoint, Vector2 point)

Parameters

secondControlPoint Vector2

The second control point.

thirdControlPoint Vector2

The third control point.

point Vector2

The point.

EnabledDecorations()

Provides a callback to enable custom logic to request decoration details. A custom TextRun might use alternative triggers to determine what decorations it needs access to.

TextDecorations EnabledDecorations()

Returns

TextDecorations

The text decorations the render wants render info for.

EndFigure()

Ends the figure.

void EndFigure()

EndGlyph()

Ends the glyph.

void EndGlyph()

EndLayer()

Ends the current painted layer.

void EndLayer()

EndText()

Called once all glyphs have completed rendering.

void EndText()

LineTo(Vector2)

Draw a straight line connecting the previous point to point.

void LineTo(Vector2 point)

Parameters

point Vector2

The point.

MoveTo(Vector2)

Sets a new start point to draw lines from.

void MoveTo(Vector2 point)

Parameters

point Vector2

The point.

QuadraticBezierTo(Vector2, Vector2)

Draw a quadratic bezier curve connecting the previous point to point.

void QuadraticBezierTo(Vector2 secondControlPoint, Vector2 point)

Parameters

secondControlPoint Vector2

The second control point.

point Vector2

The point.

SetDecoration(TextDecorations, Vector2, Vector2, float)

Sets the details of a text decoration to be rendered. This only gets called if the decoration type was requested via EnabledDecorations() and after the glyph has been rendered via BeginGlyph(in FontRectangle, in GlyphRendererParameters) and EndGlyph().

void SetDecoration(TextDecorations textDecorations, Vector2 start, Vector2 end, float thickness)

Parameters

textDecorations TextDecorations

The type of decoration these details correspond to.

start Vector2

The start position from where to draw the decorations from.

end Vector2

The end position from where to draw the decorations to.

thickness float

The thickness to draw the decoration.