Documentation/Articles/Overview of Font Definition Editor

From NeoAxis 3D Engine Wiki

Jump to: navigation, search
Go to higher level

Contents

Overview

Font Definition Editor is a part of the Resource Editor. It allows you to add fonts to your project in order to use them in user interfaces (UI).

Font Definition Editor

There are two ways to import fonts in NeoAxis::

  • using NeoAxis built-in editor to import and configure TrueType fonts in .ttf format;
  • using a third party tool to prepare a font texture file and font definition file.

Both ways have their advantages and disadvantages. It's better to use the first way when adding fonts containing a small number of symbols, because the texture with symbols is generated at runtime for a chosen screen resolution. The second way is recommended for the fonts containing a great number of symbols, e.g. for hieroglyphic fonts. In this case the texture with symbols is prepared beforehand.

Options

To open the Options window, click on the Options button of the toolbar or go to Tools -> Options. In the Options window, select Font Definition.

FontDefinitionEditor 02.jpg
Property Name Description General
Background Color the background color of the Ressource Editor render window.
Preview Text The text displayed when previewing fonts.

Importing a .ttf font

Creating a Font Definition file

Before you create a new font definition, you need to copy the desired .ttf font to Data/Fonts folder. .ttf is used for TrueType fonts storage. The next step is to create the new font definition: to do it, you need to choose File -> New -> Font Definition in the main menu. Then select a name and a language corresponding to the desired font. A new file will be created with the font properties. You need to connect it with a specific font file using the TrueTypeFontName setting. Double click on the font file (.fontDefinition) to edit it.

Font definition file properties

Font definition file properties are located in the properties window.

FontDefinitionEditor 03.jpg
Property Name Description
General
FileName This is the local path to the Font Definition file. It's set when the font definition is created.
Type This is a font type for this description. It's set when the font definition is created.
Characters
CharactersRanges The set of characters realized as a range list. Each range includes the first and the last character number.
CharactersString Set of сharacters realized as a line.
TrueType
AdvanceMultiplier Determines how much space there will be between characters on display. The default value is 1 and you can specify a value between 0.5 and 2.
DrawOffsetY Allows to move characters up or down a bit.
InGame3DGuiHeightInPixels Specifies font height in pixels inside the 3D game interface.
SizeMultiplier With this parameter you can increase the base size of your font in both X and Y axis. Allows uniform and non-uniform scaling.
TextureIndentBetweenCharacters This value determines the space between characters on the texture. If this value is set too low, you will see pixels from another character causing artifacts on your text. If this value is set too high, the texture will not be optimized.
TextureSize This is the texture size. You need to set only one value because fonts textures are square. It can be set to 512, 1024 or 2048 pixels.
TrueTypeFontName This is a path to the Font Definition file. You can only use TrueType fonts (.ttf). To set the font file, please select the property and press the ... button on the right side.

Texture preview

If you want to see how does the texture for your font look like, you can preview it by using the list at the bottom of the Properties window:

Texture preview selection

Creating a font with a Font Generator

Except TrueType fonts, you can also create fonts in third-party utilities. For example, Bitmap Font Generator. You can find it in "SDK\Tools\Fonts\BitmapFontGenerator"folder.


FontDefinitionEditor 05.jpg

Creating a texture

After launching Bitmap Font Generator, go to the texture generation settings. The settings are divided into two parts. The first part is located in the following window: Options -> Font Settings. Specify the font which is used and press the OK button.

FontDefinitionEditor 06.jpg

Export settings are located in the other window. To open it, select Export Options in the Options menu. In opened window you need to specify XML as the output file format and press the OK button. You can also specify parameters such as the spacing between characters, texture size, texture format and more.

FontDefinitionEditor 07.jpg

Now select the used characters in the work area of the tool's main window. You can also specify the set of characters in the right part of the window.

FontDefinitionEditor 08.jpg

In order to save the font texture, select Save bitmap font as... in the Options menu. When saving the font, you can only use English letters and numbers.

Converting the Texture into a Font Definition file

Now you need to create a font definition based on the texture. The SDK has a special tool BitmapFontGeneratorToNeoAxisConverter for that. It is located in the "SDK\Tools\Fonts\BitmapFontGeneratorToNeoAxisConverter" directory.

After launching the tool, specify the font file in .fnt. To do that, you need to press "..." and select already created the font file.

FontDefinitionEditor 09.jpg

When the file has been selected, press the Convert button.

FontDefinitionEditor 10.jpg

When the font definition has been generated, you will see the following message:

FontDefinitionEditor 11.jpg

This means that the font creation is complete. You can view the result in the Resource Editor.

FontDefinitionEditor 12.jpg

Now the new font, created with Bitmap Font Generator, is ready to be used.