Hpl3:Tutorials:adding fonts

From Frictional Wiki
Jump to navigation Jump to search

Adding custom fonts

Step 1: Get the font

First thing first, get the font you want to use and install it on your computer (right-click on it and hit Install). Make sure it is in OTF or TTF format, otherwise convert it to one of those file types.

Step 2: Get BMFont

For a font to work in game, the font first needs to be converted into an atlas. To do this, we need to use the tool BMFont. It is advised to use the 64bit beta version since it has proven to have better OTF compatibility.

BMFont supports both OTF and TTF file types.

Step 3: Font Settings

  • Go to Options > Font Settings
  • Font: Select your font from the list
  • Add font file: Select the OTF or TTF file
  • Size: Advised to use 96/72/56 to cover the majority of needed sizes while keeping the font sharp
  • Bold/Italic: Select these if your font is a bold/italic
  • Font Smoothing: OFF
  • Super Sampling: ON
  • Level: 4

Step 4: Export Options

  • Go to Options > Export Options
  • Padding: Advised to use 1 pixel padding in every direction
  • Width/Height: advised to use 512/512 or 1024/1024 to make sure the font is rendered in few textures. Big fonts require more space.
  • Bit depth: 8
  • Font Descriptor: XML
  • Textures: dds - DirectDraw Surface
  • Compression: none

Step 5: Generate font atlas

  • From the right panel, select all the glyph groups you want to export
  • Go to Options > Save bitmap font as...

This process will generate a .fnt file as well as dds atlases. You can now reference the font by name via script to use the font.