Custom Fonts
Custom fonts can be added to the framework by generating the required resource files, including them in your mod, and registering them via the framework's API during initialization.
Instructions:
- Generate the needed resources using the generation tool.
- Copy everything over from the root of the newly generated font folder to your mod's root. If you didn't set a mod name, you'll need to rename the folder at
{FontName}\Data\Scripts\ModNameto match the corresponding folder in your mod. - Once everything's copied over, make sure you've included the FontData folder in your project and add usings for
RichHudFramework.UI.Rendering.ClientandRichHudFramework.UI.FontData. - Register the new fonts in your main class on HudInit:
using RichHudFramework.Client;
using RichHudFramework.UI.Rendering.Client;
using RichHudFramework.UI.FontData;
using VRage.Game;
using VRage.Game.Components;
[MySessionComponentDescriptor(MyUpdateOrder.NoUpdate)]
public sealed class MainModClass : MySessionComponentBase
{
private static bool fontsRegistered;
...
private void HudInit()
{
// Register only once
if (!fontsRegistered)
{
FontManager.TryAddFont({FontName}.GetFontData());
fontsRegistered = true;
}
}
...
}
Warning
Always ensure that you adhere to the license terms of any font you use.