# Gum Kernsmith Integrations

> KernSmith Integrations

- Skill: `vchelaru/gum-kernsmith-integrations` (Agent Skill)
- Install (CLI): `npx skillmds@latest add vchelaru/gum-kernsmith-integrations`
- Raw SKILL.md: https://api.skillmd.com/api/skills/vchelaru/gum-kernsmith-integrations/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: vchelaru (https://skillmd.com/u/vchelaru)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/vchelaru/gum-kernsmith-integrations

---


# KernSmith Integrations

[KernSmith](https://github.com/kaltinril/KernSmith) is a third-party, cross-platform, in-memory BMFont rasterizer. `Integrations/KernSmith/*` are optional first-party Gum packages that bridge it into each runtime. The tool itself also uses KernSmith directly as an alternate offline generator backend — see `gum-tool-font-generation` for that (`KernSmithFileGenerator`, unrelated to the runtime packages below).

## Package map

| Package | Role |
|---|---|
| `KernSmith.GumCommon` | Shared mapping layer: Gum's `BmfcSave` → KernSmith's `FontGeneratorOptions` |
| `KernSmith.MonoGameGum` | MonoGame `IRuntimeFontCreator`-style wiring, produces `BitmapFont` |
| `KernSmith.KniGum` / `KernSmith.FnaGum` | Same shape, KNI/FNA targets |
| `KernSmith.RaylibGum` | `KernSmithRaylibFontCreator`, produces `Raylib_cs.Font` |

Each platform package plugs into `CustomSetPropertyOnRenderable.InMemoryFontCreator` (a game project sets this at startup) so Gum rasterizes fonts on the fly instead of loading pre-generated `.fnt`/`.png` files.

## Gotcha

These are opt-in NuGet add-ons a *game project* references directly — Gum does not wire one up by default. If `InMemoryFontCreator` is never set, Gum falls back to the tool's pre-generated bmfont.exe pipeline. Seeing a `KernSmith.*` package reference alongside `Gum.MonoGame`/etc. in a user's `.csproj` is expected, not a conflicting fork.

## Rasterizer backend gotcha (wasm/AOT)

KernSmith picks a glyph rasterizer via `RasterizerBackend`, each backend its own opt-in NuGet package (`KernSmith.Rasterizers.FreeType`/`Gdi`/`DirectWrite.TerraFX`/`StbTrueType`) so a consumer only pays for the one it needs — see the [KernSmith README](https://github.com/kaltinril/KernSmith). Gum's `KernSmith.GumCommon` references only `FreeType` (upstream's default, and native-only). `StbTrueType` is the sole pure-C# backend and the only one that runs on browser-wasm/AOT, but no Gum `KernSmith.*` package references it — a wasm consumer must add `KernSmith.Rasterizers.StbTrueType` themselves, and separately call `RuntimeHelpers.RunClassConstructor(typeof(StbTrueTypeRasterizer).TypeHandle)` before using it, since KernSmith's reflection-based backend auto-discovery is trimmed away under wasm/AOT publish (silent "backend is not registered" failure otherwise). Any fix that wires this into Gum's own packages must condition both the reference and the call on the browser-wasm RID — adding it unconditionally defeats the per-backend package split's whole purpose.

`GumFontGenerator.Generate` throws `PlatformNotSupportedException` when called on browser-wasm with no explicit `backend` argument, instead of leaving the failure to KernSmith or a silent fallback — see `GumFontGenerator.IsBrowserPlatform` (test seam for `OperatingSystem.IsBrowser`).

See `docs/code/files-and-fonts/font-strategies.md` for the user-facing font strategy comparison.

