1 #ifndef DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H
2 #define DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
23 #include <dali/public-api/dali-adaptor-common.h>
27 namespace TextAbstraction
30 * @brief Script is the writing system used by a language.
31 * Typically one script can be used to write different languages although one language could be written in different scrips.
35 COMMON, ///< Valid for all scripts. i.e white space or '\n'.
37 ASCII_DIGITS, ///< ASCII digits.
38 ASCII_PS, ///< ASCII punctuation and symbols.
40 C1_CONTROLS, ///< Controls of the C1 Controls and Latin-1 Supplement unicode block.
41 C1_PS, ///< Punctuation and symbols of the C1 Controls and Latin-1 Supplement unicode block.
42 C1_MATH, ///< Math symbols of the C1 Controls and Latin-1 Supplement unicode block.
44 SML_P, ///< Punctuation symbols of the Spacing Modifier Letters unicode block.
45 PHONETIC_U, ///< Uralic phonetic symbols of the Phonetic Extensions unicode block.
46 PHONETIC_SS, ///< Subscripts and superscripts of the Phonetic Extensions unicode block.
48 NUMERIC_SS, ///< Numeric subscripts and superscripts.
50 LETTER_LIKE, ///< Symbols of the Letterlike unicode block.
51 NUMBER_FORMS, ///< Number Forms unicode block.
52 FRACTIONS_NF, ///< Numeric fraction symbols of the Number Forms unicode block.
53 NON_LATIN_LED, ///< Non latin symbols within the Latin Extended D unicode block.
54 HWFW_S, ///< Non latin symbols within the Halfwidth and fullwidth unicode block.
56 CYRILLIC, ///< The Cyrillic script. Used by Russian, Bulgarian, Ukrainian, Macedonian, ...
57 GREEK, ///< The Greek script. Used by Greek.
58 LATIN, ///< The latin script. Used by many western languages and others around the world.
60 ARABIC, ///< The arabic script. Used by Arab and Urdu among others.
61 HEBREW, ///< The Hebrew script. Used by the Hebrew, Yiddish, Ladino, and Judeo-Arabic.
63 ARMENIAN, ///< The Armenian script. Used by Armenian.
64 GEORGIAN, ///< The Georgian script. Used by Georgian.
66 CJK, ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system).
67 HANGUL, ///< The Hangul jamo script. Used by Korean.
68 HIRAGANA, ///< The Hiragana script. Used by the Japanese.
69 KATAKANA, ///< The Katakana script. Used by the Japanese.
70 BOPOMOFO, ///< The Bopomofo script. Also called Zhuyin fuhao or Zhuyin. A phonetic notation used for the transcription of spoken Chinese.
72 BENGALI, ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali.
73 BURMESE, ///< The Burmese script. Used by the Burmese (Myanmar) language.
74 DEVANAGARI, ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit.
75 GUJARATI, ///< The Gujarati script. Used by Gujarati.
76 GURMUKHI, ///< The Gurmukhi script. Used by Punjabi.
77 KANNADA, ///< The Kannada script. Used by Kannada and Tulu.
78 MALAYALAM, ///< The Malayalam script. Used by Malayalam.
79 ORIYA, ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali.
80 SINHALA, ///< The Sinhala script. Used by Sinhala and Pali.
81 TAMIL, ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra.
82 TELUGU, ///< The Telugu script. Used by Telugu, Gondi, and Lambadi.
84 LAO, ///< The Lao script. Used by the Lao language.
85 THAI, ///< The Thai script. Used by the Thai language
86 KHMER, ///< The Khmer script. Used by the Khmer language.
87 JAVANESE, ///< The Javanese script. Used by the Javanese language.
88 SUNDANESE, ///< The Sundanese script. Used by the Sundanese language.
90 GEEZ, ///< The Ge'ez script. Used by the Amharic, Tigrinya and other languages in Ethiopia and Eritrea.
91 OL_CHIKI, ///< The Ol Chiki script. Used by the Santali.
92 BAYBAYIN, ///< The Baybayin script. Used by the Tagalog, Bikol languages, Ilocano, Pangasinan, Visayan and other languages in Philippines.
93 MEITEI, ///< The Meitei script used for the Meitei language in Manipur, India.
95 EMOJI, ///< The Emoji which map to standardized Unicode characters.
97 SYMBOLS1, ///< Some symbols.
98 SYMBOLS2, ///< Some symbols.
99 SYMBOLS3, ///< Some symbols.
100 SYMBOLS4, ///< Some symbols.
101 SYMBOLS5, ///< Some symbols.
103 UNKNOWN ///< The script is unknown.
106 const char* const ScriptName[] =
108 "COMMON", ///< Valid for all scripts. i.e white space or '\n'.
110 "ASCII_DIGITS", ///< ASCII digits.
111 "ASCII_PS", ///< ASCII punctuation and symbols.
113 "C1_CONTROLS", ///< Controls of the C1 Controls and Latin-1 Supplement unicode block.
114 "C1_PS", ///< Punctuation and symbols of the C1 Controls and Latin-1 Supplement unicode block.
115 "C1_MATH", ///< Math symbols of the C1 Controls and Latin-1 Supplement unicode block.
117 "SML_P", ///< Punctuation symbols of the Spacing Modifier Letters unicode block.
118 "PHONETIC_U", ///< Uralic phonetic symbols of the Phonetic Extensions unicode block.
119 "PHONETIC_SS", ///< Subscripts and superscripts of the Phonetic Extensions unicode block.
121 "NUMERIC_SS", ///< Numeric subscripts and superscripts.
123 "LETTER_LIKE", ///< Symbols of the Letterlike unicode block.
124 "NUMBER_FORMS", ///< Number Forms unicode block.
125 "FRACTIONS_NF", ///< Numeric fraction symbols of the Number Forms unicode block.
126 "NON_LATIN_LED", ///< Non latin symbols within the Latin Extended D unicode block.
127 "HWFW_S", ///< Non latin symbols within the Halfwidth and fullwidth unicode block.
129 "CYRILLIC", ///< The Cyrillic script. Used by Russian, Bulgarian, Ukrainian, Macedonian, ...
130 "GREEK", ///< The Greek script. Used by Greek.
131 "LATIN", ///< The latin script. Used by many western languages and others around the world.
133 "ARABIC", ///< The arabic script. Used by Arab and Urdu among others.
134 "HEBREW", ///< The Hebrew script. Used by the Hebrew, Yiddish, Ladino, and Judeo-Arabic.
136 "ARMENIAN", ///< The Armenian script. Used by Armenian.
137 "GEORGIAN", ///< The Georgian script. Used by Georgian.
139 "CJK", ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system).
140 "HANGUL", ///< The Hangul jamo script. Used by Korean.
141 "HIRAGANA", ///< The Hiragana script. Used by the Japanese.
142 "KATAKANA", ///< The Katakana script. Used by the Japanese.
143 "BOPOMOFO", ///< The Bopomofo script. Also called Zhuyin fuhao or Zhuyin. A phonetic notation used for the transcription of spoken Chinese.
145 "BENGALI", ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali.
146 "BURMESE", ///< The Burmese script. Used by the Burmese (Myanmar) language.
147 "DEVANAGARI", ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit.
148 "GUJARATI", ///< The Gujarati script. Used by Gujarati.
149 "GURMUKHI", ///< The Gurmukhi script. Used by Punjabi.
150 "KANNADA", ///< The Kannada script. Used by Kannada and Tulu.
151 "MALAYALAM", ///< The Malayalam script. Used by Malayalam.
152 "ORIYA", ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali.
153 "SINHALA", ///< The Sinhala script. Used by Sinhala and Pali.
154 "TAMIL", ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra.
155 "TELUGU", ///< The Telugu script. Used by Telugu, Gondi, and Lambadi.
157 "LAO", ///< The Lao script. Used by the Lao language.
158 "THAI", ///< The Thai script. Used by the Thai language
159 "KHMER", ///< The Khmer script. Used by the Khmer language.
160 "JAVANESE", ///< The Javanese script. Used by the Javanese language.
161 "SUNDANESE", ///< The Sundanese script. Used by the Sundanese language.
163 "GEEZ", ///< The Ge'ez script also known as Ethiopic. Used by the Amharic, Tigrinya and other languages in Ethiopia and Eritrea.
164 "OL_CHIKI", ///< The Ol Chiki script. Used by the Santali.
165 "BAYBAYIN", ///< The Baybayin script. Used by the Tagalog, Bikol languages, Ilocano, Pangasinan, Visayan and other languages in Philippines.
166 "MEITEI", ///< The Meitei script used for the Meitei language in Manipur, India.
168 "EMOJI", ///< The Emoji which map to standardized Unicode characters.
170 "SYMBOLS1", ///< Some symbols.
171 "SYMBOLS2", ///< Some symbols.
172 "SYMBOLS3", ///< Some symbols.
173 "SYMBOLS4", ///< Some symbols.
174 "SYMBOLS5", ///< Some symbols.
176 "UNKNOWN" ///< The script is unknown.
180 * @brief Whether the script is a right to left script.
182 * @param[in] script The script.
184 * @return @e true if the script is right to left.
186 DALI_ADAPTOR_API bool IsRightToLeftScript(Script script);
189 * @brief Retrieves a character's script.
191 * @param[in] character The character.
193 * @return The chraracter's script.
195 DALI_ADAPTOR_API Script GetCharacterScript(Character character);
198 * @brief Whether the character is a white space.
200 * @param[in] character The character.
202 * @return @e true if the character is a white space.
204 DALI_ADAPTOR_API bool IsWhiteSpace(Character character);
207 * @brief Whether the character is a new paragraph character.
209 * @param[in] character The character.
211 * @return @e true if the character is a new paragraph character.
213 DALI_ADAPTOR_API bool IsNewParagraph(Character character);
216 * @brief Whether the character is a zero width non joiner.
218 * @param[in] character The character.
220 * @return @e true if the character is a zero width non joiner.
222 DALI_ADAPTOR_API bool IsZeroWidthNonJoiner(Character character);
225 * @brief Whether the character is a zero width joiner.
227 * @param[in] character The character.
229 * @return @e true if the character is a zero width joiner.
231 DALI_ADAPTOR_API bool IsZeroWidthJoiner(Character character);
234 * @brief Whether the character is a zero width space.
236 * @param[in] character The character.
238 * @return @e true if the character is a zero width space.
240 DALI_ADAPTOR_API bool IsZeroWidthSpace(Character character);
243 * @brief Whether the character is a left to right mark.
245 * @param[in] character The character.
247 * @return @e true if the character is a left to right mark.
249 DALI_ADAPTOR_API bool IsLeftToRightMark(Character character);
252 * @brief Whether the character is a right to left mark.
254 * @param[in] character The character.
256 * @return @e true if the character is a right to left mark.
258 DALI_ADAPTOR_API bool IsRightToLeftMark(Character character);
261 * @brief Whether the character is a thin space.
263 * @param[in] character The character.
265 * @return @e true if the character is a thin space.
267 DALI_ADAPTOR_API bool IsThinSpace(Character character);
270 * @brief Whether the character is common within all scripts.
272 * @param[in] character The character.
274 * @return @e true if the character is common within all scripts.
276 DALI_ADAPTOR_API bool IsCommonScript(Character character);
279 * @brief Whether the script contains ligatures that must be 'broken' for selection or cursor position.
281 * i.e The latin script has the 'ff' or 'fi' ligatures that need to be broken to position the cursor
282 * between the two characters. Equally the arabic script has the 'ﻻ' ligature that needs to be broken.
284 * @param[in] script The script.
286 * @return @e true if the script has ligatures that must be 'broken'.
288 DALI_ADAPTOR_API bool HasLigatureMustBreak(Script script);
289 } // namespace TextAbstraction
293 #endif // DALI_TOOLKIT_TEXT_ABSTRACTION_SCRIPT_H