Merge "Refactoring Button: remove painter" into tizen
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / docs / content / text-actor.js
1 /**
2 ## Text Actor API
3 TextActor is a basic actor for displaying a text label
4
5 By default the text actor always uses the natural size of the text, when the text property is set,
6 unless SetSize is called to override the size or size is animated to some other size.
7
8 Natural size for TextActor is the same as the size returned by dali.font.MeasureText( string )
9 using the font that the TextActor is using.
10
11 By default {{#crossLink "RenderableActor/setCullFace:method"}}CullFaceMode{{/crossLink}} is set to CullNone to enable the TextActor to be viewed from all angles.
12
13 ### Simple example
14 ```
15 var textActor = new dali.TextActor( "Hello world" );
16   
17 // by default an actor is anchored to the top-left of it's parent actor
18 // change it to the middle
19 textActor.parentOrigin = [0.5,0.5,0.5];
20   
21 // scale it up by 4 times  in x,y
22 textActor.scale = [ 4, 4, 1  ];
23   
24 // add to the stage
25 dali.stage.add( textActor );
26 ```
27
28 ### Example using a font and text options ###
29 ```
30 var fontInfo =
31 {
32   family : "Arial",
33   style :"Bold",
34   pointSize:20
35 }
36   
37 var arialFont = new dali.Font( fontInfo );
38 var textOptions =
39 {
40   font: arialFont,
41   isRightToLeft: true,
42   fontDetection: true       // default is true
43 }
44   
45 var textActor1 = new dali.TextActor( "Hello-world" , textOptions );
46   
47 // this will automatically chose a different font that can display the text
48 var textActor2 = new dali.TextActor( "繁體中文" , textOptions );
49 ```
50
51 | Name                   |    Type    | Writable     | Animatable|
52 |------------------------|------------|--------------|-----------|
53 | text                   |  STRING    | ✔     |✘   |
54 | font                   |  STRING    | ✔     |✘   |
55 | font-style             |  STRING    | ✔     |✘   |
56 | outline-enable         |  BOOLEAN   | ✔     |✘   |
57 | outline-color          |  VECTOR4   | ✔     |✘   |
58 | outline-thickness-width| VECTOR2    | ✔     |✘   |
59 | smooth-edge            | FLOAT      | ✔     |✘   |
60 | glow-enable            | BOOLEAN    | ✔     |✘   |
61 | glow-color             | VECTOR4    | ✔     |✘   |
62 | glow-intensity         | FLOAT      | ✔     |✘   |
63 | shadow-enable          | BOOLEAN    | ✔     |✘   |
64 | shadow-color           | VECTOR4    | ✔     |✘   |
65 | shadow-offset          | VECTOR2    | ✔     |✘   |
66 | italics-angle          | FLOAT      | ✔     |✘   |
67 | underline              | BOOLEAN    | ✔     |✘   |
68 | weight                 | INTEGER    | ✔     |✘   |
69 | font-detection-automati| BOOLEAN    | ✔     |✘   |
70 | gradient-color         | VECTOR4    | ✔     |✘   |
71 | gradient-start-point   | VECTOR2    | ✔     |✘   |
72 | gradient-end-point     | VECTOR2    | ✔     |✘   |
73 | shadow-size            |  FLOAT     | ✔     |✘   |
74 | text-color             |  VECTOR4   | ✔     |✘   |
75
76 @class TextActor
77 @extends RenderableActor
78  */
79