Skip to content

GraphicsAPI reference

Class SizedFont

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

A ScalableFont at one size: an IFont for widgets, layout and drawing.

C#
public sealed class SizedFont : IFont

Inheritance

object ← SizedFont

Implements

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

Family

The font this size belongs to.

C#
public ScalableFont Family { get; }

Property Value

ScalableFont

LineHeight

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

C#
public float LineHeight { get; }

Property Value

float

Size

The size in pixels per em.

C#
public float Size { get; }

Property Value

float

Methods

Draw(IRenderer, string, Vector2, Color)

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

C#
public 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#
public Vector2 Measure(string text)

Parameters

text string

Returns

Vector2

Prepare(string)

Rasterizes characters at this size now (see Prepare).

C#
public void Prepare(string characters)

Parameters

characters string