function TextSprite()
{
	CanvasSprite.call(this);
	
	this.name = "text";
	this.type = "TextSprite";
	
	var text = "";
	var color = "#FFFFFF";
	var outline = true;
	var outlineColor = "#000000";
	var outlineWidth = 1;
	var resolution = 32;
	var align = TextSprite.CENTER;
	var font = "arial";

	Object.defineProperties(this,
		{
		/**
		 * CSS Font style to be used.
		 * 
		 * @attribute font
		 * @type {string}
		 */
			font:
		{
			get: function() {return font;},
			set: function(value) {font = value; this.drawText();}
		},

			/**
			 * Horizontal text alignment can be
			 *    - TextSprite.LEFT
			 *    - TextSprite.RIGHT
			 *    - TextSprite.CENTER
			 *
			 * @attribute align
			 * @type {string}
			 */
			align:
		{
			get: function() {return align;},
			set: function(value) {align = value; this.drawText();}
		},

			/**
			 * CSS color of the text.
			 * 
			 * @attribute color
			 * @type {string}
			 */
			color:
		{
			get: function() {return color;},
			set: function(value) {color = value; this.drawText();}
		},

			/**
			 * Text of this object.
			 * 
			 * @attribute text
			 * @type {string}
			 */
			text:
		{
			get: function() {return text;},
			set: function(value)
			{
				if (value !== text)
				{
					text = value;
					this.drawText();
				}
			}
		},

			/**
			 * Indicates if the text has an outline border.
			 * 
			 * @attribute outline
			 * @type {boolean}
			 */
			outline:
		{
			get: function() {return outline;},
			set: function(value) {outline = value; this.drawText();}
		},

			/**
			 * CSS color of the outline.
			 * 
			 * @attribute outlineColor
			 * @type {string}
			 */
			outlineColor:
		{
			get: function() {return outlineColor;},
			set: function(value) {outlineColor = value; this.drawText();}
		},

			/**
			 * Width of the text outline.
			 * 
			 * @attribute outlineWidth
			 * @type {number}
			 */
			outlineWidth:
		{
			get: function() {return outlineWidth;},
			set: function(value) {outlineWidth = value; this.drawText();}
		},

			/**
			 * Vertical resolution of the texture created from canvas used.
			 * 
			 * Should always be a npot of 2.
			 *
			 * @attribute resolution
			 * @type {number}
			 */
			resolution:
		{
			get: function() {return resolution;},
			set: function(value) {resolution = value; this.drawText();}
		}
		});

	this.text = "text";
}
Text sprite is used to represent text as a sprite.

This approach is memory expensive since it needs to write a new texture for each text. But allows the used to access any font available in the browser.

The text is rendered to canvas and then copied to a texture. It automatically ajusts the object scale to match the text aspect.

@class TextSprite
@extends {CanvasSprite}