Arma 3: Adding Custom Fonts
Topic · Markdown · JSON · original wiki page
This tutorial explains how to get a font into Arma 3.
Disclaimer: This page describes an unofficial tool created without permission or support of Bohemia Interactive.
The product itself and its usage may be violating rights of Bohemia Interactive and is in no way endorsed or recommended by Bohemia Interactive.
See also Official Tools.
Requirements
- Arma 3
- Arma 3 Tools Launcher (from Steam)
- a Windows machine capable of running Powershell scripts
- this unofficial Powershell script: https://github.com/Nelis75733126/Arma_3_FontToTGA_Helper/
- a mouse and keyboard might be handy :P :P
Definitions
| Term | Meaning |
|---|---|
| Arma 3 Tools | Arma 3 Tools Launcher |
CfgFontFamilies |
this refers to a class type that can be put inside a config.cpp file. |
.tga file format |
Used for textures. In this context, TGA files are used to store all characters of a font. |
.paa file format |
Also used for textures. Arma 3 uses TGA files converted into PAA files to display text. |
.fxy file format |
This contains information about where each character of a font is placed in a particular texture file. |
| FontToTGA.exe | A command-line tool included with Arma 3 Tools. It converts fonts into TGA files. More details here: FontToTga |
| ImageToPAA.exe | A tool also included in Arma 3 Tools which can be used to convert TGA files into PAA files. More details here: ImageToPAA |
Steps
The idea is that fonts (TTF or OTF) can be converted into TGA files by FontToTGA.exe.
Every time FontToTGA.exe is called, one of the required parameters is a specific font size in pt size format.
-
FontToTGA.exewill then generate.fxyfiles and.tgafiles. -
Then, ImageToPAA.exe can convert the TGA files created by FontToTGA.exe into PAA files.
-
Then the
.fxyand.paafiles should be moved into an Addon. See Arma 3: Creating an Addon to learn how to make one. -
Then, inside of the addon's config.cpp, there should be an entry for each font you want to add, so that the game knows for what to look. Here is an example of that
config.cpp:class CfgPatches { class TAG_Custom_Fonts { name = "SOMETHING - UI fonts"; author = "your name"; url = "https://github.com/yourname"; requiredVersion = 0; requiredAddons[] = {}; units[] = {}; weapons[] = {}; skipWhenMissingDependcies = 0; }; }; class CfgFontFamilies { class BebasNeue { fonts[] = { /* these are just four examples to make this example shorter. normally, there would be a lot more entries in here as explained below. */ "TAG_Custom_Fonts\Fonts\BebasNeue\BebasNeue10", // the number at the end refers to the size of the font in pt "TAG_Custom_Fonts\Fonts\BebasNeue\BebasNeue11", "TAG_Custom_Fonts\Fonts\BebasNeue\BebasNeue12", "TAG_Custom_Fonts\Fonts\BebasNeue\BebasNeue100" // it can go higher than that, but 100 is pretty big :) }; }; };
Config
Each added font requires a class theNameOfTheFont in the class CfgFontFamilies brackets.
If you want to add multiple fonts, simply do it like so:
class CfgFontFamilies
{
class SomeReallyNiceFont
{
fonts[] = {}; // should be filled with strings
};
class MonoSpaceFontMaybe
{
fonts[] = {}; // should be filled with strings
};
// and so on - add as much as you like
};
Note
The classname you use will be the exact name that you later will use in the
font = "fontName";property to get that font to appear in UI elements.
The name itself makes no difference as long as it does not conflict with an existing font. Thanks to the creator of the Powershell script (as linked earlier), the config is generated for you. The only thing you need to do is copy it and paste it in the right place.
Fonts Array
This will all be generated by the Powershell script :)
It is a list of strings where each string refers to the path of each size of the font that was generated.
If you want really big text in the game, then the appropriate size in pt has to be generated.
If the text inside of a UI element is much larger than the biggest available texture, the text will look ugly simply because the game will scale the texture up to the requested size.
By default, the Powershell script will generate a bunch of sizes to make sure that the font will look good through a wide range of sizes;
but it is also capable of using provided custom sizes. Using the default values is fine.
If you only want a very specific size of the font, you can use the Powershell script to get that. The script itself tells you how.
Process
-
Read the instructions for the Powershell script, then execute that script.
-
Once done, you should have a bunch of
.fxyand.tgafiles inside the Fonts folder of whereFontToTGA.exeis located. Unless you provided another location to the Powershell script. -
Now it is time to let
ImageToPAA.execonvert all the.tgafiles into.paafiles. Start it up and just look at the interface to see how it works. It is pretty straightforward. -
Once all PAA images are generated, copy the
.fxyand.paafiles into a directory where you can let Addon Builder (also included in Arma 3 Tools) make a PBO from. The instructions on how to use Addon Builder can be found here. -
Now pay close attention to the config for
class CfgFontFamiliesthat was generated by the Powershell script: each string in thefonts[] = {};list will contain the path to where the.fxyand.paafiles should be placed.An example:
fonts[] = { "TAG_Custom_Fonts\Fonts\BebasNeue\BebasNeue10" };The
TAG_Custom_Fontsis a reference to the class used inside the addonconfig.cpp'sclass CfgPatches.
In the example above, there should be a folder called Fonts in the same folder asconfig.cpp.
Create it if missing, and then take the folder with the font's name (the one inside theFontToTGA.exe's Fonts folder) and put it in there.Note
It is up to you if you want to keep or delete the
.tgafiles. -
Double-check everything and make sure the
config.cppfor your addon has been set right. If so, build it using Addon Builder. -
Add it to the launch options of the game. Instructions for that can be found elsewhere.
-
Start the game, go into the 3DEN editor, open the config viewer, double-click on
configFile. -
Type
CfgFontFamilies. It should scroll the list to where it is. -
Double-click it and it should show the font you have added :)
-
If so, then your font is ready to be used in the game. To see it, make sure any Dialog/Display control with a
textproperty hasfont = "theFontYouAdded";in it and you should be able to view the font!