Available since LÖVE 0.10.0
This function is not supported in earlier versions.
Creates a new drawable Text object.
This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!
text = love.graphics.newText( font, textstring )
Font fontstring textstring (nil)Text texttext = love.graphics.newText( font, coloredtext )
Font fonttable coloredtext{color1, string1, color2, string2, ...}. table color1{red, green, blue, alpha}.string string1table color2{red, green, blue, alpha}.string string2tables and strings ...Text textlocal font = love.graphics.getFont()
--regular text
local plainText = love.graphics.newText(font, "Hello world")
--colored text
local coloredText = love.graphics.newText(font, {{1, 0, 0}, "Hello ", {0, 0, 1}, " world"}) The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text, when drawing the Text object.
© 2006–2020 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.graphics.newText