User Tools

Site Tools


en:orx:config:settings_structure:orxtext

This is an old revision of the document!


orxTEXT structure

Summary

Text

[TextTemplate]
Font   = FontTemplate
String = <string>

Font

[FontTemplate]
Texture         = path/to/ImageFile
TextureCorner   = <vector>
TextureSize     = <vector>
CharacterList   = <string>
CharacterSize   = <vector>
CharacterStride = <vector>

Details

Text

Here's a list of available properties for an orxTEXT structure:

  • Font: Specifies a font to use for this text. If no value is specified, orx's default font 1) will be used. NB: If its value begins with a dollar ('$'), the rest of the value will be used as a key for the localization module.
  • String: Defines the content of this orxTEXT as plain text. NB: If its value begins with a dollar ('$'), the rest of the value will be used as a key for the localization module.

Here's a small example.

[Text1]
String = This is our first text
Font   = Font1
 
[Text2]
String = $Greetings
Font   = $FontKey

Text1 has a static plain text content with a static custom font called Font1 whereas Text2 points to the localization keys named Greetings for its text content and FontKey for its font. This means that its content and font are defined in the orxLOCALE module and will always be expressed according to the current selected language.

NB: If the current language is changed at runtime, the text's content will be automagically updated without requiring any code.

Font

Here's a list of available properties for an orxFONT structure:

  • Texture: Specifies which bitmap file to use as texture for our font object.
  • TextureCorner: Specifies the top left corner of the first defined character in the bitmap file, in pixels (Z coordinate being ignored). By default its value is (0, 0, 0) which means the texture for the font object will begin at the top left of the bitmap file.
  • TextureSize: Specifies the size, in pixels, of the bitmap file where characters are defined (Z coordinate being ignored). By default it will use the whole bitmap, ie. its value will be the size of the bitmap.
  • CharacterList: Specifies all the characters that are defined in the bitmap file, ie. all the characters with a glyph in the texture file will have to be specified in order of appearance. The string can be encoded in strict ANSI or UTF-8. ISO-Latin-1 is not supported! To avoid special characters to be handled by orx's config parser 2), the string is likely to be defined as a block using the block marker ('”'). In order to specify '“' itself in the string, this character needs to be doubled!
  • CharacterSize: A vector specifying the size of a character, in pixels (Z coordinate being ignored). Orx only supports monospaced fonts at this time and all the characters need to be organized in a grid manner without any extra space between them.
  • CharacterStride: A vector specifying the empty space between characters, in pixels (Z coordinate being ignored).

An example of how to use custom fonts can be found in the stand alone/localization tutorial 3).

1)
Dina, an open source font by Jørgen 'Jibs' Ibsen
2)
such as '#', ';', '“', '~', '$', …
3)
at the end of 10_StandAlone.ini
en/orx/config/settings_structure/orxtext.1278703722.txt.gz · Last modified: 2017/05/30 00:50 (7 years ago) (external edit)