A tool to repack fonts for the game Wartales. It is assumed that you have already updated the localization files.
-
fontgen\fontgen.exeand its dependencies- Fontgen V1.1.0
- expected SHA256:
8E68482A506320B1AD509FD5E5AB885C571FD6845B60E593E2B923CD48F23D0D
-
txt2fnt\txt2fnt.exeand its dependencies -
quickbms\quickbms.exe&quickbms\quickbms_4gb_files.exeand their dependencies -
Place your desired TTF font files in the
_tools_/ttffolder.
py Wartales_repack_font.py --res-pak res.pak -lang zh
This runs the complete workflow:
- Extract: Extracts localization files (
texts_zh.xml,export_zh.xml) fromres.pak. - Generate: Converts extracted XML + TTF into bitmap fonts (
.fnt,.png) usingtxt2fnt. - Repack: Packs the generated fonts into
assets.pak.
py Wartales_repack_font.py --res-pak res.pak -lang zh --extract-only
- Performs only the extraction step.
- Useful if you want to inspect the XML files or manually edit them before generating fonts.
- Output files are in
workspace/extracted-txt/.
py Wartales_repack_font.py --res-pak res.pak -lang zh --inject-xml _new_xml_
- Injects modified XML files from a folder (e.g.,
_new_xml_) back intores.pak. - Does not touch fonts or
assets.pak. - Useful for testing translation changes without regenerating fonts.
- The source folder must contain
texts_{lang}.xmlandexport_{lang}.xml.
- check if working directories contain necessary files for next step:
_tools_/quickbms/quickbms.exe
- empty the folder
workspace/extracted-res/and usequickbms.exeto extract i18n files from Wartales res.pak intoworkspace/extracted-res/- e.g. expected files (under the folder):
lang/texts_zh.xmllang/export_zh.xml
- e.g. expected files (under the folder):
- empty the folder
workspace/extracted-txt/and copy all extracted files intoworkspace/extracted-txt/(no subdirs)- e.g. expected files (under the folder):
texts_zh.xmlexport_zh.xml
- e.g. expected files (under the folder):
- check if working directories contain necessary files for next step:
_tools_/fontgen/fontgen.exe_tools_/txt2fnt/txt2fnt.exe_tools_/ttf/**.ttf
- use
txt2fnt.exeto convert the xml files into fnt files-
e.g. expected command:
txt2fnt.exe -tf workspace/extracted-txt -fs 48 -ttf ChironHeiHK-Text-R-400 -o noto_sans_cjk_regular -ff workspace/modded-assets/ui/fontsand check expected output files exist:workspace/modded-assets/ui/fonts/noto_sans_cjk_regular.fntworkspace/modded-assets/ui/fonts/noto_sans_cjk_regular.png
-
- use
quickbms_4gb_files.exeto repack the modified font files intoassets.pak-
e.g. expected command:
_tools_/quickbms_4gb_files.exe -w -r -r _script_/script-v2.bms ./assets.pak ./workspace/modded-assets
-
py -m source.example.test_extract./build_exe.ps1pyinstaller --onefile --windowed Wartales_repack_font_gui.pypy -m Wartales_repack_font_gui --debug