ninjaguardian-Fontifier icon

Fontifier

Lets you change the font for other mods.

Last updated a week ago
Total downloads 44
Total rating 0 
Categories Mods Tools
Dependency string ninjaguardian-Fontifier-1.1.4
Dependants 0 other packages depend on this package

This mod requires the following mods to function

Baumritter-RumbleModUI-2.1.2 icon
Baumritter-RumbleModUI

Adds a pop-up window for centralized management of mod settings

Preferred version: 2.1.2
LavaGang-MelonLoader-0.7.0 icon
LavaGang-MelonLoader

The World's First Universal Mod Loader for Unity Games compatible with both Il2Cpp and Mono

Preferred version: 0.7.0
ninjaguardian-RumbleModUIPlus-1.0.2 icon
ninjaguardian-RumbleModUIPlus

Adds stuff for devs to RumbleModUI

Preferred version: 1.0.2
UlvakSkillz-RumbleModdingAPI-4.0.0 icon
UlvakSkillz-RumbleModdingAPI

API to Help Modders Get Started and to remove the necessity of GameObject.Find

Preferred version: 4.0.0

README

Fontifier

Photo

Github Changelog Thunderstore

What is this?

This mod lets you change the font of other mods' text. It also allows people to use this in their own mods (see 'For Devs').

Instructions

  1. Install MelonLoader
  2. Run RUMBLE without mods
  3. Drop Mods from .zip into RUMBLE's installation folder
  4. Drop UserData from .zip into RUMBLE's installation folder
  5. Drop UserLibs from .zip into RUMBLE's installation folder
  6. Install dependencies
  7. Play RUMBLE!

Supported mods

HealthDisplayWithFont TournamentScoringMod MatchInfo
HealthDisplayWithFont's Icon TournamentScoringMod's Icon MatchInfo's Icon

Choose a font

  1. Move any .ttf or .otf fonts into UserData\Fontifier\fonts
  2. Press F10 to open Mod UI
  3. Go to Fontifier in the dropdown
  4. In the second dropdown, select 'Fonts List'
  5. Find the name of the font you want
  6. In the second dropdown, select any mod
  7. Type in the name of the font you want (case-insensitive) and hit enter
  8. If it looks good, hit save

"I can't type in ModUI"

If you have UnityExplorer, hit F7 first. If not, ask the discord.

"It's not saving"

Make sure to press enter and then hit save. If you are, ask the discord.

For Devs

For Devs

If you create a TextMeshPro (or similar) in your mod and want to use Fontifier with it, here's how to do it.

First, choose if you want Fontifier to be a required dependency or optional dependency.

Required
  • You will need the following usings:
    using Il2CppTMPro;
    using MelonLoader;
    using static Fontifier.Fontifier;
    // The following is needed if ImplicitUsings are disabled
    using System;
    
  • And these dll refrences:
    • net6
      • MelonLoader.dll
    • Il2CppAssemblies
      • Unity.TextMeshPro.dll
    • Mods
      • Fontifier.dll
  • And this code if your code will modify the returned font: (safest) Whenever you call a method, it will create a new instance of the font unless you specify cache.

    Caching will make it so that when you call those methods and get a font, if you call it again, it won't make a new one unless your mod has not called this method for that specific font yet. Each mod has its own cache.

    If you want this, wherever it says [CACHE], replace it with true. Otherwise, replace it with false. Caching is recommended.

    (Place this in your MelonMod class)

    #region Fontifier
    private static Func<bool, TMP_FontAsset> GetFont;
    
    /// <inheritdoc/>
    public override void OnInitializeMelon()
    {
        GetFont = RegisterModWithReferenceCopy(this.Info.Name, new EventHandler<EventArgs>(FontChanged));
    }
    
    private static void FontChanged(object sender, EventArgs args)
    {
        // Change your TextMeshPro.font to the new font.
        TextMeshProInstance.font = FontFromNameCopy(this.Info.Name, ((dynamic)args).Value, [CACHE]);
    }
    #endregion
    

    ALSO: When you create the TextMeshPro, make sure to TextMeshProInstance.font = GetFont([CACHE]);

  • And this code if your code will only use the font to set the font for text and will not modify it: The returned font, if modified, will modify EVERY MOD'S FONTS. Only use this if needed. The font could be modified in unexpected ways. In most cases, the above is best option because of its safety. This is mostly here for legacy support.

    (Place this in your MelonMod class)

    #region Fontifier
    private static Func<TMP_FontAsset> GetFont;
    
    /// <inheritdoc/>
    public override void OnInitializeMelon()
    {
        GetFont = RegisterModWithReference(this.Info.Name, new EventHandler<EventArgs>(FontChanged));
    }
    
    private static void FontChanged(object sender, EventArgs args)
    {
        // Change your TextMeshPro.font to the new font.
        TextMeshProInstance.font = FontFromName(((dynamic)args).Value);
    }
    #endregion
    

    ALSO: When you create the TextMeshPro, make sure to TextMeshProInstance.font = GetFont();

Optional
  • You will need the following usings:
    using Il2CppTMPro;
    using MelonLoader;
    using System.Reflection;
    // The following is needed if ImplicitUsings is disabled
    using System;
    
  • And these dll refrences:
    • net6
      • MelonLoader.dll
    • Il2CppAssemblies
      • Unity.TextMeshPro.dll
  • And this code if your code will modify the returned font: (safest) Whenever you call a method, it will create a new instance of the font unless you specify cache.

    Caching will make it so that when you call those methods and get a font, if you call it again, it won't make a new one unless your mod has not called this method for that specific font yet. Each mod has its own cache.

    If you want this, wherever it says [CACHE], replace it with true. Otherwise, replace it with false. Caching is recommended.

    (Place this in your MelonMod class)

    #region Fontifier
    private static Func<bool, TMP_FontAsset> GetFont;
    private static Func<string, bool, TMP_FontAsset> FontFromName;
    
    /// <inheritdoc/>
    public override void OnInitializeMelon()
    {
        if (FindMelon("Fontifier", "ninjaguardian")?.GetType() is Type fontifierType && fontifierType != null) (GetFont, FontFromName) = ((Func<bool, TMP_FontAsset>, Func<string, bool, TMP_FontAsset>))fontifierType.GetMethod("RegisterModCopy", BindingFlags.Public | BindingFlags.Static)?.Invoke(null, new object[] { this.Info.Name, new EventHandler<EventArgs>(FontChanged) });
    }
    
    private static void FontChanged(object sender, EventArgs args)
    {
        // Change your TextMeshPro.font to the new font.
        TextMeshProInstance.font = FontFromName(((dynamic)args).Value, [CACHE]);
    }
    #endregion
    

    ALSO: When you create the TextMeshPro, make sure to TextMeshProInstance.font = GetFont([CACHE]);

  • And this code if your code will only use the font to set the font for text and will not modify it: The returned font, if modified, will modify EVERY MOD'S FONTS. Only use this if needed. The font could be modified in unexpected ways. In most cases, the above is best option because of its safety. This is mostly here for legacy support.

    (Place this in your MelonMod class)

    #region Fontifier
    private static Func<TMP_FontAsset> GetFont;
    private static Func<string, TMP_FontAsset> FontFromName;
    
    /// <inheritdoc/>
    public override void OnInitializeMelon()
    {
        if (FindMelon("Fontifier", "ninjaguardian")?.GetType() is Type fontifierType && fontifierType != null) (GetFont, FontFromName) = ((Func<TMP_FontAsset>, Func<string, TMP_FontAsset>))fontifierType.GetMethod("RegisterMod", BindingFlags.Public | BindingFlags.Static)?.Invoke(null, new object[] { this.Info.Name, new EventHandler<EventArgs>(FontChanged) });
    }
    
    private static void FontChanged(object sender, EventArgs args)
    {
        // Change your TextMeshPro.font to the new font.
        TextMeshProInstance.font = FontFromName(((dynamic)args).Value);
    }
    #endregion
    

    ALSO: When you create the TextMeshPro, make sure to TextMeshProInstance.font = GetFont();

Help And Other Resources

Get help and find other resources in the Modding Discord

Included font credit

License

My code: CC0 1.0 Universal (public domain)

CC0-1.0 License

Includes SixLabors.Fonts.dll (© Six Labors, Apache License 2.0)

Apache License 2.0

Includes GoodDog Plain font (© 1997 Fonthead Design, Freeware)

Freeware