Love2D APITextOn this pageText Description: Drawable text. type Type: Function. Description: Gets the type of the object as a string. Signature: type: function(self: Text): string Returns: Return TypeDescriptionstringThe type as a string. Of Type: Function. Description: Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true. Signature: typeOf: function(self: Text, type_name: string): boolean Parameters: ParameterTypeDescriptiontype_namestringThe name of the type to check for. Returns: Return TypeDescriptionbooleanTrue if the object is of the specified type, false otherwise. release Type: Function. Description: Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread. This method can be used to immediately clean up resources without waiting for Lua's garbage collector. Signature: release: function(self: Text): boolean Returns: Return TypeDescriptionbooleanTrue if the object was released by this call, false if it had been previously released. set Type: Function. Description: Replaces the contents of the Text object with a new unformatted string. Signature: set: function(self: Text, text: string) Parameters: ParameterTypeDescriptiontextstringThe new string of text to use. set Type: Function. Description: Replaces the contents of the Text object with a new unformatted string. Signature: set: function(self: Text, text: {string | Color}) Parameters: ParameterTypeDescriptiontext{stringColor} setf Type: Function. Description: Replaces the contents of the Text object with a new formatted string. Signature: setf: function(self: Text, text: string, wrap_limit: number, align: AlignMode) Parameters: ParameterTypeDescriptiontextstringThe new string of text to use.wrap_limitnumberThe maximum width in pixels of the text before it gets automatically wrapped to a new line.alignAlignModeThe alignment of the text. setf Type: Function. Description: Replaces the contents of the Text object with a new formatted string. Signature: setf: function(self: Text, text: {string | Color}, wrap_limit: number, align: AlignMode) Parameters: ParameterTypeDescriptiontext{stringColor}wrap_limitnumberThe maximum width in pixels of the text before it gets automatically wrapped to a new line.alignAlignModeThe alignment of the text. add Type: Function. Description: Adds additional colored text to the Text object at the specified position. Signature: add: function(self: Text, text: ColoredText, transform: Transform): integer Parameters: ParameterTypeDescriptiontextColoredTextThe text to add to the object.transformTransformThe position of the new text on the x-axis. (Default: 0.) Returns: Return TypeDescriptionintegerindex — An index number that can be used with Text:getWidth or Text:getHeight. add Type: Function. Description: Adds additional colored text to the Text object at the specified position. Signature: add: function(self: Text, text: ColoredText, x?: number, y?: number, angle?: number, scale_x?: number, scale_y?: number, origin_x?: number, origin_y?: number, shear_x?: number, shear_y?: number): integer Parameters: ParameterTypeDescriptiontextColoredTextA table containing colors and strings to add to the object, in the form of {color1, string1, color2, string2, ...}.xnumberThe position of the new text on the x-axis. (Default: 0.)ynumberThe position of the new text on the y-axis. (Default: 0.)anglenumberThe orientation of the new text in radians. (Default: 0.)scale_xnumberScale factor on the x-axis. (Default: 1.)scale_ynumberScale factor on the y-axis. (Default: sx.)origin_xnumberOrigin offset on the x-axis. (Default: 0.)origin_ynumberOrigin offset on the y-axis. (Default: 0.)shear_xnumberShearing / skew factor on the x-axis. (Default: 0.)shear_ynumberShearing / skew factor on the y-axis. (Default: 0.) Returns: Return TypeDescriptionintegerindex — An index number that can be used with Text:getWidth or Text:getHeight. addf Type: Function. Description: Adds additional formatted / colored text to the Text object at the specified position. -- The word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change. Signature: addf: function(self: Text, text: ColoredText, wrap_limit: number, align: AlignMode, transform: Transform): integer Parameters: ParameterTypeDescriptiontextColoredTextThe text to add to the object.wrap_limitnumberThe maximum width in pixels of the text before it gets automatically wrapped to a new line.alignAlignModeThe alignment of the text.transformTransformThe position of the new text (x-axis). Returns: Return TypeDescriptionintegerindex — An index number that can be used with Text:getWidth or Text:getHeight. addf Type: Function. Description: Adds additional formatted / colored text to the Text object at the specified position. -- The word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change. Signature: addf: function(self: Text, text: ColoredText, wrap_limit: number, align: AlignMode, x?: number, y?: number, angle?: number, scale_x?: number, scale_y?: number, origin_x?: number, origin_y?: number, shear_x?: number, shear_y?: number): integer Parameters: ParameterTypeDescriptiontextColoredTextA table containing colors and strings to add to the object, in the form of {color1, string1, color2, string2, ...}.wrap_limitnumberThe maximum width in pixels of the text before it gets automatically wrapped to a new line.alignAlignModeThe alignment of the text.xnumberThe position of the new text (x-axis).ynumberThe position of the new text (y-axis).anglenumberOrientation (radians). (Default: 0.)scale_xnumberScale factor (x-axis). (Default: 1.)scale_ynumberScale factor (y-axis). (Default: sx.)origin_xnumberOrigin offset (x-axis). (Default: 0.)origin_ynumberOrigin offset (y-axis). (Default: 0.)shear_xnumberShearing / skew factor (x-axis). (Default: 0.)shear_ynumberShearing / skew factor (y-axis). (Default: 0.) Returns: Return TypeDescriptionintegerindex — An index number that can be used with Text:getWidth or Text:getHeight. clear Type: Function. Description: Clears the contents of the Text object. Signature: clear: function(self: Text) setFont Type: Function. Description: Replaces the Font used with the text. Signature: setFont: function(self: Text, font: Font) Parameters: ParameterTypeDescriptionfontFontThe new font to use with this Text object. getFont Type: Function. Description: Gets the Font used with the Text object. Signature: getFont: function(self: Text): Font Returns: Return TypeDescriptionFontThe font used with this Text object. getWidth Type: Function. Description: Gets the width of the text in pixels. Signature: getWidth: function(self: Text): number Returns: Return TypeDescriptionnumberwidth — The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned. getWidth Type: Function. Description: Gets the width of the text in pixels. Signature: getWidth: function(self: Text, index: integer): number Parameters: ParameterTypeDescriptionindexintegerAn index number returned by Text:add or Text:addf. Returns: Return TypeDescriptionnumberThe width of the sub-string (before scaling and other transformations). getHeight Type: Function. Description: Gets the height of the text in pixels. Signature: getHeight: function(self: Text): number Returns: Return TypeDescriptionnumberheight — The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned. getHeight Type: Function. Description: Gets the height of the text in pixels. Signature: getHeight: function(self: Text, index: integer): number Parameters: ParameterTypeDescriptionindexintegerAn index number returned by Text:add or Text:addf. Returns: Return TypeDescriptionnumberheight — The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned. getDimensions Type: Function. Description: Gets the width and height of the text in pixels. Signature: getDimensions: function(self: Text): number, number Returns: Return TypeDescriptionnumberwidth — The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned.numberheight — The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned. getDimensions Type: Function. Description: Gets the width and height of the text in pixels. Signature: getDimensions: function(self: Text, index: integer): number, number Parameters: ParameterTypeDescriptionindexintegerAn index number returned by Text:add or Text:addf. Returns: Return TypeDescriptionnumberThe width of the sub-string (before scaling and other transformations).numberThe height of the sub-string (before scaling and other transformations).