Class DebugBitmapFont5x7
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
glyphScaleintThe scale applied to each source glyph pixel.
glyphSpacingPixelsintThe spacing inserted between glyphs and lines.
Properties
GlyphAdvancePixels
Gets the horizontal advance for a single glyph including spacing.
public int GlyphAdvancePixels { get; }
Property Value
GlyphScale
public int GlyphScale { get; }
Property Value
GlyphSpacingPixels
public int GlyphSpacingPixels { get; }
Property Value
LineHeightPixels
Gets the total line height including spacing.
public int LineHeightPixels { get; }
Property Value
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
textstringThe text to draw.
topLeftPixelsInt2The top-left screen-space draw position.
textureKeystringThe texture key used for the source white pixel.
tintColorRgba32The tint applied to generated glyph pixels.
layerDepthfloatThe 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
textstringThe 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
charactercharThe character to test.