mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
970704c2b7
Text objects are Drawable objects that represent text on the screen. They decouple text drawing from text parsing and vertex uploading, in a similar manner to SpriteBatches. They also optionally allow efficient batching of text from the same Font in different relative coordinate transformations, without having many draw calls. Text objects currently have the following methods: Text:set(textstring) -- replaces any existing text in the object with the new string. Text:setf(textstring, wraplimit, alignmode) -- replaces any existing text with formatted text using the new string. Text:getFont() -- gets the Font object used for this Text object. Text:getWidth() -- gets the width in pixels of the most recently added text in the Text object. Text:getHeight() -- gets the height in pixels of the most recently added text in the Text object. Text:add(textstring, x, y, angle, sx, sy, ox, oy, kx, ky) -- adds a new string to the text object using the specified relative coordinate transformation, without replacing existing text. This behaves much like SpriteBatch:add. Text:addf(textstring, wraplimit, alignmode, x, y, angle, sx, sy, ox, oy, kx, ky) -- adds a new formatted string to the text object using the specified relative coordinate transformation. Text:clear() -- clears all text from the object. --HG-- branch : minor