Class TextMetrics

Namespace
Forma
Assembly
Forma.dll

Measures and lays out text through Forma's unified font abstraction.

public static class TextMetrics
Inheritance
TextMetrics
Inherited Members

Methods

Layout(UIFont, string, TextLayoutOptions)

Creates a text layout for the specified font, text, and shaping options.

public static TextLayout Layout(UIFont font, string text, TextLayoutOptions options = default)

Parameters

font UIFont
text string
options TextLayoutOptions

Returns

TextLayout

LineHeight(UIFont)

Gets the rounded-up line height for the specified UI font.

public static int LineHeight(UIFont font)

Parameters

font UIFont

Returns

int

Measure(UIFont, string)

Measures text using the specified UI font.

public static Vector2 Measure(UIFont font, string text)

Parameters

font UIFont
text string

Returns

Vector2

Measure(SpriteFont, string, float)

Measures text using a MonoGame sprite font at the specified positive scale.

public static Vector2 Measure(SpriteFont font, string text, float scale = 1)

Parameters

font SpriteFont
text string
scale float

Returns

Vector2

Resize(UIFont, float)

Returns the font resized to a positive size, or the original font when no resize is needed.

public static UIFont Resize(UIFont font, float size)

Parameters

font UIFont
size float

Returns

UIFont