GraphicsAPI reference
Class FontOptions
Namespace: MicroEngine.Graphics
Assembly: MicroEngine.Text.dll
Guide: Graphics
How a ScalableFont turns outlines into pixels.
public sealed record FontOptions : IEquatable<FontOptions>Inheritance
Implements
Constructors
FontOptions(bool, TextureFilter?, int, bool, bool)
How a ScalableFont turns outlines into pixels.
public FontOptions(bool Antialiasing = true, TextureFilter? Filter = null, int PageSize = 512, bool Kerning = true, bool SnapToPixels = true)Parameters
Antialiasing bool
Smooth glyph edges (true, the default: HD text). False gives hard edges, for pixel fonts distributed as TTF and drawn at their design size or whole multiples of it.
Filter TextureFilter?
How glyph pages are sampled when text is scaled or rotated; null follows the game’s default (DefaultFilter, from its presentation’s default sampler), whether the text is antialiased or not.
PageSize int
Width and height of each glyph page texture: 512 by default (1 MB), enough for the printable ASCII of a few sizes; another page is added when one fills up.
Kerning bool
Applies the font’s kerning pairs (true by default).
SnapToPixels bool
Places each glyph on whole canvas pixels (true by default) so unscaled text stays sharp; false keeps fractional positions, smoother for slowly moving text.
Properties
Antialiasing
Smooth glyph edges (true, the default: HD text). False gives hard edges, for pixel fonts distributed as TTF and drawn at their design size or whole multiples of it.
public bool Antialiasing { get; init; }Property Value
Default
The default: antialiased, sampled with the game’s default filter, kerned, snapped to pixels.
public static FontOptions Default { get; }Property Value
Filter
How glyph pages are sampled when text is scaled or rotated; null follows the game’s default (DefaultFilter, from its presentation’s default sampler), whether the text is antialiased or not.
public TextureFilter? Filter { get; init; }Property Value
Kerning
Applies the font’s kerning pairs (true by default).
public bool Kerning { get; init; }Property Value
PageSize
Width and height of each glyph page texture: 512 by default (1 MB), enough for the printable ASCII of a few sizes; another page is added when one fills up.
public int PageSize { get; init; }Property Value
Pixel
For pixel fonts in TTF/OTF files: no antialiasing, nearest sampling whatever the game’s default.
public static FontOptions Pixel { get; }Property Value
SnapToPixels
Places each glyph on whole canvas pixels (true by default) so unscaled text stays sharp; false keeps fractional positions, smoother for slowly moving text.
public bool SnapToPixels { get; init; }Property Value
Methods
<Clone>$()
public FontOptions <Clone>$()Returns
Deconstruct(out bool, out TextureFilter?, out int, out bool, out bool)
public void Deconstruct(out bool Antialiasing, out TextureFilter? Filter, out int PageSize, out bool Kerning, out bool SnapToPixels)Parameters
Antialiasing bool
Filter TextureFilter?
PageSize int
Kerning bool
SnapToPixels bool
Equals(object?)
public override bool Equals(object? obj)Parameters
obj object?
Returns
Equals(FontOptions?)
public bool Equals(FontOptions? other)Parameters
other FontOptions?
Returns
GetHashCode()
public override int GetHashCode()Returns
ToString()
public override string ToString()Returns
Operators
operator ==(FontOptions?, FontOptions?)
public static bool operator ==(FontOptions? left, FontOptions? right)Parameters
left FontOptions?
right FontOptions?
Returns
operator !=(FontOptions?, FontOptions?)
public static bool operator !=(FontOptions? left, FontOptions? right)Parameters
left FontOptions?
right FontOptions?