atlasgen
FreeBodyEngine.font.atlasgen
#
Packs a font's glyphs (generated by font/msdfgen.py) into one MSDF atlas
texture + a .fbfont sidecar, using the engine's existing shelf-based
AtlasGen packer (build/atlas_gen.py) - the same packer the release asset
build uses for regular sprites - instead of the previous fixed-grid, no-
padding layout, which wasted space and let adjacent glyphs bleed into each
other under linear filtering.
GLYPH_PADDING = 2
module-attribute
#
generate_atlas(path_or_stream, size, atlas_size=512, range_px=4.0)
#
Returns (atlas_image: PIL.Image, metadata: dict) for every printable
ASCII glyph in the font at path_or_stream. metadata follows the
msdf-atlas-gen-compatible schema documented in build's Part 3 plan:
{"atlas": {...}, "metrics": {...}, "glyphs": [...]}.