Text script code moved to adaptor from toolkit.
[platform/core/uifw/dali-adaptor.git] / text / dali / public-api / text-abstraction / script.h
1 #ifndef __DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H__
2 #define __DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_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/public-api/text-abstraction/text-abstraction-definitions.h>
23
24 namespace Dali
25 {
26
27 namespace TextAbstraction
28 {
29
30 /**
31  * @brief Script is the writing system used by a language.
32  * Typically one script can be used to write different languages although one language could be written in different scrips.
33  */
34 enum Script
35 {
36   LATIN,      ///< The latin script. Used by many western languages and others around the world.
37   ARABIC,     ///< The arabic script. Used by Arab and Urdu among others.
38   DEVANAGARI, ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit.
39   BENGALI,    ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali.
40   GURMUKHI,   ///< The Gurmukhi script. Used by Punjabi.
41   GUJARATI,   ///< The Gujarati script. Used by Gujarati.
42   ORIYA,      ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali.
43   TAMIL,      ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra.
44   TELUGU,     ///< The Telugu script. Used by Telugu, Gondi, and Lambadi.
45   KANNADA,    ///< The Kannada script. Used by Kannada and Tulu.
46   MALAYALAM,  ///< The Malayalam script. Used by Malayalam.
47   SINHALA,    ///< The Sinhala script. Used by Sinhala and Pali.
48   CJK,        ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system).
49   HANGUL,     ///< The Hangul jamo script. Used by Korean.
50   KHMER,      ///< The Khmer script. Used by the Khmer language.
51   LAO,        ///< The Lao script. Used by the Lao language.
52   THAI,       ///< The Thai script. Used by the Thai language
53   BURMESE,    ///< The Burmese script. Used by the Burmese (Myanmar) language.
54   EMOJI,      ///< The Emoji which map to standardized Unicode characters.
55   UNKNOWN     ///< The script is unknown.
56 };
57
58 const char* const ScriptName[] =
59 {
60   "LATIN",      ///< The latin script. Used by many western languages and others around the world.
61   "ARABIC",     ///< The arabic script. Used by Arab and Urdu among others.
62   "DEVANAGARI", ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit.
63   "BENGALI",    ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali.
64   "GURMUKHI",   ///< The Gurmukhi script. Used by Punjabi.
65   "GUJARATI",   ///< The Gujarati script. Used by Gujarati.
66   "ORIYA",      ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali.
67   "TAMIL",      ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra.
68   "TELUGU",     ///< The Telugu script. Used by Telugu, Gondi, and Lambadi.
69   "KANNADA",    ///< The Kannada script. Used by Kannada and Tulu.
70   "MALAYALAM",  ///< The Malayalam script. Used by Malayalam.
71   "SINHALA",    ///< The Sinhala script. Used by Sinhala and Pali.
72   "CJK",        ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system).
73   "HANGUL",     ///< The Hangul jamo script. Used by Korean.
74   "KHMER",      ///< The Khmer script. Used by the Khmer language.
75   "LAO",        ///< The Lao script. Used by the Lao language.
76   "THAI",       ///< The Thai script. Used by the Thai language
77   "BURMESE",    ///< The Burmese script. Used by the Burmese (Myanmar) language.
78   "EMOJI",      ///< The Emoji which map to standardized Unicode characters.
79   "UNKNOWN"     ///< The script is unknown.
80 };
81
82 /**
83  * @brief Whether the script is a right to left script.
84  *
85  * @param[in] script The script.
86  *
87  * @return @e true if the script is right to left.
88  */
89 bool IsRightToLeftScript( Script script );
90
91 /**
92  * @brief Retrieves a character's script.
93  *
94  * @param[in] character The character.
95  *
96  * @return The chraracter's script.
97  */
98 Script GetCharacterScript( Character character );
99
100 /**
101  * @brief Whether the character is a white space.
102  *
103  * @param[in] character The character.
104  *
105  * @return @e true if the character is a white space.
106  */
107 bool IsWhiteSpace( Character character );
108
109 /**
110  * @brief Whether the character is a new paragraph character.
111  *
112  * @param[in] character The character.
113  *
114  * @return @e true if the character is a new paragraph character.
115  */
116 bool IsNewParagraph( Character character );
117
118 /**
119  * @brief Whether the character is a zero width non joiner.
120  *
121  * @param[in] character The character.
122  *
123  * @return @e true if the character is a zero width non joiner.
124  */
125 bool IsZeroWidthNonJoiner( Character character );
126
127 /**
128  * @brief Whether the character is a zero width joiner.
129  *
130  * @param[in] character The character.
131  *
132  * @return @e true if the character is a zero width joiner.
133  */
134 bool IsZeroWidthJoiner( Character character );
135
136 /**
137  * @brief Whether the character is a zero width space.
138  *
139  * @param[in] character The character.
140  *
141  * @return @e true if the character is a zero width space.
142  */
143 bool IsZeroWidthSpace( Character character );
144
145 /**
146  * @brief Whether the character is a left to right mark.
147  *
148  * @param[in] character The character.
149  *
150  * @return @e true if the character is a left to right mark.
151  */
152 bool IsLeftToRightMark( Character character );
153
154 /**
155  * @brief Whether the character is a right to left mark.
156  *
157  * @param[in] character The character.
158  *
159  * @return @e true if the character is a right to left mark.
160  */
161 bool IsRightToLeftMark( Character character );
162
163 /**
164  * @brief Whether the character is a thin space.
165  *
166  * @param[in] character The character.
167  *
168  * @return @e true if the character is a thin space.
169  */
170 bool IsThinSpace( Character character );
171
172 } // namespace TextAbstraction
173
174 } // namespace Dali
175
176 #endif // __DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H__