gum-kernsmith-integrations

Integrates KernSmith runtime bitmap-font rasterization into Gum across MonoGame, KNI, FNA, and Raylib.

614|78|Updated Mar 11, 2015
One-click install
npx skills add https://github.com/vchelaru/Gum --skill gum-kernsmith-integrations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gum-kernsmith-integrations
Source: https://github.com/vchelaru/Gum/tree/main/.claude/skills/gum-kernsmith-integrations
Command: npx skills add https://github.com/vchelaru/Gum --skill gum-kernsmith-integrations

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Gum normally relies on pre-generated .fnt/.png font files produced by the bmfont.exe pipeline, which complicates runtime font changes and cross-platform builds. This Skill explains how the optional KernSmith.* NuGet packages bridge the KernSmith in-memory BMFont rasterizer into each Gum runtime so fonts are rasterized on the fly.

Core Features & Use Cases

  • Package mapping: Documents the role of each package — KernSmith.GumCommon (BmfcSave to FontGeneratorOptions mapping), KernSmith.MonoGameGum, KernSmith.KniGum, KernSmith.FnaGum, and KernSmith.RaylibGum.
  • Runtime font wiring: Explains how each platform package plugs into CustomSetPropertyOnRenderable.InMemoryFontCreator so a game rasterizes fonts at startup instead of loading pre-generated files.
  • wasm/AOT rasterizer guidance: Details the StbTrueType backend requirement for browser-wasm/AOT, including the manual RuntimeHelpers.RunClassConstructor call needed because reflection-based backend discovery is trimmed.
  • Use Case: A MonoGame developer targeting browser-wasm adds KernSmith.MonoGameGum plus KernSmith.Rasterizers.StbTrueType, sets InMemoryFontCreator at startup, and avoids shipping .fnt/.png assets entirely.

Quick Start

Explain how to wire KernSmith runtime font generation into my Gum MonoGame project and what extra steps are needed for a browser-wasm build.

Frequently Asked Questions about gum-kernsmith-integrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use KernSmith for runtime font generation in Gum?

Reference the KernSmith package matching your runtime (KernSmith.MonoGameGum, KernSmith.KniGum, KernSmith.FnaGum, or KernSmith.RaylibGum) and set CustomSetPropertyOnRenderable.InMemoryFontCreator at game startup. Gum then rasterizes fonts in memory instead of loading pre-generated .fnt/.png files.

What is the difference between KernSmith.GumCommon and the platform packages?

KernSmith.GumCommon is the shared mapping layer converting Gum's BmfcSave settings into KernSmith FontGeneratorOptions. The platform packages (MonoGameGum, KniGum, FnaGum, RaylibGum) provide the runtime-specific font creator that produces each framework's font type.

Does KernSmith font generation work on browser-wasm or AOT builds?

Only with the StbTrueType rasterizer backend, the sole pure-C# backend. You must reference KernSmith.Rasterizers.StbTrueType yourself and call RuntimeHelpers.RunClassConstructor on StbTrueTypeRasterizer, since reflection-based backend discovery is trimmed under wasm/AOT.

Why do I get a backend is not registered error with KernSmith on wasm?

KernSmith discovers rasterizer backends via reflection, which is trimmed away under wasm/AOT publish, causing a silent registration failure. Fix it by explicitly calling RuntimeHelpers.RunClassConstructor(typeof(StbTrueTypeRasterizer).TypeHandle) before generating fonts.

Is a KernSmith package reference in my .csproj a conflict with Gum.MonoGame?

No, it is expected. KernSmith.* packages are opt-in add-ons a game project references directly alongside Gum.MonoGame or other Gum runtimes. If InMemoryFontCreator is never set, Gum simply falls back to the pre-generated bmfont.exe pipeline.