Merge "Set proper locale to harfbuzz" into devel/master
[platform/core/uifw/dali-adaptor.git] / text / dali / devel-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 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
26
27 namespace Dali
28 {
29
30 namespace TextAbstraction
31 {
32
33 /**
34  * @brief Script is the writing system used by a language.
35  * Typically one script can be used to write different languages although one language could be written in different scrips.
36  */
37 enum Script
38 {
39   COMMON,        ///< Valid for all scripts. i.e white space or '\n'.
40
41   ASCII_DIGITS,  ///< ASCII digits.
42   ASCII_PS,      ///< ASCII punctuation and symbols.
43
44   C1_CONTROLS,   ///< Controls of the C1 Controls and Latin-1 Supplement unicode block.
45   C1_PS,         ///< Punctuation and symbols of the C1 Controls and Latin-1 Supplement unicode block.
46   C1_MATH,       ///< Math symbols of the C1 Controls and Latin-1 Supplement unicode block.
47
48   SML_P,         ///< Punctuation symbols of the Spacing Modifier Letters unicode block.
49   PHONETIC_U,    ///< Uralic phonetic symbols of the Phonetic Extensions unicode block.
50   PHONETIC_SS,   ///< Subscripts and superscripts of the Phonetic Extensions unicode block.
51
52   NUMERIC_SS,    ///< Numeric subscripts and superscripts.
53
54   LETTER_LIKE,   ///< Symbols of the Letterlike unicode block.
55   NUMBER_FORMS,  ///< Number Forms unicode block.
56   FRACTIONS_NF,  ///< Numeric fraction symbols of the Number Forms unicode block.
57   NON_LATIN_LED, ///< Non latin symbols within the Latin Extended D unicode block.
58   HWFW_S,        ///< Non latin symbols within the Halfwidth and fullwidth unicode block.
59
60   CYRILLIC,      ///< The Cyrillic script. Used by Russian, Bulgarian, Ukrainian, Macedonian, ...
61   GREEK,         ///< The Greek script. Used by Greek.
62   LATIN,         ///< The latin script. Used by many western languages and others around the world.
63
64   ARABIC,        ///< The arabic script. Used by Arab and Urdu among others.
65   HEBREW,        ///< The Hebrew script. Used by the Hebrew, Yiddish, Ladino, and Judeo-Arabic.
66
67   ARMENIAN,      ///< The Armenian script. Used by Armenian.
68   GEORGIAN,      ///< The Georgian script. Used by Georgian.
69
70   CJK,           ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system).
71   HANGUL,        ///< The Hangul jamo script. Used by Korean.
72   HIRAGANA,      ///< The Hiragana script. Used by the Japanese.
73   KATAKANA,      ///< The Katakana script. Used by the Japanese.
74   BOPOMOFO,      ///< The Bopomofo script. Also called Zhuyin fuhao or Zhuyin. A phonetic notation used for the transcription of spoken Chinese.
75
76   BENGALI,       ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali.
77   BURMESE,       ///< The Burmese script. Used by the Burmese (Myanmar) language.
78   DEVANAGARI,    ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit.
79   GUJARATI,      ///< The Gujarati script. Used by Gujarati.
80   GURMUKHI,      ///< The Gurmukhi script. Used by Punjabi.
81   KANNADA,       ///< The Kannada script. Used by Kannada and Tulu.
82   MALAYALAM,     ///< The Malayalam script. Used by Malayalam.
83   ORIYA,         ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali.
84   SINHALA,       ///< The Sinhala script. Used by Sinhala and Pali.
85   TAMIL,         ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra.
86   TELUGU,        ///< The Telugu script. Used by Telugu, Gondi, and Lambadi.
87
88   LAO,           ///< The Lao script. Used by the Lao language.
89   THAI,          ///< The Thai script. Used by the Thai language
90   KHMER,         ///< The Khmer script. Used by the Khmer language.
91   JAVANESE,      ///< The Javanese script. Used by the Javanese language.
92   SUNDANESE,     ///< The Sundanese script. Used by the Sundanese language.
93
94   GEEZ,          ///< The Ge'ez script. Used by the Amharic, Tigrinya and other languages in Ethiopia and Eritrea.
95   OL_CHIKI,      ///< The Ol Chiki script. Used by the Santali.
96   BAYBAYIN,      ///< The Baybayin script. Used by the Tagalog, Bikol languages, Ilocano, Pangasinan, Visayan and other languages in Philippines.
97   MEITEI,        ///< The Meitei script used for the Meitei language in Manipur, India.
98
99   EMOJI,         ///< The Emoji which map to standardized Unicode characters.
100
101   SYMBOLS1,      ///< Some symbols.
102   SYMBOLS2,      ///< Some symbols.
103   SYMBOLS3,      ///< Some symbols.
104   SYMBOLS4,      ///< Some symbols.
105   SYMBOLS5,      ///< Some symbols.
106
107   UNKNOWN        ///< The script is unknown.
108 };
109
110 const char* const ScriptName[] =
111 {
112   "COMMON",        ///< Valid for all scripts. i.e white space or '\n'.
113
114   "ASCII_DIGITS",  ///< ASCII digits.
115   "ASCII_PS",      ///< ASCII punctuation and symbols.
116
117   "C1_CONTROLS",   ///< Controls of the C1 Controls and Latin-1 Supplement unicode block.
118   "C1_PS",         ///< Punctuation and symbols of the C1 Controls and Latin-1 Supplement unicode block.
119   "C1_MATH",       ///< Math symbols of the C1 Controls and Latin-1 Supplement unicode block.
120
121   "SML_P",         ///< Punctuation symbols of the Spacing Modifier Letters unicode block.
122   "PHONETIC_U",    ///< Uralic phonetic symbols of the Phonetic Extensions unicode block.
123   "PHONETIC_SS",   ///< Subscripts and superscripts of the Phonetic Extensions unicode block.
124
125   "NUMERIC_SS",    ///< Numeric subscripts and superscripts.
126
127   "LETTER_LIKE",   ///< Symbols of the Letterlike unicode block.
128   "NUMBER_FORMS",  ///< Number Forms unicode block.
129   "FRACTIONS_NF",  ///< Numeric fraction symbols of the Number Forms unicode block.
130   "NON_LATIN_LED", ///< Non latin symbols within the Latin Extended D unicode block.
131   "HWFW_S",        ///< Non latin symbols within the Halfwidth and fullwidth unicode block.
132
133   "CYRILLIC",      ///< The Cyrillic script. Used by Russian, Bulgarian, Ukrainian, Macedonian, ...
134   "GREEK",         ///< The Greek script. Used by Greek.
135   "LATIN",         ///< The latin script. Used by many western languages and others around the world.
136
137   "ARABIC",        ///< The arabic script. Used by Arab and Urdu among others.
138   "HEBREW",        ///< The Hebrew script. Used by the Hebrew, Yiddish, Ladino, and Judeo-Arabic.
139
140   "ARMENIAN",      ///< The Armenian script. Used by Armenian.
141   "GEORGIAN",      ///< The Georgian script. Used by Georgian.
142
143   "CJK",           ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system).
144   "HANGUL",        ///< The Hangul jamo script. Used by Korean.
145   "HIRAGANA",      ///< The Hiragana script. Used by the Japanese.
146   "KATAKANA",      ///< The Katakana script. Used by the Japanese.
147   "BOPOMOFO",      ///< The Bopomofo script. Also called Zhuyin fuhao or Zhuyin. A phonetic notation used for the transcription of spoken Chinese.
148
149   "BENGALI",       ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali.
150   "BURMESE",       ///< The Burmese script. Used by the Burmese (Myanmar) language.
151   "DEVANAGARI",    ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit.
152   "GUJARATI",      ///< The Gujarati script. Used by Gujarati.
153   "GURMUKHI",      ///< The Gurmukhi script. Used by Punjabi.
154   "KANNADA",       ///< The Kannada script. Used by Kannada and Tulu.
155   "MALAYALAM",     ///< The Malayalam script. Used by Malayalam.
156   "ORIYA",         ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali.
157   "SINHALA",       ///< The Sinhala script. Used by Sinhala and Pali.
158   "TAMIL",         ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra.
159   "TELUGU",        ///< The Telugu script. Used by Telugu, Gondi, and Lambadi.
160
161   "LAO",           ///< The Lao script. Used by the Lao language.
162   "THAI",          ///< The Thai script. Used by the Thai language
163   "KHMER",         ///< The Khmer script. Used by the Khmer language.
164   "JAVANESE",      ///< The Javanese script. Used by the Javanese language.
165   "SUNDANESE",     ///< The Sundanese script. Used by the Sundanese language.
166
167   "GEEZ",          ///< The Ge'ez script also known as Ethiopic. Used by the Amharic, Tigrinya and other languages in Ethiopia and Eritrea.
168   "OL_CHIKI",      ///< The Ol Chiki script. Used by the Santali.
169   "BAYBAYIN",      ///< The Baybayin script. Used by the Tagalog, Bikol languages, Ilocano, Pangasinan, Visayan and other languages in Philippines.
170   "MEITEI",        ///< The Meitei script used for the Meitei language in Manipur, India.
171
172   "EMOJI",         ///< The Emoji which map to standardized Unicode characters.
173
174   "SYMBOLS1",      ///< Some symbols.
175   "SYMBOLS2",      ///< Some symbols.
176   "SYMBOLS3",      ///< Some symbols.
177   "SYMBOLS4",      ///< Some symbols.
178   "SYMBOLS5",      ///< Some symbols.
179
180   "UNKNOWN"        ///< The script is unknown.
181 };
182
183 /**
184  * @brief Whether the script is a right to left script.
185  *
186  * @param[in] script The script.
187  *
188  * @return @e true if the script is right to left.
189  */
190 DALI_IMPORT_API bool IsRightToLeftScript( Script script );
191
192 /**
193  * @brief Retrieves a character's script.
194  *
195  * @param[in] character The character.
196  *
197  * @return The chraracter's script.
198  */
199 DALI_IMPORT_API Script GetCharacterScript( Character character );
200
201 /**
202  * @brief Whether the character is a white space.
203  *
204  * @param[in] character The character.
205  *
206  * @return @e true if the character is a white space.
207  */
208 DALI_IMPORT_API bool IsWhiteSpace( Character character );
209
210 /**
211  * @brief Whether the character is a new paragraph character.
212  *
213  * @param[in] character The character.
214  *
215  * @return @e true if the character is a new paragraph character.
216  */
217 DALI_IMPORT_API bool IsNewParagraph( Character character );
218
219 /**
220  * @brief Whether the character is a zero width non joiner.
221  *
222  * @param[in] character The character.
223  *
224  * @return @e true if the character is a zero width non joiner.
225  */
226 DALI_IMPORT_API bool IsZeroWidthNonJoiner( Character character );
227
228 /**
229  * @brief Whether the character is a zero width joiner.
230  *
231  * @param[in] character The character.
232  *
233  * @return @e true if the character is a zero width joiner.
234  */
235 DALI_IMPORT_API bool IsZeroWidthJoiner( Character character );
236
237 /**
238  * @brief Whether the character is a zero width space.
239  *
240  * @param[in] character The character.
241  *
242  * @return @e true if the character is a zero width space.
243  */
244 DALI_IMPORT_API bool IsZeroWidthSpace( Character character );
245
246 /**
247  * @brief Whether the character is a left to right mark.
248  *
249  * @param[in] character The character.
250  *
251  * @return @e true if the character is a left to right mark.
252  */
253 DALI_IMPORT_API bool IsLeftToRightMark( Character character );
254
255 /**
256  * @brief Whether the character is a right to left mark.
257  *
258  * @param[in] character The character.
259  *
260  * @return @e true if the character is a right to left mark.
261  */
262 DALI_IMPORT_API bool IsRightToLeftMark( Character character );
263
264 /**
265  * @brief Whether the character is a thin space.
266  *
267  * @param[in] character The character.
268  *
269  * @return @e true if the character is a thin space.
270  */
271 DALI_IMPORT_API bool IsThinSpace( Character character );
272
273 /**
274  * @brief Whether the character is common within all scripts.
275  *
276  * @param[in] character The character.
277  *
278  * @return @e true if the character is common within all scripts.
279  */
280 DALI_IMPORT_API bool IsCommonScript( Character character );
281
282 /**
283  * @brief Whether the script contains ligatures that must be 'broken' for selection or cursor position.
284  *
285  * i.e The latin script has the 'ff' or 'fi' ligatures that need to be broken to position the cursor
286  * between the two characters. Equally the arabic script has the 'ﻻ' ligature that needs to be broken.
287  *
288  * @param[in] script The script.
289  *
290  * @return @e true if the script has ligatures that must be 'broken'.
291  */
292 DALI_IMPORT_API bool HasLigatureMustBreak( Script script );
293 } // namespace TextAbstraction
294
295 } // namespace Dali
296
297 #endif // __DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H__