1 /*! \page text-label Text Label
3 \section overview Overview
4 The Dali::Toolkit::TextLabel is a Dali::Toolkit::Control which renders a short text string.\n
5 Text labels are lightweight, non-editable and do not respond to user input.
7 \subsection basictextlabelusage Basic usage
9 To display a TextLabel the TEXT property must be set using a UTF-8 string.
12 TextLabel label = TextLabel::New();
13 label.SetProperty( TextLabel::Property::TEXT, "Hello World" );
14 Stage::GetCurrent().Add( label );
17 The label must also be added to the stage, or to an actor which is on the stage.\n
18 In this example the text-label will be automatically given a natural size i.e. large enough to fit the text.\n
19 The position of the label on-screen is dependent on the parent-origin and anchor-point properties:
21 <table border=0 cellpadding=10>
24 \image html TextLabelTopLeft.png
27 \image html TextLabelCenter.png
32 (ParentOrigin::TOP_LEFT, AnchorPoint::TOP_LEFT)
35 (ParentOrigin::CENTER, AnchorPoint::CENTER)
40 \subsection fontselection Font Selection
42 By default TextLabel will automatically select a suitable font from the platform.\n
43 Typically fonts do not support all scripts, for example Latin fonts often do not provide Arabic glyphs.\n
44 Therefore you should expect TextLabel to select different fonts for each script.
46 Alternatively a font may be requested using eiter or all of FONT_FAMILY, FONT_STYLE, and POINT_SIZE properties:
48 label.SetProperty( TextLabel::Property::FONT_FAMILY, "HelveticaNue" );
49 label.SetProperty( TextLabel::Property::FONT_STYLE, "Regular" );
50 label.SetProperty( TextLabel::Property::POINT_SIZE, 12.0f );
52 However the TextLabel will fall-back to using the default font, if the requested font does not support the required scripts.
54 \subsection fontselection Text Alignment
56 Wrapping can be enabled using the MULTI_LINE property:\n
58 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
61 The text can be either aligned to the start, end, or center of the available area:
63 label.SetProperty( TextLabel::Property::ALIGNMENT, "BEGIN" ); // "CENTER" or "END"
66 <table border=0 cellpadding=10>
69 Here is the "BEGIN" alignment shown for left-to-right (Latin) and right-to-left (Arabic) scripts:
74 \image html LatinBegin.png
77 \image html ArabicBegin.png
82 Here is the "CENTER" alignment shown for left-to-right (Latin) and right-to-left (Arabic) scripts:
87 \image html LatinCenter.png
90 \image html ArabicCenter.png
95 Here is the "END" alignment shown for left-to-right (Latin) and right-to-left (Arabic) scripts:
100 \image html LatinEnd.png
103 \image html ArabicEnd.png