Merge remote-tracking branch 'origin/tizen' into new_text
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / text / multi-language-support.h
1 #ifndef __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_H__
2 #define __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/text/text-definitions.h>
23
24 // EXTERNAL INCLUDES
25 #include <dali/public-api/object/base-handle.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Text
34 {
35
36 namespace Internal DALI_INTERNAL
37 {
38
39 class MultilanguageSupport;
40
41 } // Internal
42
43 class LogicalModel;
44
45 /**
46  * @brief Sets the character's scripts to the model and validates the fonts set by the user or assigns default ones.
47  */
48 class MultilanguageSupport : public BaseHandle
49 {
50 public:
51
52   /**
53    * @brief Create an uninitialized MultilanguageSupport handle.
54    */
55   MultilanguageSupport();
56
57   /**
58    * @brief Destructor
59    *
60    * This is non-virtual since derived Handle types must not contain data or virtual methods.
61    */
62   ~MultilanguageSupport();
63
64   /**
65    * @brief This constructor is used by MultilanguageSupport::Get().
66    *
67    * @param[in] implementation A pointer to the internal multi-language support object.
68    */
69   explicit DALI_INTERNAL MultilanguageSupport( Internal::MultilanguageSupport* implementation );
70
71   /**
72    * @brief Retrieve a handle to the MultilanguageSupport instance.
73    *
74    * @return A handle to the MultilanguageSupport.
75    */
76   static MultilanguageSupport Get();
77
78   /**
79    * @brief Sets the scripts of the whole text.
80    *
81    * Any script info previously set is removed.
82    *
83    * Scripts are used to validate and set default fonts and to shape the text in further steps.
84    *
85    * @pre The @p model needs to have a text set.
86    *
87    * @param[in,out] model The text's logical model.
88    */
89   void SetScripts( LogicalModel& model );
90
91   /**
92    * @brief Validates the character's font of the whole text.
93    *
94    * It may update fonts set by application developers.
95    *
96    * This method ensures all characters are going to be rendered using an appropriate font. Provided a valid font
97    * exists in the platform.
98    *
99    * For those characters with no font set, it sets a default one.
100    *
101    * If a font has been set by the application developer, this method checks if the font supports the character.
102    * If it doesn't, this method replaces it by a default one.
103    *
104    * @pre The @p model needs to have a text set.
105    * @pre The @p model needs to have the scripts set.
106    *
107    * @param[in,out] model The text's logical model.
108    */
109   void ValidateFonts( LogicalModel& model );
110 };
111
112 } // namespace Text
113
114 } // namespace Toolkit
115
116 } // namespace Dali
117
118 #endif // __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_H__