Documentation
Docs/en/reference/font-format/authoring.md
Font Authoring 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 |
Converter facts
| Field | Value |
|---|---|
| Source formats | .fofnt, .fnt |
| Font units per bitmap pixel | 100 |
| Native size range | 1..255 px |
| Neutral glyph grey | 128 |
| Shipped faces | 9 |
| Python packages | fontTools, numpy, PIL, potrace |
Authoring rules
| Stable ID | Rule | Requirement | Why | Source |
|---|---|---|---|---|
font-format.authoring.converter |
Bitmap-font converter | Convert an authored bitmap font with python BuildTools/bitmap_font_to_ttf.py SOURCE OUTPUT.ttf –family NAME; it needs fontTools, Pillow, numpy, and potracer, and the runtime and the documentation gates need none of them. | The converter is the only reader of .fofnt and BMFont v3 sources; it writes a TrueType face whose output is byte-identical between runs. | BuildTools/bitmap_font_to_ttf.py |
font-format.authoring.native-size-metrics |
Native size and metrics | Bind a converted face at its native pixel size, the source line height plus its line gap, to reproduce the bitmap layout; the face carries 100 font units per bitmap pixel, and a native size outside 1..255 is rejected. | The converter writes units per em as the native size times the pixel unit and refuses a size that an embedded bitmap strike cannot carry. | BuildTools/bitmap_font_to_ttf.py |
font-format.authoring.single-color |
Single-color fonts | Expect a single-color source to become an 8-bit EBDT/EBLC bitmap strike at the native size, which FreeType draws pixel for pixel, plus outlines traced from the glyph coverage for every other size; a no-op prep program keeps FreeType from auto-hinting the face. | The strike preserves the authored pixels at the native size in every raster mode, while the traced outlines let the same face scale to other pixel sizes. | BuildTools/bitmap_font_to_ttf.py |
font-format.authoring.multi-color |
Multi-color fonts | Expect a source with more than the neutral grey to become COLR v0 layers over a CPAL palette, one layer per distinct pixel color made of whole-pixel rectangles, with traced silhouettes as the base glyphs. | Color layers keep the authored colors exact at the native size and scale the pixel grid at other sizes, and renderers without color support still draw the silhouettes. | BuildTools/bitmap_font_to_ttf.py |
font-format.authoring.skipped-codepoints |
Skipped control codes | Do not expect glyphs for C0 and C1 control codes in a converted face; give the source an explicit space letter, because the client refuses a face chain without one. | Control codes are layout commands for the engine, so the converter skips them, while the font manager requires the space letter to measure and draw text. | BuildTools/bitmap_font_to_ttf.py, Source/Client/FontManager.cpp |
font-format.authoring.check |
Staleness check | Convert one face with python BuildTools/bitmap_font_to_ttf.py SOURCE OUTPUT.ttf –family NAME [–style Regular]; add –check to fail when OUTPUT is missing or differs from a fresh conversion instead of writing it. | –check compares output bytes, which is stable because the converter fixes the font timestamps, so a committed face that no longer matches its source is detected. | BuildTools/bitmap_font_to_ttf.py |
font-format.authoring.sources-not-packed |
Sources stay outside the Engine | Keep bitmap sources outside every resource pack and ship only the generated faces; the Engine ships its faces from Resources/Embedded/Fonts for the default font and Resources/Core/Fonts for the others, and the original bitmap sources of those faces are kept in the fonline-historical-stuff repository (folder FontSources), which is a pointer for provenance, not a build dependency. | The runtime has no use for source descriptors or their images, so the Engine tree carries only the converter and its generated faces. | BuildTools/bitmap_font_to_ttf.py |
Converter commands
python BuildTools\bitmap_font_to_ttf.py SOURCE.fofnt OUTPUT.ttf --family "Name"
python BuildTools\bitmap_font_to_ttf.py SOURCE.fofnt OUTPUT.ttf --family "Name" --check
Converted faces are generated data: edit the bitmap source or the converter, regenerate the face, and never edit a face by hand. The --check mode fails when OUTPUT differs from a fresh conversion. The original bitmap sources of the faces the Engine ships are kept outside it, in the fonline-historical-stuff repository (folder FontSources).