Skip to content

GraphicsAPI reference

Interface IFont

Namespace: MicroEngine.Graphics
Assembly: MicroEngine.Text.dll
Guide: Graphics

Anything that measures and draws text at one size: the built-in BitmapFont (at scale 1) and a ScalableFont at a size (At). UI widgets and layout code take an IFont, so the same code serves pixel-art and HD text.

C#
public interface IFont

Extension Methods

FontExtensions.DrawCentered(IFont, IRenderer, string, Vector2, Color), FontExtensions.DrawShadowed(IFont, IRenderer, string, Vector2, Color, Color, Vector2?), FontExtensions.MeasureWidth(IFont, string), FontExtensions.Wrap(IFont, string, float)

Properties

LineHeight

Distance between the tops of two lines, in canvas pixels.

C#
float LineHeight { get; }

Property Value

float

Methods

Draw(IRenderer, string, Vector2, Color)

Draws text with its top-left at position, in color.

C#
void Draw(IRenderer renderer, string text, Vector2 position, Color color)

Parameters

renderer IRenderer

text string

position Vector2

color Color

Measure(string)

Size of text in canvas pixels: the widest line by the height of its lines. ā€˜\n’ starts a new line.

C#
Vector2 Measure(string text)

Parameters

text string

Returns

Vector2