Gah - a solution with more questions. – EntropicLqd

UE2:TrueTypeFontFactory (UT2004)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT2004 Object >> Factory >> TextureFactory >> FontFactory >> TrueTypeFontFactory (native-only)

This factory imports system fonts as Font objects. Unlike the name suggests, it is not limited to TrueType fonts, but also supports bitmap fonts, OpenType fonts and any other font standards the operating system can handle. Like the FontFactory, the TrueTypeFontFactory stores the font's characters on textures, so only one size is available per Font object. Unlike the FontFactory, however, the TrueTypeFontFactory can store fonts on multiple textures, allowing larger and more characters.


The file parameter of the standard factory import command is not used by the TrueTypeFontFactory. Instead, the following parameters can be specified:


Type: bool

Whether anti-aliasing should be applied when rendering the font. Defaults to False and is only meaningful when importing vector fonts.


Type: string

Specifies the characters to include in the font. If empty and UnicodeRange is empty as well, all extended ASCII characters are imported. If UnicodeRange is not empty, the specified Unicode ranges are added to this list of characters.

If only either an uppercase or lowercase version of a character is included, the other version of that character is remapped to the included version. Say, you included only uppercase characters, but want to draw a lowercase string. The font will "know" it needs to draw the uppercase version of those characters instead.


Type: int

The compression type to apply to the rendered font textures. Defaults to 5 (TEXF_RGBA8), which yields the best quality for all fonts. To save some storage space you can specify 8 (TEXF_DXT5) here. Other valid values are 3 (TEXF_DXT1) and 7 (TEXF_DXT3). Any values other than 3, 7 or 8 have no effect. DXT1 compression is 50% smaller than the other DXT compressions, but seems to drop all transparency information. You may have to use special Canvas.Style values (e.g. 3 for translucent or 6 for additive) to draw text with a DXT1-compressed font.

Note that DXT compression requires significant time and can slow down compiler runs if used in #exec directives. If this bothers you, consider importing the font(s) into a separate texture package once and just loading or including that via "#exec obj load" instead.


Type: int

This parameters exists (see Default Properties dialog via Actor Browser), but doesn't seem to be used. It defaults to 256.


Type: int

If any of these two parameters differs from 0, a black drop shadow is rendered with the specified offset from the character position. Both default to 0.

Small drop shadows significantly improve the readability of fonts by providing additional contrast against the background.


Type: int

These parameters resize all character regions on the rendered font textures after the font has been rendered. All default to 0.

Note that these parameters do not affect font rendering. To actually increase or reduce the amount of space between the rendered characters you have to use the X/YPad parameters.


Type: string

The exact name of the font to import. To import bold or italic forms of a font, you need to specify a different name here. Have a look into your Windows\Fonts directory for the proper name of the desired font. The font name defaults to "MS Sans Serif".

Note that font names may differ between various localized versions of Windows. While all Windows versions should come with an "Arial" font, you won't find "Arial Bold" on e.g. German Windows systems. (That font is called "Arial Fett" there.)


Type: float

This parameters exists (see Default Properties dialog via Actor Browser), but doesn't seem to be used. It defaults to 0.7.


Type: float

The desired font height. This is the same value you use e.g. in MS Word when you select a font size. Fractional values are possible, but may not look great on bitmap fonts or without anti-aliasing. Defaults to 16.0.


Type: bool

Attempts to render the font in italic (cursive, oblique) style. If you have the choice, specify the italic version of the font name instead, as that is specially designed to look good when drawn in italic style. Defaults to False.


Type: int

Modifies the actual space between drawn characters of the created font. Unlike X/YPad and ExtendBox*, which have an effect at import, this parameter is stored in the font object and takes effect at runtime when the font is drawn. Kerning defaults to 0, i.e. character spacing is not modified.


Type: string

Specifies a directory for the Wildcard parameter. Empty by default, so it falls back to the current directory, which is the project directory during a compiler run and the System directory in UnrealEd.


Type: int

Specifies the "boldness" of the font, where larger values mean thicker font lines. If you have the choice, specify the bold version of the font name instead, as that is specially designed to look good with the thicker lines. Defaults to 400.


Type: bool

Whether to underline characters when rendering the font textures. Defaults to False.

Imported underlines may look better than creating "artificial" underlining by drawing underscore characters or a simple line.


Type: string

A list of hexadecimal values separated by dashes (-) and commas, representing the Unicode values of additional characters to include in the font, for example UnicodeRange="1100-11FF,AC00-D7AF,3130-318F". Empty by default.

This doesn't override, but add to the characters specified via the Chars parameter.


Type: int

Width of the textures to render the font to. Defaults to 256.


Type: int

Maximum height of the textures to render the font to. Defaults to 256, but the final texture height may be smaller if less vertical space was used when rendering the font characters.


Type: string

Specifies a file name wildcard for files in the directory specified via Path. Empty by default.

If specified, all files matching the wildcard are scanned for characters. Any characters used in any of these files will be imported.


Type: int

Puts additional space between rendered characters in the font texture. Both default to 0.