# Text

Inheritance Text View Module hilo/view/Text Requires hilo/core/Class, hilo/core/Hilo, hilo/view/View, hilo/view/CacheMixin Source Text.js
Text class provide basic text-display function, use DOMElement for complex text-display.

### Properties

Show Inherited Properties

| Property | Defined
--- | --- | ---
| color:String Color of the text. | Text
| font:String Text's CSS font style, readonly! Use setFont function to set text font. | Text
| lineSpacing:Number The spacing between lines. | Text
| maxWidth:Number The max length of the text, default value is 200. | Text
| outline:Boolean Draw the outline of the text or fill the text. | Text
| text:String Text to display. | Text
| textAlign:String Horizontal alignment way of the text. | Text
| textHeight:Number Height of the text, readonly! Works only on canvas mode. | Text
| textVAlign:String Vertical alignment way of the text. | Text
| textWidth:Number Width of the text, readonly! Works only on canvas mode. | Text
| align:String|Function The alignment of the view, the value must be one of Hilo.align enum. | View
| alpha:Number The opacity of the view, default value is 1. | View
| background:Object The background style to fill the view, can be css color, gradient or pattern of canvas | View
| boundsArea:Array The vertex points of the view, the points are relative to the center point. | View
| depth:Number The z index of the view, readonly! | View
| drawable:Drawable The drawable object of the view. | View
| height:Number The height of the view, default value is 0. | View
| id:String The identifier for the view. | View
| mask:Graphics Sets a mask for the view. | View
| onUpdate:Function This method will call while the view need update(usually caused by ticker update). | View
| parent:Container The parent view of this view, readonly! | View
| pivotX:Number Position of the center point on the x axis of the view, default value is 0. | View
| pivotY:Number Position of the center point on the y axis of the view, default value is 0. | View
| pointerEnabled:Boolean Is the view can receive DOM events, default value is true. | View
| rotation:Number The rotation of the view in angles, default value is 0. | View
| scaleX:Number The x axis scale factor of the view, default value is 1. | View
| scaleY:Number The y axis scale factor of the view, default value is 1. | View
| tint:Number The tint applied to the view，default is 0xFFFFFF.Only support in WebGL mode. | View
| transform:Matrix The transform of the view.If set the transform, x, y, scaleX, scaleY, rotation, pivotX, pivotY will be ignored.default is null. | View
| visible:Boolean The visibility of the view. | View
| width:Number The width of the view, default value is 0. | View
| x:Number The position of the view on the x axis relative to the local coordinates of the parent, default value is 0. | View
| y:Number The position of the view on the y axis relative to the local coordinates of the parent, default value is 0. | View

### Methods

Show Inherited Methods

| Method | Defined
--- | --- | ---
| Text(properties:Object) Constructor | Text
| cache(forceUpdate:Boolean) Cache the view. | Text
| setCacheDirty(dirty:Boolean) set the cache state diry. | Text
| setFont(font:String):Text Set text CSS font style. | Text
| updateCache() Update the cache. | Text
| measureFontHeight(font:String):Number static Measure the line height of the assigned text font style. | Text
| addTo(container:Container, index:Uint):View Add current view to a Contaner. | View
| fire(type:String, detail:Object):Boolean Send events. | View
| getBounds():Array Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage. | View
| getScaledHeight():Number Get the scaled height of the view. | View
| getScaledWidth():Number Get the scaled width of the view. | View
| getStage():Stage Get the stage object of the view. | View
| hitTestObject(object:View, usePolyCollision:Boolean) Determining whether an object is in the circumscribed rectangle of current view. | View
| hitTestPoint(x:Number, y:Number, usePolyCollision:Boolean):Boolean Determining whether a point is in the circumscribed rectangle of current view. | View
| off(type:String, listener:Function):Object Remove one event listener. | View
| on(type:String, listener:Function, once:Boolean):Object Add an event listenser. | View
| removeFromParent():View Remove current view from it's parent container | View
| render(renderer:Renderer, delta:Number) The render method of current view. | View
| toString():String Get a string representing current view. | View

### Property Detail

color:String
Color of the text.
font:String
Text's CSS font style, readonly! Use setFont function to set text font.
lineSpacing:Number
The spacing between lines. Measured in px, default value is 0.
maxWidth:Number
The max length of the text, default value is 200.
outline:Boolean
Draw the outline of the text or fill the text.
text:String
Text to display.
textAlign:String
Horizontal alignment way of the text. May be one of the following value:'start', 'end', 'left', 'right', and 'center'. Note:Need to specify the width property of the text to take effect
textHeight:Number
Height of the text, readonly! Works only on canvas mode.
textVAlign:String
Vertical alignment way of the text. May be one of the following value:'top', 'middle', 'bottom'. Note:Need to specify the height property of the text to take effect.
textWidth:Number
Width of the text, readonly! Works only on canvas mode.

### Constructor

Text(properties:Object)

parameters
properties:Object — Properties parameters for the object. Includes all writable properties.

### Method Detail

cache(forceUpdate:Boolean)
Cache the view.

parameters
forceUpdate:Boolean — is force update cache.

[Static] measureFontHeight(font:String):Number
Measure the line height of the assigned text font style.

parameters
font:String — Font style to measure.

return
  Number — Return line height of the assigned font style.

setCacheDirty(dirty:Boolean)
set the cache state diry.

parameters
dirty:Boolean — is cache dirty

setFont(font:String):Text
Set text CSS font style.

parameters
font:String — Text CSS font style to set.

return
  Text — the Text object, chained call supported.

updateCache()
Update the cache.