Table of Contents

Class FastTextRenderer

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

Renders text with a fixed size font.

public class FastTextRenderer : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Inheritance
FastTextRenderer
Implements
Inherited Members
Extension Methods

Constructors

FastTextRenderer(GraphicsContext, int)

public FastTextRenderer(GraphicsContext graphicsContext, int maxCharacterCount = 7000)

Parameters

graphicsContext GraphicsContext
maxCharacterCount int

Properties

DebugSpriteFont

Sets or gets the sprite font texture to use when drawing the text. The sprite font must have fixed size of DebugSpriteWidth and DebugSpriteHeight and each glyph should have uniform size of GlyphWidth and GlyphHeight

public Texture DebugSpriteFont { get; set; }

Property Value

Texture

DebugSpriteHeight

Height of font Texture DebugSpriteFont.

public int DebugSpriteHeight { get; set; }

Property Value

int

DebugSpriteWidth

Width of font Texture DebugSpriteFont.

public int DebugSpriteWidth { get; set; }

Property Value

int

GlyphHeight

Height of a single glyph of font DebugSpriteFont.

public int GlyphHeight { get; set; }

Property Value

int

GlyphWidth

Width of a single glyph of font DebugSpriteFont.

public int GlyphWidth { get; set; }

Property Value

int

MatrixTransform

A general matrix transformation for the text. Should include view and projection if needed.

public Matrix MatrixTransform { get; set; }

Property Value

Matrix

TextColor

Sets or gets the color to use when drawing the text.

public Color4 TextColor { get; set; }

Property Value

Color4

Methods

Begin(GraphicsContext)

Begins text rendering (swaps and maps the vertex buffer to write to).

public void Begin(GraphicsContext graphicsContext)

Parameters

graphicsContext GraphicsContext

The current GraphicsContext.

Destroy()

Disposes of object resources.

protected override void Destroy()

DrawString(GraphicsContext, string, int, int)

Adds a string to be drawn once End() is called.

public void DrawString(GraphicsContext graphicsContext, string text, int x, int y)

Parameters

graphicsContext GraphicsContext

The current GraphicsContext.

text string

The text to draw. Should not be modified until call to End.

x int

Position of the text on the X axis (in viewport space).

y int

Position of the text on the Y axis (in viewport space).

End(GraphicsContext)

Begins text rendering (swaps and maps the vertex buffer to write to).

public void End(GraphicsContext graphicsContext)

Parameters

graphicsContext GraphicsContext

The current GraphicsContext.

GraphicsFastTextRendererGenerateVertices(RectangleF, RectangleF, string, ref int, Span<VertexPositionNormalTexture>)

public void GraphicsFastTextRendererGenerateVertices(RectangleF constantInfos, RectangleF renderInfos, string textPointer, ref int textLength, Span<VertexPositionNormalTexture> vertexBuffer)

Parameters

constantInfos RectangleF
renderInfos RectangleF
textPointer string
textLength int
vertexBuffer Span<VertexPositionNormalTexture>