Documentation
Docs/en/reference/font-format/binding.md
Font Binding Contract
Generated reference. Do not edit directly. Update
BuildTools/FontFormatInterface.json, then runpython BuildTools/docs_font_format.py --write.
| Index | Formats | Binding | Authoring | Layout | Rendering | Validation | Canonical JSON | Guide |
| Stable ID | Rule | Requirement | Why | Source |
|---|---|---|---|---|
font-format.binding.truetype-only |
Face-list binding only | Call Game.BindFont with a face list, a pixel size, FontOptions, and preload ranges; there is no overload that binds a descriptor path with a scale. | The script surface exports a single BindFont overload, and the client font manager has no descriptor loader, bind-time scaler, or bitmap font builder behind it. | Source/Scripting/ClientGlobalScriptMethods.cpp, Source/Client/FontManager.h |
font-format.binding.raw-copy |
Face raw-copy boundary | Keep ttf in Baking.RawCopyFileExtensions so face bytes reach baked resources unchanged. | There is no dedicated font baker; RawCopyBaker preserves path and bytes, and the default list carries ttf as its first entry. | Source/Common/Settings.inc, Source/Tools/RawCopyBaker.cpp |
font-format.binding.default-font |
Engine default font | Rely on Fonts/FOnline-Regular.ttf drawn at pixel size 10 in the Default slot: the client and the Mapper bind it in their constructors after the default sprites load, and the updater binds it too, all with skip-if-loaded behavior, so a bare executable can draw text before any script runs. | BindDefaultFont binds one face with normal hinting, a one-pixel outline, and the Latin, Latin-1, and Cyrillic preload ranges to the interface atlas, and it is a no-op when the slot is already bound. | Source/Client/FontManager.cpp, Source/Common/ResourceDefaults.h, Source/Client/Client.cpp, Source/Tools/Mapper.cpp, Source/Client/Updater.cpp |
font-format.binding.default-font-override |
Replacing the default font | Replace the default look by shipping your own Fonts/FOnline-Regular.ttf in a resource pack that provides that path, or by binding other faces to the Default slot from a client script; the face must carry the space letter and the preload codepoints your texts use. | The default binding reads its face by resource path like any other bind, and a later script bind to the same slot rebuilds the font; a face without a space letter fails the bind. | Source/Client/FontManager.cpp, Source/Common/ResourceDefaults.h |
font-format.binding.embedded-capacity |
Embedded pack capacity | Keep the Embedded resource pack, which holds the default font, within FO_EMBEDDED_DATA_CAPACITY; the default is 400000 bytes, and a project that sets its own value must make sure the compressed pack still fits. | The default face lives in Resources/Embedded/Fonts so that a bare executable can draw text, which raised the default capacity reserved for embedded data in generated binaries. | BuildTools/cmake/ProjectInterface.json, BuildTools/cmake/stages/Init.cmake |
font-format.binding.font-slots |
Project-extensible font slots | Bind every FontType slot before it is measured or drawn; the Engine names only Default = 0, binds it itself, and embedding scripts may extend the enum through codegen annotations. | FontType is an indexed loaded-font table, and unloaded or out-of-range slots throw. | Source/Client/FontManager.h |
font-format.binding.iface-atlas |
Interface sprite atlas | Script-bound fonts allocate their normal and optional bordered glyph sheets in AtlasType::IfaceSprites. | The script overload and the default-font binding pass the same interface atlas type. | Source/Scripting/ClientGlobalScriptMethods.cpp |
font-format.binding.rebind |
Slot replacement and cache reset | Treat a repeated binding of the same slot as replacement; all cached layouts are discarded before the rebuilt font is used. | StoreFont replaces the optional table entry and clears the format cache. | Source/Client/FontManager.cpp |
font-format.binding.truetype-faces |
TrueType face chain | Call the face-list Game.BindFont overload with a pixel size, FontOptions, and preload ranges; list the primary face first and fallback faces after it, because a letter comes from the first face that carries it. | BindTrueTypeFont reads every face once, builds the fallback chain in the given order, and binds the slot to the interface atlas. | Source/Scripting/ClientGlobalScriptMethods.cpp, Source/Client/FontManager.cpp |
font-format.binding.truetype-limits |
TrueType size limits | Keep the pixel size and the outline width inside the engine limits; a face that FreeType cannot open, or a value outside the limits, fails the bind and leaves the previous font in place. | The bind validates the arguments before it builds the replacement font, so a failed rebind keeps drawing the old one. | Source/Client/FontManager.cpp |