FontPacker class
#include <Utilities/AssetPacker/FontPacker.h>
Converts bitmap fonts between the form they are authored in and the one the game loads.
A font is authored as a grid image - one equally sized cell per character - next to a small file listing the character set and how far the pen moves for each. The game instead loads a single file in which every glyph has been measured down to the pixels it actually inks, packed against its neighbours and stored as palette indices; see Jazz2::
Both directions are provided, so a shipped font can be opened up, changed and packed again without the grid form having to be kept around. ApplyPalette and ConvertToIndices are the two halves of making that grid editable: the atlas holds palette indices, which look like near-black noise in an image editor until the palette is applied, and have to be resolved back afterwards.
Public static functions
- static auto Pack(StringView sourcePath, StringView targetPath) -> bool
- Packs a grid image and its character list into the file the game loads.
- static auto Unpack(StringView sourcePath, StringView targetPath) -> bool
- Unpacks a packed font back into a grid image and its character list.
- static auto ApplyPalette(StringView sourcePath, StringView targetPath) -> bool
- Replaces the palette indices of an image with the colors they stand for.
- static auto ConvertToIndices(StringView sourcePath, StringView targetPath) -> bool
- Resolves the colors of an image back to the nearest palette indices.