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.ModuleBaseRichHudComponentBaseFontManager
Properties
Default
Index representing the default Space Engineers font with regular styling.
Equivalent to (0, 0).
public static Vector2I Default { get; }
Property Value
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
Methods
GetFont(int)
Retrieves a registered font by its index in the global font list.
public static IFontMin GetFont(int index)
Parameters
indexint
Returns
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
namestringThe unique name the font was registered with.
Returns
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
namestringName of the font.
styleFontStylesDesired style (Regular, Bold, Italic, etc.). Defaults to Regular.
Returns
- Vector2I
A
Vector2I(x, y)wherexis the font index andyis 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
fontDataMyTuple<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
trueif 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
fontDataMyTuple<string, float, MyTuple<int, float, float, MyTuple<string, Vector2>[], KeyValuePair<char, MyTuple<int, Vector2, Vector2, float, float>>[], KeyValuePair<uint, float>[]>[]>Complete font definition.
fontIFontMinThe newly registered IFontMin instance, or
nullon failure.
Returns
- bool
trueif registration succeeded