# Defold Druid UI Library

# 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)

## Functions

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

## Tables

style | Component style params.

## Fields

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

## Functions

get_text_adjust(self, adjust_type)
  Return current text adjust type

  ### Parameters:

  - self
  - adjust_type

  ### Returns:

  number The current text adjust type
get_text_size(self[, text])
  Calculate text width with font with respect to trailing space

  ### Parameters:

  - self Text Text
  - text string (optional)

  ### Returns:

  1. number Width
  2. 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:

  - self Text Text

  ### 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:

  - self Text Text
  - set_to string Text for node

  ### Returns:

  Text Current text instance

## Tables

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)

## Fields

adjust_type
  Current text size adjust settings
  - adjust_type number
color
  Current text color
  - color vector3
node
  Text node
  - node node
node_id
  The node id of text node
  - node_id hash
on_set_pivot
  On change pivot callback(self, pivot)
  - on_set_pivot DruidEvent DruidEvent
on_set_text
  On set text callback(self, text)
  - on_set_text DruidEvent DruidEvent
on_update_text_scale
  On adjust text size callback(self, new_scale)
  - on_update_text_scale DruidEvent DruidEvent
pos
  Current text position
  - pos vector3
scale
  Current text node scale
  - scale vector3
start_scale
  Initial text node scale
  - start_scale vector3
start_size
  Initial text node size
  - start_size vector3
text_area
  Current text node available are
  - text_area vector3

generated by LDoc TESTING Last updated 2015-01-01 12:00:00