hpl3:tutorials:adding_fonts [2019/11/26 16:20] alexkalopsia created |
hpl3:tutorials:adding_fonts [2019/11/26 16:36] (current) alexkalopsia |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Adding custom fonts ====== | ====== Adding custom fonts ====== | ||
- | ===== Transforming the font into an atlas ===== | + | ===== Step 1: Get the font ===== |
- | For a font to work in game, a font needs to be first converted into an atlas. To do this, you need to use the rool BMFont. It is advised to use the 64bit beta version since it has proven to have better OTF compatibility. | + | 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 [[https://www.angelcode.com/products/bmfont/|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. | ||