Module Text
Component to handle all GUI texts.
Druid text can adjust itself for text node size
Text will never will be outside of his text size (even multiline)
get_text_adjust(self, adjust_type) |
Return current text adjust type |
get_text_size(self[, text]) |
Calculate text width with font with respect to trailing space |
init(self, node[, value[, adjust_type=0]]) |
Component init function |
is_multiline(self) |
Return true, if text with line break |
set_alpha(self, alpha) |
Set alpha |
set_color(self, color) |
Set color |
set_minimal_scale(self, minimal_scale) |
Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types |
set_pivot(self, pivot) |
Set text pivot. |
set_scale(self, scale) |
Set scale |
set_text_adjust(self[, adjust_type[, minimal_scale]]) |
Set text adjust, refresh the current text visuals, if needed |
set_to(self, set_to) |
Set text to text field |
style |
Component style params. |
-
get_text_adjust(self, adjust_type)
-
Return current text adjust type
Parameters:
Returns:
number
The current text adjust type
-
get_text_size(self[, text])
-
Calculate text width with font with respect to trailing space
Parameters:
Returns:
-
number
Width
-
number
Height
-
init(self, node[, value[, adjust_type=0]])
-
Component init function
Parameters:
- self
Text
Text
- node
node
Gui text node
- value
string
Initial text. Default value is node text from GUI scene.
(optional)
- adjust_type
int
Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
(default 0)
-
is_multiline(self)
-
Return true, if text with line break
Parameters:
Returns:
bool
Is text node with line break
-
set_alpha(self, alpha)
-
Set alpha
Parameters:
- self
Text
Text
- alpha
number
Alpha for node
Returns:
Text
Current text instance
-
set_color(self, color)
-
Set color
Parameters:
- self
Text
Text
- color
vector4
Color for node
Returns:
Text
Current text instance
-
set_minimal_scale(self, minimal_scale)
-
Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types
Parameters:
- self
Text
Text
- minimal_scale
number
If pass nil - not use minimal scale
Returns:
Text
Current text instance
-
set_pivot(self, pivot)
-
Set text pivot. Text will re-anchor inside text area
Parameters:
- self
Text
Text
- pivot
gui.pivot
Gui pivot constant
Returns:
Text
Current text instance
-
set_scale(self, scale)
-
Set scale
Parameters:
- self
Text
Text
- scale
vector3
Scale for node
Returns:
Text
Current text instance
-
set_text_adjust(self[, adjust_type[, minimal_scale]])
-
Set text adjust, refresh the current text visuals, if needed
Parameters:
- self
Text
Text
- adjust_type
number
See const.TEXT_ADJUST. If pass nil - use current adjust type
(optional)
- minimal_scale
number
If pass nil - not use minimal scale
(optional)
Returns:
Text
Current text instance
-
set_to(self, set_to)
-
Set text to text field
Parameters:
Returns:
Text
Current text instance
-
style
-
Component style params.
You can override this component styles params in druid styles table
or create your own style
Fields:
- TRIM_POSTFIX
string
The postfix for TRIM adjust type
(default ...)
- DEFAULT_ADJUST
string
The default adjust type for any text component
(default DOWNSCALE)
-
adjust_type
-
Current text size adjust settings
-
color
-
Current text color
-
node
-
Text node
-
node_id
-
The node id of text node
-
on_set_pivot
-
On change pivot callback(self, pivot)
-
on_set_text
-
On set text callback(self, text)
-
on_update_text_scale
-
On adjust text size callback(self, new_scale)
-
pos
-
Current text position
-
scale
-
Current text node scale
-
start_scale
-
Initial text node scale
-
start_size
-
Initial text node size
-
text_area
-
Current text node available are