Fonts
(→FontFace) |
(→Installed Fonts verse Fonts located in the Repository) |
||
Line 32: | Line 32: | ||
=== Installed Fonts verse Fonts located in the Repository === | === Installed Fonts verse Fonts located in the Repository === | ||
+ | Fonts are loaded on demand based on how they are named when using the de | ||
== Usage == | == Usage == |
Revision as of 20:45, 5 June 2013
|
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.
Concepts
Supported font file types
HeroEngine's Font Rendering supports TruType Fonts (.TTF) and Microsoft Windows bitmapped font (.FON).
DisplayFont
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:
- DEFAULTTEXT - 10 pt Verdana
- JUMBO - 10pt Arial Black
- LARGETEXT - 18pt Georgia
- SMALLTEXT - 7pt Verdana
- PALANTINO - 10pt Palatino Linotype (if present) or 10pt Book Antiqua
- TREBUCHET - 10pt Trebuchet MS (if present) or 10p Helvetica
- GAMETEXT - 10pt Verdana
- MONOSPACE - 8pt Courier New
The font used by a particular DisplayFont may be replaced using the external function SubstituteFont(fontToReplace as enum font, fontFace as string)
FontFace
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 located in the Repository
Fonts are loaded on demand based on how they are named when using the de
Usage
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" )