Font Builder 2 is the new iteration of the old Font Builder.

This font builder is a python script that converts font files into pre-rendered glyph collections to be used in the game. This means fonts have to be pre-rendered for all combinations of styles (bold, italic, different sizes ...) that are used in the game. These glyph collections get a certain name that can be used in the GUI system.

Fonts are compiled by just running the fontbuilder.py script with python2.

Adding new fonts or replacing fonts

To add a new font, you place the font files in the binaries/data/tools/fontbuilder/fonts directory. Then you modify the fontbuilder.py script to render those fonts. The font variations are controlled near the end of the file. Note that, unless you're redesigning the entire GUI, the names in the fonts array still need to contain all names used in the GUI files.

See Adding_font_support for some more information on how to add new fonts.

Fallback fonts

TODO (see r14853)

Troubleshooting

Using the fontbuilder.py tool on macOS 10.15.7 with Homebrew

  • Install the following formulas brew install python@3.9 cairo py3cairo
  • Open this file: 0ad/source/tools/fontbuilder2/FontLoader.py and apply the following changes:
    • ft_lib = "libfreetype.so.6" --> ft_lib = "libfreetype.dylib"
    • lc_lib = "libcairo.so.2" --> lc_lib = "libcairo.dylib"
  • Now open terminal and run python3 fontbuilder.py 
Last modified 3 years ago Last modified on Mar 18, 2021, 3:21:30 PM
Note: See TracWiki for help on using the wiki.