Skip to content

GraphicsAPI reference

Class FontOptions

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

How a ScalableFont turns outlines into pixels.

C#
public sealed record FontOptions : IEquatable<FontOptions>

Inheritance

object ← FontOptions

Implements

IEquatable<FontOptions>

Constructors

FontOptions(bool, TextureFilter?, int, bool, bool)

How a ScalableFont turns outlines into pixels.

C#
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.

C#
public bool Antialiasing { get; init; }

Property Value

bool

Default

The default: antialiased, sampled with the game’s default filter, kerned, snapped to pixels.

C#
public static FontOptions Default { get; }

Property Value

FontOptions

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.

C#
public TextureFilter? Filter { get; init; }

Property Value

TextureFilter?

Kerning

Applies the font’s kerning pairs (true by default).

C#
public bool Kerning { get; init; }

Property Value

bool

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.

C#
public int PageSize { get; init; }

Property Value

int

Pixel

For pixel fonts in TTF/OTF files: no antialiasing, nearest sampling whatever the game’s default.

C#
public static FontOptions Pixel { get; }

Property Value

FontOptions

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.

C#
public bool SnapToPixels { get; init; }

Property Value

bool

Methods

<Clone>$()

C#
public FontOptions <Clone>$()

Returns

FontOptions

Deconstruct(out bool, out TextureFilter?, out int, out bool, out bool)

C#
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?)

C#
public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(FontOptions?)

C#
public bool Equals(FontOptions? other)

Parameters

other FontOptions?

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(FontOptions?, FontOptions?)

C#
public static bool operator ==(FontOptions? left, FontOptions? right)

Parameters

left FontOptions?

right FontOptions?

Returns

bool

operator !=(FontOptions?, FontOptions?)

C#
public static bool operator !=(FontOptions? left, FontOptions? right)

Parameters

left FontOptions?

right FontOptions?

Returns

bool