Table of Contents

Class DebugBitmapFont5x7

Namespace
TileWorld.Engine.Render
Assembly
TileWorld.Engine.dll

Provides a tiny bitmap font used for debug overlays without a content pipeline font asset.

public sealed class DebugBitmapFont5x7
Inheritance
DebugBitmapFont5x7
Inherited Members

Constructors

DebugBitmapFont5x7(int, int)

Creates a bitmap font renderer with a fixed glyph scale and spacing.

public DebugBitmapFont5x7(int glyphScale = 2, int glyphSpacingPixels = 1)

Parameters

glyphScale int

The scale applied to each source glyph pixel.

glyphSpacingPixels int

The spacing inserted between glyphs and lines.

Properties

GlyphAdvancePixels

Gets the horizontal advance for a single glyph including spacing.

public int GlyphAdvancePixels { get; }

Property Value

int

GlyphScale

public int GlyphScale { get; }

Property Value

int

GlyphSpacingPixels

public int GlyphSpacingPixels { get; }

Property Value

int

LineHeightPixels

Gets the total line height including spacing.

public int LineHeightPixels { get; }

Property Value

int

Methods

CreateDrawCommands(string, Int2, string, ColorRgba32, float)

Converts text into sprite draw commands using the debug bitmap font.

public IReadOnlyList<SpriteDrawCommand> CreateDrawCommands(string text, Int2 topLeftPixels, string textureKey, ColorRgba32 tint, float layerDepth)

Parameters

text string

The text to draw.

topLeftPixels Int2

The top-left screen-space draw position.

textureKey string

The texture key used for the source white pixel.

tint ColorRgba32

The tint applied to generated glyph pixels.

layerDepth float

The layer depth applied to all generated commands.

Returns

IReadOnlyList<SpriteDrawCommand>

A list of sprite draw commands for the supplied text.

MeasureTextWidth(string)

Measures the width of a text string using the configured glyph metrics.

public int MeasureTextWidth(string text)

Parameters

text string

The text to measure.

Returns

int

The measured width in pixels.

Supports(char)

Returns whether the font contains a glyph for the supplied character.

public bool Supports(char character)

Parameters

character char

The character to test.

Returns

bool

true when the character is supported.