Jump to: navigation, search


HeroEngine's GUI Label control is capable (via the universal Glyph Rendering mechanic introduced in v1.21) of displaying any language character set supported by Windows, including Asian fonts. The availability of fonts is determined by the set of those fonts installed in the OS, fonts installed as a part of the client install (after which they are the same as a font installed in the OS) and fonts downloaded from the Repository and cached in the LRC.

At design time and/or runtime you have the opportunity to specify the font(s) used by your in-game GUI Controls.


Supported font file types

HeroEngine's Font Rendering supports TruType Fonts (.TTF) and Microsoft Windows bitmapped font (.FON).


HeroEngine's GUILabel control has a DisplayFont enumeration that is used by default by the label when it needs to render the label text. The available display fonts are:

The font used by a particular DisplayFont may be replaced using the external function SubstituteFont(fontToReplace as enum font, fontFace as string)


HeroEngine's GUILabel control has a property FontFace which acts as an override of the DisplayFont. When a FontFace is specified, assuming the font file containing that FontFace is loaded, the text will be rendered in the specified FontFace.

Installed Fonts verse Fonts in the Repository

Fonts are loaded on demand based on how they are named when using displayfont or fontface properties.

Installed Fonts

If a name does not include any '/' characters then it is assumed that the font is installed locally by the OS. The name that should be used is the embedded font name in the .ttf file.

Fonts in the Repository

If the name has '/' characters in it it will look at that location in the repository for that specified file.


Substituting the Font displayed by a DisplayFont

It is possible to change the font utilized by a particular DisplayFont enumeration via the external function SubstituteFont(). Following substitution, any GUILabel that has been designed to use a particular DisplayFont will use the Font specified by the substitution rather than the default. Generally, this kind of substitution is done in a game specific override to $BASECLIENT's _FirstChance() method.

// game specific override class for $BASECLIENT
method HE_FirstChance( ) as Boolean
  SubstituteFont( DEFAULTTEXT, "Fontin-Regular" )      // specify a FontFace that exists in your font file
  return false

For details on extending system nodes see: System Nodes

Loading a Font Resource from the Repository

This functionality is deprecated and no longer supported. Fonts now are loaded on demand when they are used as of HeroEngine 2.0 and beyond.

Custom fonts may be stored in the repository and loaded by an external function during startup. Choosing to load a font using this mechanism rather that substituting the font used by DisplayFont comes down to whether or not you intend to preload font resources for use with the FontFace mechanics.

LoadFontResource( "/GUI/fonts/Fontin-Regular.ttf" )  // This call is asynchronous

A callback is made to the $GUI system node at the _onFontResourceLoad() method.

Unloading a Font Resource

This functionality is deprecated and no longer supported. Fonts now are unloaded on demand when they are no longer used as of HeroEngine 2.0 and beyond.

UnloadFontResource( "/GUI/fonts/Fontin-Regular.ttf" )
Personal tools