Commit Graph

35 Commits

Author SHA1 Message Date
Alex Szpakowski 970704c2b7 Added Text objects via love.graphics.newText(font [, textstring]). Reworked the internal code of Font objects to use fewer individual textures and less VRAM per object, and to be compatible with OpenGL ES. Slightly improved the performance of love.graphics.print and love.graphics.printf.
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
2015-01-23 00:47:28 -04:00
Alex Szpakowski c7b45b3505 Updated copyright for the new year 2014-12-31 19:32:43 -04:00
Alex Szpakowski dfa319e01a Replaced the EXCEPT_GUARD macro for converting love exceptions into Lua errors with the new luax_catchexcept function, which takes lambda function arguments. 2014-06-03 19:27:00 -03:00
Alex Szpakowski 3120a0e650 Goodbye 2013, hello 2014! 2014-01-03 17:28:58 -04:00
Alex Szpakowski aa69a695d3 Canvases can now be used in SpriteBatches, ParticleSystems, and Meshes (resolves issue #782).
Canvases and Images are now subclasses of the new Texture class.
Added setTexture and getTexture methods for Meshes, ParticleSystems, and SpriteBatches (the old set/getImage methods are deprecated but not removed.)
Canvas texture coordinates are no longer flipped.
2014-01-03 17:07:12 -04:00
Alex Szpakowski 4e321697d3 Renamed Font:hasGlyph to Font:hasGlyphs, and expanded it to accept multiple arguments and full strings. Resolves issue #762. 2013-10-25 21:56:32 -03:00
Alex Szpakowski 06f80d5c08 Fixed undefined behaviour when love exceptions are converted into Lua errors (resolves issue #729) 2013-09-05 23:17:29 -03:00
Alex Szpakowski 76618f0328 Cleaned up font code to always use uint32 instead of the slightly more ambiguous "unsigned int" for codepoints 2013-06-16 19:48:53 -03:00
Alex Szpakowski d48d1fd441 Exposed the internal Rasterizer and GlyphData object methods to Lua. Also added Font:hasGlyph. 2013-06-16 07:36:18 -03:00
Alex Szpakowski 2009124cf9 Reworked internal anisotropic filtering code to be more concise and intuitive 2013-03-21 12:21:13 -03:00
Alex Szpakowski 25d6700361 Moved anisotropic filtering to Image:setFilter(min, mag, anisotropy), added anisotropic filtering support to canvases and fonts 2013-03-20 23:23:26 -03:00
Alex Szpakowski d9736ab3ab Removed mipmap support from Font graphics objects 2013-02-19 14:21:01 -04:00
Alex Szpakowski 96161c66f6 Updated copyright text for the new year 2013-02-05 05:32:49 -04:00
rude 4e2c424cd1 Alexander's patch for improved mipmap API. 2013-01-19 11:25:25 +01:00
Bart van Strien 32684b674e Add Font:getAscent/getDescent/getBaseline (issue #445) 2013-01-18 13:20:40 +01:00
Alexander Szpakowski 36c5259e12 Font objects now have mipmap filter and mipmap sharpness support 2013-01-07 16:31:48 -04:00
Alexander Szpakowski e5388ff73b Removed more unnecessary tabs in blank lines 2013-01-07 07:11:40 -04:00
Alexander Szpakowski 8b3fb1d71c Code cleanup 2013-01-02 17:19:41 -04:00
Alexander Szpakowski 1678252b7a Applied patch from issue #542 (texture filtering inconsistencies) in main LÖVE repository 2013-01-01 21:29:38 -04:00
Bart van Strien 7793e7f02f CRLF to LF 2012-07-04 14:40:24 +02:00
rude 81c38e22d0 Applied the new style guidelines.
Well, sort of. Lot's more to be done, but this is a start.
2012-06-28 23:52:33 +02:00
Bill Meltsner be55579a22 Happy New Year, have an enormous diff 2012-01-09 02:41:11 -06:00
Bart van Strien c707a4ca45 Properly export all lua-facing functions and use those for initialization (love.cpp no longer explicitly mentions implementations) 2011-12-24 01:10:40 +01:00
Bart van Strien e37470f54d No more Font:set(), instead love.graphics.setNewFont 2011-12-13 19:22:59 +01:00
Bart van Strien 9682ebecf9 Remove love.graphics.setFont([<file>,] <size>) shorthand, idiom is now love.graphics.newFont([<file>,] <size>):set()
This makes sure that setFont doesn't create any fonts.
2011-12-13 18:51:24 +01:00
Bart van Strien 0aae9684b3 Automated formatting fix 2011-11-16 11:32:41 +01:00
Bart van Strien 6e630e8987 Fix width for getWrap and catch utf8 decoding errors in getWrap and getSize (issues #230 and #244) 2011-09-03 16:22:21 +02:00
Bart van Strien 190e11d016 Move wrapping to Font::getWrap and make printf use that (fixes issue #230) 2011-09-03 14:31:31 +02:00
Bill Meltsner fde708160e bringing in the new year by changing every 2010 to 2011 2011-01-15 14:40:27 -06:00
bart@bartbes.ath.cx 0188572124 Added maxwidth, lines = font:getWrap(string, wrap) by feature request 2010-06-12 15:35:54 +02:00
Bill Meltsner de6c8fd704 fonts now work (seemingly) as well as they used to 2010-04-15 14:04:16 -04:00
rude aa01c984b9 Updated all dates to 2010. 2010-01-31 16:54:47 +01:00
rude dd420d68a3 Ok, project generation didn't really work out. Reverted. 2009-08-10 21:33:07 +02:00
rude ba1a75e547 Added many comments, and changed function names for wrapper functions. 2009-08-09 21:08:55 +02:00
rude dcb3dfd83d Initial Mercurial commit. 2009-07-26 15:46:49 +02:00