Dynamic Decals - Fonts
Font atlas generation and management for the dynamic decals tool. Rasterizes TTF fonts into atlas textures (with optional SDF), provides glyph browser, preview window, and integrates with the decal sy
Font atlas generation and management for the dynamic decals tool. Rasterizes TTF fonts into atlas textures (with optional SDF), provides glyph browser, preview window, and integrates with the decal system for text-based decals.
Public API
| Function | Signature | Description |
|---|---|---|
M.checkOrGenerateFontBitmaps | (fontPath) → bool | Generates atlas if not already cached; returns false on failure |
M.getFontDirectory | () → string | Returns font source directory (/ui/common/) |
M.getGeneratedFontAtlases | () → table | Returns array of generated font atlas names |
M.registerEditorPreferences | (prefsRegistry) | Registers glyph preview sizes and missing glyph marking |
M.editorPreferenceValueChanged | (path, value) | Preference change callback (stub) |
M.setup | (tool_in) | Registers section, browser tab, preview window, sets atlas path |
Font Atlas Generation
-- From the Fonts section UI or programmatically:
FontRasterizer.createFontBitmap(
fontPath, -- e.g., "/ui/common/MyFont.ttf"
destinationDirectory, -- "/art/dynamicDecals/fonts/"
glyphPixelHeight, -- default 256
true, -- include monospaced atlas
generateSdf, -- SDF toggle
sdfPadding, -- default 8
sdfOnedgeValue, -- default 128 (0-255)
sdfPixelDistScale -- default 8.0
)Generated Files (per font)
| File | Content |
|---|---|
<font>/<font>.font.json | Atlas metadata: header + glyph data |
<font>/<font>_monospaced.png | Monospaced atlas texture |
<font>/<font>_sdf_monospaced.png | SDF atlas texture (if enabled) |
Preview Window
Tabbed preview with:
- Info: Font name, atlas dimensions, glyph count, SDF params
- Atlas: Full monospaced atlas image
- Glyphs: Individual glyph grid (double-click to select as decal texture)
- Atlas SDF / Glyphs SDF: SDF versions (if generated)
Browser Tab
Displays all generated font atlases with glyph thumbnail grids. Double-clicking a glyph sets it as the current decal font character via:
api.setDecalLayerFontPath(fontPath)
api.setDecalLayerFontCharacter(string.char(key))Preferences
| Key | Type | Default | Description |
|---|---|---|---|
fonts.glyphPreviewSize | float | 128 | Glyph size in section (32–1024) |
fonts.glyphPreviewSizeInPreviewWindow | float | 128 | Glyph size in preview window |
fonts.markMissingGlyphs | bool | true | Red highlight for missing glyphs |
Dependencies
| Module | Purpose |
|---|---|
editor_api_dynamicDecals | Font texture atlas path, decal font API |
editor_dynamicDecals_helper | imageWidget(), imageTooltip() |
editor_dynamicDecals_browser | Browser tab registration |
editor_dynamicDecals_notification | Generation failure notifications |
FontRasterizer | Engine API for TTF → bitmap conversion |
Module Variables
supportedFontFileFormats(table) - Supported font file format filters for file dialogs.
Additional Exports
M.supportedFontFileFormats
See Also
- Dynamic Decals - Browser - Related reference
- Dynamic Decals - Brushes - Related reference
- Dynamic Decals - Camera - Related reference
- World Editor Guide - Guide
Dynamic Decals - Export
Export system for the dynamic decals tool. Two export modes: **Export Skin** (generates skin files ready for in-game use) and **Export Textures** (exports raw color, metallic, roughness, and color pal
Dynamic Decals - Gizmo
3D transform gizmo controller for the dynamic decals tool. Manages translate/rotate/scale modes, axis gizmo lifecycle (begin/drag/end), bounding box visualization, and per-mode callback dispatch. The