Table of Contents

Class FontManager

Namespace
RichHudFramework.UI.Rendering.Client
Assembly
RichHudClient.dll

Client-side API for the font management system. Allows mods to query registered fonts and register custom fonts at runtime.

Most frequently used by GlyphFormat internally when setting font or style.

public sealed class FontManager : RichHudClient.ApiModule
Inheritance
ModBase.ModuleBase
RichHudComponentBase
FontManager

Properties

Default

Index representing the default Space Engineers font with regular styling. Equivalent to (0, 0).

public static Vector2I Default { get; }

Property Value

Vector2I

Fonts

Read-only list of all fonts currently registered with RHM. Includes both built-in fonts and any fonts added by mods.

public static IReadOnlyList<IFontMin> Fonts { get; }

Property Value

IReadOnlyList<IFontMin>

Methods

GetFont(int)

Retrieves a registered font by its index in the global font list.

public static IFontMin GetFont(int index)

Parameters

index int

Returns

IFontMin

Exceptions

IndexOutOfRangeException

Thrown if the index is invalid.

GetFont(string)

Retrieves a registered font by its exact name (case insensitive).

public static IFontMin GetFont(string name)

Parameters

name string

The unique name the font was registered with.

Returns

IFontMin

The IFontMin interface for the font, or null if not found.

GetStyleIndex(string, FontStyles)

Returns a Vector2I that uniquely identifies a specific style of a font.

public static Vector2I GetStyleIndex(string name, FontStyles style = FontStyles.Regular)

Parameters

name string

Name of the font.

style FontStyles

Desired style (Regular, Bold, Italic, etc.). Defaults to Regular.

Returns

Vector2I

A Vector2I(x, y) where x is the font index and y is the style index. Returns (0, 0) (default font, regular) if the font or style is not found.

TryAddFont(MyTuple<string, float, MyTuple<int, float, float, MyTuple<string, Vector2>[], KeyValuePair<char, MyTuple<int, Vector2, Vector2, float, float>>[], KeyValuePair<uint, float>[]>[]>)

Attempts to register a new custom font with RHM.

public static bool TryAddFont(MyTuple<string, float, MyTuple<int, float, float, MyTuple<string, Vector2>[], KeyValuePair<char, MyTuple<int, Vector2, Vector2, float, float>>[], KeyValuePair<uint, float>[]>[]> fontData)

Parameters

fontData MyTuple<string, float, MyTuple<int, float, float, MyTuple<string, Vector2>[], KeyValuePair<char, MyTuple<int, Vector2, Vector2, float, float>>[], KeyValuePair<uint, float>[]>[]>

Complete font definition including name, base size, and all style data.

Returns

bool

true if the font was successfully registered

TryAddFont(MyTuple<string, float, MyTuple<int, float, float, MyTuple<string, Vector2>[], KeyValuePair<char, MyTuple<int, Vector2, Vector2, float, float>>[], KeyValuePair<uint, float>[]>[]>, out IFontMin)

Attempts to register a new custom font and returns the registered font interface if successful.

public static bool TryAddFont(MyTuple<string, float, MyTuple<int, float, float, MyTuple<string, Vector2>[], KeyValuePair<char, MyTuple<int, Vector2, Vector2, float, float>>[], KeyValuePair<uint, float>[]>[]> fontData, out IFontMin font)

Parameters

fontData MyTuple<string, float, MyTuple<int, float, float, MyTuple<string, Vector2>[], KeyValuePair<char, MyTuple<int, Vector2, Vector2, float, float>>[], KeyValuePair<uint, float>[]>[]>

Complete font definition.

font IFontMin

The newly registered IFontMin instance, or null on failure.

Returns

bool

true if registration succeeded