» Back To Index
The <font> node
Function
The font node makes it possible to display information in textual form. It uses Windows TTF fonts
(True Type Fonts). The texts can be displayed in 2d or 3d coordinates
(useful to perform an axis graduation for example).
It is possible, since version 0.9.85, to display text with a LUA scripting code using the
HYP_DrawText() function from the Hyperion/LUA API.
General syntax
<font
name=""
render="TRUE"
ttf_name="Arial"
size="14" >
<text_2d>
<color
r="0.0"
g="0.0"
b="0.0" />
<position
x="0"
y="0" />
<text
text="" />
</text_2d>
<text_3d>
<color
r="0.0"
g="0.0"
b="0.0" />
<position
x="0.0"
y="0.0"
z="0.0" />
<text
text="" />
</text_3d>
</font>
font element
font is the xml tag that defines a font node.
Attributes:
- name - [STR127] - name of the node. This name will make it possible to refer this node throughout the XML script.
- render - [BOOLEAN] - enables (TRUE) or disables (FALSE) the font rendering - default value: TRUE
size - [INTEGER] - specifies the font size - default value: 14
ttf_name - [STR127] - name of the TrueType used font: Arial, Verdana, Trebuchet MS, etc... - default value: Arial
group - [STR127] - name of the group where you can add the current node. A group makes it possible to control the
behavior of several objects in an unique way.
text_2d element
text_2d makes it possible to create sub-nodes to render texts in 2d coordinates with various positions.
Syntax
<font>
<text_2d>
<...>
<...>
</text_2d>
</font>
color element (text_2d.color)
color specifies the color of the text.
Attributes:
- r - [CLAMPED_REAL] - red component of the color - default value: 0.0
- g - [CLAMPED_REAL] - green component of the color - default value: 0.0
- b - [CLAMPED_REAL] - blue component of the color - default value: 0.0
position element (text_2d.position)
position specifies the starting position of the 2d text. The position is expressed in screen coordinates,
i.e. the X=0 and Y=0 position corresponds to the upper left corner of the application window.
Attributes:
- x - [INTEGER] - X coordinate of the beginning of the text - default value: 0
- y - [INTEGER] - Y coordinate of the beginning of the text - default value: 0
text element (text_2d.text)
text specifies the text to be displayed as a string character.
Attributes:
- text - [STR255] - string character of the text.
text_3d element
text_3d makes it possible to create sub-nodes (sub-elements) to display texts in 3d coordinates with various positions.
Syntax
<font>
<text_3d>
<...>
<...>
</text_3d>
</font>
color element (text_3d.color)
color specifies the color of the text.
Attributes:
- r - [CLAMPED_REAL] - red component of the color - default value: 0.0
- g - [CLAMPED_REAL] - green component of the color - default value: 0.0
- b - [CLAMPED_REAL] - blue component of the color - default value: 0.0
position element (text_3d.position)
position specifies the starting position of the text in 3d. The position is expressed in 3d scene coordinates
in the same way as the position of any 3d object (mesh, model, light, etc...).
Attributes:
- x - [REAL] - X coordinate of the beginning of the text - default value: 0.0
- y - [REAL] - Y coordinate of the beginning of the text - default value: 0.0
- z - [REAL] - Z coordinate of the beginning of the text - default value: 0.0
text element (text_3d.text)
text specifies the text to be displayed as a string character.
Attributes:
- text - [STR255] - string character of the text.