Label

Inherits: Control < CanvasItem < Node < Object

Category: Core

Brief Description

Control that displays formatted text.

Member Functions

int get_align ( ) const
int get_line_count ( ) const
int get_line_height ( ) const
int get_lines_skipped ( ) const
int get_max_lines_visible ( ) const
float get_percent_visible ( ) const
String get_text ( ) const
int get_total_character_count ( ) const
int get_valign ( ) const
int get_visible_characters ( ) const
int get_visible_line_count ( ) const
bool has_autowrap ( ) const
bool is_clipping_text ( ) const
bool is_uppercase ( ) const
void set_align ( int align )
void set_autowrap ( bool enable )
void set_clip_text ( bool enable )
void set_lines_skipped ( int lines_skipped )
void set_max_lines_visible ( int lines_visible )
void set_percent_visible ( float percent_visible )
void set_text ( String text )
void set_uppercase ( bool enable )
void set_valign ( int valign )
void set_visible_characters ( int amount )

Member Variables

Numeric Constants

  • ALIGN_LEFT = 0 — Align rows to the left (default).
  • ALIGN_CENTER = 1 — Align rows centered.
  • ALIGN_RIGHT = 2 — Align rows to the right (default).
  • ALIGN_FILL = 3 — Expand row whitespaces to fit the width.
  • VALIGN_TOP = 0 — Align the whole text to the top.
  • VALIGN_CENTER = 1 — Align the whole text to the center.
  • VALIGN_BOTTOM = 2 — Align the whole text to the bottom.
  • VALIGN_FILL = 3 — Align the whole text by spreading the rows.

Description

Label is a control that displays formatted text, optionally autowrapping it to the Control area. It inherits from range to be able to scroll wrapped text vertically.

Member Function Description

  • int get_align ( ) const

Return the alignment mode (any of the ALIGN_* enumeration values).

  • int get_line_count ( ) const

Return the amount of lines.

  • int get_line_height ( ) const

Return the height of a line.

  • int get_lines_skipped ( ) const

Return the the number of lines to skipped before displaying.

  • int get_max_lines_visible ( ) const

Return the restricted number of lines to display. Returns -1 if unrestricted.

  • float get_percent_visible ( ) const

Return the restricted number of characters to display (as a percentage of the total text).

Return the label text. Text can contain newlines.

  • int get_total_character_count ( ) const

Return the total length of the text.

  • int get_valign ( ) const

Return the vertical alignment mode (any of the VALIGN_* enumeration values).

  • int get_visible_characters ( ) const

Return the restricted number of characters to display. Returns -1 if unrestricted.

  • int get_visible_line_count ( ) const
  • bool has_autowrap ( ) const

Return the state of the autowrap mode (see set_autowrap).

  • bool is_clipping_text ( ) const

Return true if text would be cut off if it is too wide.

  • bool is_uppercase ( ) const

Return true if text is displayed in all capitals.

  • void set_align ( int align )

Sets the alignment mode to any of the ALIGN_* enumeration values.

  • void set_autowrap ( bool enable )

Set autowrap mode. When enabled, autowrap will fit text to the control width, breaking sentences when they exceed the available horizontal space. When disabled, the label minimum width becomes the width of the longest row, and the minimum height large enough to fit all rows.

  • void set_clip_text ( bool enable )

Cuts off the rest of the text if it is too wide.

  • void set_lines_skipped ( int lines_skipped )

Sets the number of lines to skip before displaying. Useful for scrolling text.

  • void set_max_lines_visible ( int lines_visible )

Restricts the number of lines to display. Set to -1 to disable.

  • void set_percent_visible ( float percent_visible )

Restricts the number of characters to display (as a percentage of the total text).

  • void set_text ( String text )

Set the label text. Text can contain newlines.

  • void set_uppercase ( bool enable )

Display text in all capitals.

  • void set_valign ( int valign )

Sets the vertical alignment mode to any of the VALIGN_* enumeration values.

  • void set_visible_characters ( int amount )

Restricts the number of characters to display. Set to -1 to disable.