In this page, we're going to follow the work it took to add east-asian fonts.

Font rendering

Fonts in Pyrogenesis are prerendered by the fontbuilder tool.

First you need to do download the right font files (ttf, otf, ...), and place them in the fonts directory. F.e., to support east-asian fonts, you can use the SourceHanSans fonts or the Hanazono fonts.

Then you need to add the font to the fontbuilder itself. If you add the font files to the back of the list, they will be used as fallback. F.e.

Sans = (["LinBiolinum_Rah.ttf","FreeSans.ttf", "HanaMinA.ttf"], FontLoader.FT_LOAD_DEFAULT)

to use the hanazono font HanaMinA.ttf as fallback for the sans style.

If you don't want to overwrite the current fonts, but rather distribute them as a mod, it's best to change the output directory to the mod you want in the last line of the fontbuilder.

By running the fontbuilder,


the fonts will be prerendered, and added in the output directory you defined (by default the correct path in the public mod).

Font caching

If you want to distribute the fonts as a separate mod, it's best to cache them, else users will only see grey text on their first run. Caching should be done with the archivebuild tool available in Pyrogenesis. Note that for distribution, it's also best to enable the compression flag, because cached dds files tend to be big, and seem to compress rather well.

F.e., for the east-asian locales mod:

binaries/system/pyrogenesis -mod=mod -archivebuild=binaries/data/mods/east-asian-locales -archivebuild-output=binaries/data/mods/east-asian-locales/ -archivebuild-compress

Which will result in a cached, compressed file, ready for distribution.

Testing your fonts

To make sure you test the final version, first (re)move all old files (s.a. the png files the fontbuilder made). Then place your zip in the same directory structure as the released public mod (so mods/east-asian-locales/ for our test), and run pyrogenesis with the mod enabled (either using the mod selector, or the below command).

./pyrogenesis -mod=mod -mod=public -mod=east-asian-locales
Last modified 17 months ago Last modified on Feb 12, 2021, 10:27:52 PM
Note: See TracWiki for help on using the wiki.