Jettcodey-YapYap_FontAPI icon

YapYap FontAPI

️A simple API to replace the YapYap game Font for the UI and 3DWorld.

Last updated 5 days ago
Total downloads 352
Total rating 2 
Categories Libraries Client Side
Dependency string Jettcodey-YapYap_FontAPI-1.0.0
Dependants 2 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2304 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2304

README

FontAPI

A simple library to replace the YapYap game Font for the UI and 3DWorld.

Handles UI text (TextMeshProUGUI) and 3D World text (TextMeshPro) automatically.

How to use (For Modders)

  1. Reference the DLL: Add Jettcodey.FontAPI.dll as a reference in your C# project.
  2. Add Dependency: Add [BepInDependency("Jettcodey.FontAPI")] to your BaseUnityPlugin.
  3. Load & Set: Load your AssetBundle and pass the TMP Font Asset to the API.

Code Example

using BepInEx;
using UnityEngine;
using Jettcodey.FontAPI; 

[BepInPlugin("myname.coolfont", "My Cool Font", "1.0.0")]
[BepInDependency("Jettcodey.FontAPI")] 
public class MyFontMod : BaseUnityPlugin
{
    public static MyFontMod Instance { get; private set; }
    internal static new ManualLogSource? Logger { get; private set; }
    private Harmony _harmony;

    private void Awake()
    {
        Instance = this;
        _Logger = base.Logger;

        // 1. Load your AssetBundle
        string pluginDir = Path.GetDirectoryName(Info.Location);
        string path = Path.Combine(pluginDir, "myfontbundle");

        AssetBundle bundle = AssetBundle.LoadFromFile(path);

        if (bundle == null) 
        {
            Logger.LogError("Failed to load bundle!");
            return;
        }

        // 2. Register the font
        // IMPORTANT: Use the name of the "SDF" Asset, not the .ttf file
        FontAPI.LoadAndSet(bundle, "MyCoolFont SDF");
        
        Logger.LogInfo("Font replaced!");
    }
}

Creating the AssetBundle

The game cannot load raw .ttf files. You must create a TextMeshPro Font Asset in Unity.

  1. Unity Version: Use the same Unity version as the game (for YAPYAP, this is v6000.0.x).

  2. Import Font: Drag your .ttf or .otf into Unity.

  3. Create Asset: Right-click the font -> Create -> TextMeshPro -> Font Asset.

  4. Settings:

    • Character Set: Unicode Range (Hex)
    • Atlas Population Mode: Dynamic (Recommended)
    • Atlas Render Mode: SDF or SDFAA
  5. Build the Assetbundle: Assign the generated SDF Asset to an AssetBundle (e.g., myfontbundle) and build it.