GraphicsAPI reference
Class FontExtensions
Namespace: MicroEngine.Graphics
Assembly: MicroEngine.Text.dll
Guide: Graphics
Layout and drawing helpers that work with any IFont.
public static class FontExtensionsInheritance
Methods
DrawCentered(IFont, IRenderer, string, Vector2, Color)
Draws text centred on center, rounded to whole pixels.
public static void DrawCentered(this IFont font, IRenderer renderer, string text, Vector2 center, Color color)Parameters
font IFont
renderer IRenderer
text string
center Vector2
color Color
DrawShadowed(IFont, IRenderer, string, Vector2, Color, Color, Vector2?)
Draws text over a copy of itself in shadow, moved by offset (one pixel down and right by default).
public static void DrawShadowed(this IFont font, IRenderer renderer, string text, Vector2 position, Color color, Color shadow, Vector2? offset = null)Parameters
font IFont
renderer IRenderer
text string
position Vector2
color Color
shadow Color
offset Vector2?
MeasureWidth(IFont, string)
Width of the widest line of text in canvas pixels.
public static float MeasureWidth(this IFont font, string text)Parameters
font IFont
text string
Returns
Wrap(IFont, string, float)
Greedy word wrap that respects explicit newlines: no line is wider than maxWidth, and a word wider
than that on its own is broken between characters.
public static IReadOnlyList<string> Wrap(this IFont font, string text, float maxWidth)Parameters
font IFont
text string
maxWidth float