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
fontUIFonttextstringoptionsTextLayoutOptions
Returns
LineHeight(UIFont)
Gets the rounded-up line height for the specified UI font.
public static int LineHeight(UIFont font)
Parameters
fontUIFont
Returns
Measure(UIFont, string)
Measures text using the specified UI font.
public static Vector2 Measure(UIFont font, string text)
Parameters
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
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)