A tool to convert text files to bitmap font files using fontgen.exe All text files under in/text/ are processed to extract unique characters, which are then used to generate bitmap fonts. For xml files, only the text content is considered, any tags or attributes are ignored. Some characters are always included like ASCII letters and digits, may support additional config later.
- fontgen.exe and its dependencies (Fontgen V1.1.0)
- Place your desired TTF font files in the
_tools_/ttf/folder.
You can create a standalone Windows EXE using PyInstaller. A helper script is provided: build_exe.ps1.
Quick steps:
- Install PyInstaller in your active Python environment:
python -m pip install pyinstaller. - Run the build script from the repo root in PowerShell:
./build_exe.ps1.
Notes:
- By default this build script does not bundle any extra data; if you need
fontgen.exeincluded, add_tools_/fontgento$addDataArgsinbuild_exe.ps1or pass--add-dataflags to PyInstaller. TTF files under_tools_/ttfare not bundled by default and must be provided externally (for example, place them next to the EXE). - On Windows use the same architecture of Python that matches the native
fontgenbinaries.
python test/util/read_xml_txt.py -v-ttf <ttf_file_name> : Specify TTF filename (in _tools_/ttf/ with/without extension name) to use for font generation
-o <output_name> : Custom output name for the .fnt and .png file (no extension)
--output-name : (Alias for -o)
-fs : Specify font size (default 23)
--font-size : (Alias for -fs)
python txt2fnt.py -ttf ChironHeiHK-Text-R-400.ttf -o noto_sans_cjk_regular -fs 32