Documentation/Articles/Overview of Font Definition Editor

From NeoAxis Engine Wiki

Jump to: navigation, search
Go to higher level
Font01.jpg

Contents

Overview

With Font Definition Editor you can add various fonts to your project that can be later used in user interfaces (UI).

There are two ways to import fonts to NeoAxis:

  • using NeoAxis built-in editor to import and configure fonts in .ttf format,
  • using a third party tool to create a font texture file and fontDefinition file.

We recommend that you use the first way when adding fonts containing a small number of symbols, since in this case a separate texture for each font size will be created. The first way provides better pixel by pixel accuracy while the second one is preferable for fonts with a large number of symbols (e.g. hieroglyphic fonts).

Options

There's not much to change in Options for this editor. To open the Options window, click on the Options button of the toolbar or go to Tools -> Options.

Font Definition Editor Options window.

The only parameter you can change is the background color which you see while viewing a font. Enter a new RGBA value or use the color picker to change it. Press OK to save changes or Cancel to discard them.

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. Once you have done that, right click on the Fonts folder and select the New Resource option. Now, select the Font Definition option in the New Resource window and press Continue.

Adding a Font Definition.

Specify name and language for your font and click Next. Your new font definition file will appear, but will be empty until you assign a font file to it. Open the file in Edit Mode by double clicking on it.

Font Definition Properties

Take a look at Properties window located in the right part of your screen:

Font Definition properties.
Property name Description
FileName This is the name of your Font Definition file and local path to it. You cannot edit this field.
Type Displays the type of font that can be used in this Font Definition file. Also not editable.
AdvanceMultiplier Determines how much space will be between characters. The default value is 1 and you can specify a value from 0.5 to 2.
Characters Enables you to determine character ranges that the font will use. Small letters + capital letters + numbers + punctation fall in range from 32 to 127.
DrawOffsetY Enables you to move characters up or down a bit.
InGame3DGuiHeightInPixels Used only for In-game 3D GUI. Specifies font height in pixels.
SizeMultiplier With this parameter you can increase the base size of your font in both X and Y axis. Allows uniform and non-uniform stretch.
TextureIndentBetweenCharacters This value determines spaces between characters on the texture. If this value is set too low, you will see pixels from another character causing artifacts in your text.
TextureSize Enables you to set the texture size for this Font Definition. Can be set to 512, 1024 or 2048.
TrueTypeFontName With this parameter you can select the font that you want to use with this Font Definition file. The Choose Resource window will open if you press the Browse icon. This works only for TrueType fonts.

Preview

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

Font Definition texture.


Creating a font with a font generator

You can also create fonts in third-party utilities. An example of such a utility is Bitmap Font Generator.

In the following tutorial you will learn to create fonts in Bitmap Font Generator.

Tutorial - Creating a font in Bitmap Font Generator

First, launch Bitmap Font Generator. You can find it in the "SDK\Tools\Fonts\BitmapFontGenerator"' folder.

FontDefinitionEditor 06.jpg

Next, go to options and specify a format for output file.

To do this press the Font Settings button in the Options menu.

FontDefinitionEditor 07.jpg

Specify an output file format (XML) and press the Ok' button in the setings window.

FontDefinitionEditor 08.jpg

Now, select the required symbols in the menu to the right.

FontDefinitionEditor 09.jpg

Next, save the font texture. Press the Save bitmap font as...' button in the Options menu.

FontDefinitionEditor 10.jpg

You can only use numbers and english letters for specifying a name to save your font under. Make sure you are not using any other symbols!

Finally, you have to create a font definition based on the generated texture by means of the BitmapFontGeneratorToNeoAxisConverter utility. You can find it in the "SDK\Tools\Fonts\BitmapFontGeneratorToNeoAxisConverter" folder.

Launch BitmapFontGeneratorToNeoAxisConverter and press the "..." button. Select the previously saved font file.

FontDefinitionEditor 11.jpg

Now, press the Convert button.

FontDefinitionEditor 12.jpg

Once convertation is finished, you will see the following message:

FontDefinitionEditor 13.jpg

This means that font creation is complete.

You can view the new font in Resource Editor.

FontDefinitionEditor 14.jpg