Module ncine.textnode
The table containing textnode related functions.
Inherits from ncine.drawable_node.
Functions
ncine.textnode.new (parent, font, max_string_length) | Constructs a textnode object with a parent scene node, a font, and a maximum text string length. |
ncine.textnode.clone (textnode) | Constructs a new textnode object as a clone of the specified one. |
ncine.textnode.delete (textnode) | Destroys a textnode object and releases its memory |
ncine.textnode.get_width (textnode) | Returns the width of rendered text |
ncine.textnode.get_height (textnode) | Returns the height of rendered text |
ncine.textnode.get_abswidth (textnode) | Returns the absolute width of rendered text |
ncine.textnode.get_absheight (textnode) | Returns the absolute height of rendered text |
ncine.textnode.get_font (textnode) | Returns the font object used by the textnode |
ncine.textnode.set_font (textnode, font) | Sets the font object to be used by the textnode |
ncine.textnode.get_render_mode (textnode) | Returns the render mode used to render this text node |
ncine.textnode.set_render_mode (textnode, font_render_mode) | Sets the render mode used to render this text node, overriding the font one |
ncine.textnode.get_kerning (textnode) | Returns true if kerning is enabled for this node rendering |
ncine.textnode.set_kerning (textnode, with_kerning) | Sets the kerning flag for this node rendering |
ncine.textnode.get_alignment (textnode) | Returns the horizontal text alignment of multiple lines |
ncine.textnode.set_alignment (textnode, text_alignment) | Sets the horizontal text alignment of multiple lines |
ncine.textnode.get_lineheight (textnode) | Returns the text node line height |
ncine.textnode.get_abslineheight (textnode) | Returns the text node line height multiplied by the absolute vertical scale factor |
ncine.textnode.set_lineheight (textnode, line_height) | Sets the text node line height |
ncine.textnode.get_string (textnode) | Returns the string to render |
ncine.textnode.set_string (textnode, string) | Sets the string to render |
ncine.textnode.calculate_boundaries (font, with_kerning, string) | Calculates the rectangle boundaries needed to render the provided string with the specified font |
Tables
textnodeObj | The light user data of a textnode object. |
ncine.text_alignment | Text alignments (enumeration) |
Functions
- ncine.textnode.new (parent, font, max_string_length)
-
Constructs a textnode object with a parent scene node, a font, and a maximum text string length.
Don’t forget to call ncine.textnode.delete when you are done with it!
Parameters:
- parent ncine.scenenode.scenenodeObj or nil The parent scenenode
- font ncine.font.fontObj or nil The font object
- max_string_length integer The maximum length for the text
Returns:
-
textnodeObj
A new textnode object
- ncine.textnode.clone (textnode)
-
Constructs a new textnode object as a clone of the specified one.
Don’t forget to call ncine.textnode.delete when you are done with it!
Parameters:
- textnode textnodeObj The textnode object to be cloned
Returns:
-
textnodeObj
The cloned textnode object
- ncine.textnode.delete (textnode)
-
Destroys a textnode object and releases its memory
Parameters:
- textnode textnodeObj The textnode object to be destroyed
- ncine.textnode.get_width (textnode)
-
Returns the width of rendered text
Parameters:
- textnode textnodeObj
Returns:
-
number
- ncine.textnode.get_height (textnode)
-
Returns the height of rendered text
Parameters:
- textnode textnodeObj
Returns:
-
number
- ncine.textnode.get_abswidth (textnode)
-
Returns the absolute width of rendered text
Parameters:
- textnode textnodeObj
Returns:
-
number
- ncine.textnode.get_absheight (textnode)
-
Returns the absolute height of rendered text
Parameters:
- textnode textnodeObj
Returns:
-
number
- ncine.textnode.get_font (textnode)
-
Returns the font object used by the textnode
Parameters:
- textnode textnodeObj
Returns:
-
fontObj
- ncine.textnode.set_font (textnode, font)
-
Sets the font object to be used by the textnode
Parameters:
- textnode textnodeObj
- font scene.font.fontObj
- ncine.textnode.get_render_mode (textnode)
-
Returns the render mode used to render this text node
Parameters:
- textnode textnodeObj
Returns:
-
ncine.font_render_mode
- ncine.textnode.set_render_mode (textnode, font_render_mode)
-
Sets the render mode used to render this text node, overriding the font one
Parameters:
- textnode textnodeObj
- font_render_mode ncine.font_render_mode
- ncine.textnode.get_kerning (textnode)
-
Returns
true
if kerning is enabled for this node renderingParameters:
- textnode textnodeObj
Returns:
-
boolean
- ncine.textnode.set_kerning (textnode, with_kerning)
-
Sets the kerning flag for this node rendering
Parameters:
- textnode textnodeObj
- with_kerning boolean
- ncine.textnode.get_alignment (textnode)
-
Returns the horizontal text alignment of multiple lines
Parameters:
- textnode textnodeObj
Returns:
-
ncine.text_alignment
- ncine.textnode.set_alignment (textnode, text_alignment)
-
Sets the horizontal text alignment of multiple lines
Parameters:
- textnode textnodeObj
- text_alignment ncine.text_alignment
- ncine.textnode.get_lineheight (textnode)
-
Returns the text node line height
Parameters:
- textnode textnodeObj
Returns:
-
number
- ncine.textnode.get_abslineheight (textnode)
-
Returns the text node line height multiplied by the absolute vertical scale factor
Parameters:
- textnode textnodeObj
Returns:
-
number
- ncine.textnode.set_lineheight (textnode, line_height)
-
Sets the text node line height
Parameters:
- textnode textnodeObj
- line_height number
- ncine.textnode.get_string (textnode)
-
Returns the string to render
Parameters:
- textnode textnodeObj
Returns:
- ncine.textnode.set_string (textnode, string)
-
Sets the string to render
Parameters:
- textnode textnodeObj
- string string
- ncine.textnode.calculate_boundaries (font, with_kerning, string)
-
Calculates the rectangle boundaries needed to render the provided string with the specified font
Parameters:
- font ncine.font.fontObj
- with_kerning boolean
- string string
Returns:
-
ncine.vec2
Tables
- textnodeObj
-
The light user data of a textnode object.
Inherits from ncine.drawable_node.drawablenodeObj.
- ncine.text_alignment
-
Text alignments (enumeration)
Fields:
- LEFT
- CENTER
- RIGHT