2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/public-api/text/script.h>
30 Script GetCharacterScript( Character character )
33 // 0x0000 - 0x007f C0 Controls and Basic Latin
34 // 0x0080 - 0x00ff C1 Controls and Latin-1 Supplement
35 // 0x0100 - 0x017f Latin Extended-A
36 // 0x0180 - 0x024f Latin Extended-B
37 // 0x0250 - 0x02af IPA Extensions
38 // 0x02b0 - 0x02ff Spacing Modifier Letters
39 // 0x1d00 - 0x1d7f Phonetic Extensions
40 // 0x1d80 - 0x1dbf Phonetic Extensions Supplement
41 // 0x1e00 - 0x1eff Latin Extended Additional
42 // 0x2070 - 0x209f Superscripts and Subscripts
43 // 0x2100 - 0x214f Letterlike symbols
44 // 0x2150 - 0x218f Number Forms
45 // 0x2c60 - 0x2c7f Latin Extended-C
46 // 0xa720 - 0xa7ff Latin Extended-D
47 // 0xab30 - 0xab6f Latin Extended-E
48 // 0xfb00 - 0xfb4f Alphabetic Presentation Forms
49 // 0xff00 - 0xffef Halfwidth and Fullwidth Forms
52 // 0x0900 - 0x097f Devanagari
53 // 0x0980 - 0x09ff Bengali
54 // 0x0a00 - 0x0a7f Gurmukhi
55 // 0x0a80 - 0x0aff Gujarati
56 // 0x0b00 - 0x0b7f Oriya
57 // 0x0b80 - 0x0bff Tamil
58 // 0x0c00 - 0x0c7f Telugu
59 // 0x0c80 - 0x0cff Kannada
60 // 0x0d00 - 0x0d7f Malayalam
63 // 0x0d80 - 0x0dff Sinhala
66 // 0x0600 - 0x06ff Arabic
67 // 0x0750 - 0x077f Arabic Supplement
68 // 0x08A0 - 0x08ff Arabic Extended-A
69 // 0xfb50 - 0xfdff Arabic Presentation Forms-A
70 // 0xfe70 - 0xfeff Arabic Presentation Forms-B
71 // 0x1ee00 - 0x1eeff Arabic Mathematical Alphabetic Symbols
73 // CJK and Vietnamese script.
74 // 0x2E80 - 0x2eff CJK Radicals Supplement
75 // 0x3000 - 0x303f CJK Symbols and Punctuation
76 // 0x3200 - 0x32ff Enclosed CJK Letters and Months
77 // 0x3400 - 0x4dbf CJK Unified Ideographs Extension A
78 // 0x4e00 - 0x62ff CJK Unified Ideographs
79 // 0x6300 - 0x77ff CJK Unified Ideographs
80 // 0x7800 - 0x8cff CJK Unified Ideographs
81 // 0x8d00 - 0x9fff CJK Unified Ideographs
82 // 0x20000 - 0x215ff CJK Unified Ideographs Extension B
83 // 0x21600 - 0x230ff CJK Unified Ideographs Extension B
84 // 0x23100 - 0x245ff CJK Unified Ideographs Extension B
85 // 0x24600 - 0x260ff CJK Unified Ideographs Extension B
86 // 0x26100 - 0x275ff CJK Unified Ideographs Extension B
87 // 0x27600 - 0x290ff CJK Unified Ideographs Extension B
88 // 0x29100 - 0x2a6df CJK Unified Ideographs Extension B
89 // 2a700-2b73f. CJK Unified Ideographs Extension C
90 // 2b740-2b81f. CJK Unified Ideographs Extension D
93 // 0x1100 - 0x11ff Hangul jamo
94 // 0x3130 - 0x318f Hangul Compatibility Jamo
95 // 0xa960 - 0xa97f Hangul Jamo Extended-A
96 // 0xac00 - 0xd7af Hangul Syllables
97 // 0xd7b0 - 0xd7ff Hangul Jamo Extended-B
100 // 0x1780 - 0x17ff Khmer
101 // 0x19e0 - 0x19ff Khmer Symbols
104 // 0x0e80 - 0x0eff Lao
107 // 0x0e00 - 0x0e7f Thai
110 // 0x1000 - 0x104f Myanmar
113 if( character <= 0x0cff )
115 if( character <= 0x09ff )
117 if( character <= 0x077f )
119 if( character <= 0x02ff )
121 return TextAbstraction::LATIN;
123 if( ( 0x0600 <= character ) && ( character <= 0x06ff ) )
125 return TextAbstraction::ARABIC;
127 if( ( 0x0750 <= character ) && ( character <= 0x077f ) )
129 return TextAbstraction::ARABIC;
134 if( ( 0x08A0 <= character ) && ( character <= 0x08ff ) )
136 return TextAbstraction::ARABIC;
138 if( ( 0x0900 <= character ) && ( character <= 0x097f ) )
140 return TextAbstraction::DEVANAGARI;
142 if( ( 0x0980 <= character ) && ( character <= 0x09ff ) )
144 return TextAbstraction::BENGALI;
150 if( character <= 0x0b7f )
152 if( ( 0x0a00 <= character ) && ( character <= 0x0a7f ) )
154 return TextAbstraction::GURMUKHI;
156 if( ( 0x0a80 <= character ) && ( character <= 0x0aff ) )
158 return TextAbstraction::GUJARATI;
160 if( ( 0x0b00 <= character ) && ( character <= 0x0b7f ) )
162 return TextAbstraction::ORIYA;
167 if( ( 0x0b80 <= character ) && ( character <= 0x0bff ) )
169 return TextAbstraction::TAMIL;
171 if( ( 0x0c00 <= character ) && ( character <= 0x0c7f ) )
173 return TextAbstraction::TELUGU;
175 if( ( 0x0c80 <= character ) && ( character <= 0x0cff ) )
177 return TextAbstraction::KANNADA;
184 if( character <= 0x2c7f )
186 if( character <= 0x1eff )
188 if( ( 0x0d00 <= character ) && ( character <= 0x0d7f ) )
190 return TextAbstraction::MALAYALAM;
192 if( ( 0x0d80 <= character ) && ( character <= 0x0dff ) )
194 return TextAbstraction::SINHALA;
196 if( ( 0x0e00 <= character ) && ( character <= 0x0e7f ) )
198 return TextAbstraction::THAI;
200 if( ( 0x0e80 <= character ) && ( character <= 0x0eff ) )
202 return TextAbstraction::LAO;
204 if( ( 0x1000 <= character ) && ( character <= 0x104f ) )
206 return TextAbstraction::BURMESE;
208 if( ( 0x1100 <= character ) && ( character <= 0x11ff ) )
210 return TextAbstraction::HANGUL;
212 if( ( 0x1780 <= character ) && ( character <= 0x17ff ) )
214 return TextAbstraction::KHMER;
216 if( ( 0x19e0 <= character ) && ( character <= 0x19ff ) )
218 return TextAbstraction::KHMER;
220 if( ( 0x1d00 <= character ) && ( character <= 0x1eff ) )
222 return TextAbstraction::LATIN;
227 if( ( 0x2070 <= character ) && ( character <= 0x209f ) )
229 return TextAbstraction::LATIN;
231 if( ( 0x2100 <= character ) && ( character <= 0x218f ) )
233 return TextAbstraction::LATIN;
235 if( ( 0x2c60 <= character ) && ( character <= 0x2c7f ) )
237 return TextAbstraction::LATIN;
243 if( character <= 0xfdff )
245 if( ( 0x2e80 <= character ) && ( character <= 0x2eff ) )
247 return TextAbstraction::CJK;
249 if( ( 0x3000 <= character ) && ( character <= 0x303f ) )
251 return TextAbstraction::CJK;
253 if( ( 0x3130 <= character ) && ( character <= 0x318f ) )
255 return TextAbstraction::HANGUL;
257 if( ( 0x3200 <= character ) && ( character <= 0x32ff ) )
259 return TextAbstraction::CJK;
261 if( ( 0x3400 <= character ) && ( character <= 0x4dbf ) )
263 return TextAbstraction::CJK;
265 if( ( 0x4e00 <= character ) && ( character <= 0x62ff ) )
267 return TextAbstraction::CJK;
269 if( ( 0x6300 <= character ) && ( character <= 0x77ff ) )
271 return TextAbstraction::CJK;
273 if( ( 0x7800 <= character ) && ( character <= 0x8cff ) )
275 return TextAbstraction::CJK;
277 if( ( 0x8d00 <= character ) && ( character <= 0x9fff ) )
279 return TextAbstraction::CJK;
281 if( ( 0xa720 <= character ) && ( character <= 0xa7ff ) )
283 return TextAbstraction::LATIN;
285 if( ( 0xa960 <= character ) && ( character <= 0xa97f ) )
287 return TextAbstraction::HANGUL;
289 if( ( 0xab30 <= character ) && ( character <= 0xab6f ) )
291 return TextAbstraction::LATIN;
293 if( ( 0xac00 <= character ) && ( character <= 0xd7af ) )
295 return TextAbstraction::HANGUL;
297 if( ( 0xd7b0 <= character ) && ( character <= 0xd7ff ) )
299 return TextAbstraction::HANGUL;
301 if( ( 0xfb00 <= character ) && ( character <= 0xfb4f ) )
303 return TextAbstraction::LATIN;
305 if( ( 0xfb50 <= character ) && ( character <= 0xfdff ) )
307 return TextAbstraction::ARABIC;
312 if( ( 0xfe70 <= character ) && ( character <= 0xfeff ) )
314 return TextAbstraction::ARABIC;
316 if( ( 0xff00 <= character ) && ( character <= 0xffef ) )
318 return TextAbstraction::LATIN;
320 if( ( 0x1ee00 <= character ) && ( character <= 0x1eeff ) )
322 return TextAbstraction::ARABIC;
324 if( ( 0x20000 <= character ) && ( character <= 0x215ff ) )
326 return TextAbstraction::CJK;
328 if( ( 0x21600 <= character ) && ( character <= 0x230ff ) )
330 return TextAbstraction::CJK;
332 if( ( 0x23100 <= character ) && ( character <= 0x245ff ) )
334 return TextAbstraction::CJK;
336 if( ( 0x24600 <= character ) && ( character <= 0x260ff ) )
338 return TextAbstraction::CJK;
340 if( ( 0x26100 <= character ) && ( character <= 0x275ff ) )
342 return TextAbstraction::CJK;
344 if( ( 0x27600 <= character ) && ( character <= 0x290ff ) )
346 return TextAbstraction::CJK;
348 if( ( 0x29100 <= character ) && ( character <= 0x2a6df ) )
350 return TextAbstraction::CJK;
352 if( ( 0x2a700 <= character ) && ( character <= 0x2b73f ) )
354 return TextAbstraction::CJK;
356 if( ( 0x2b740 <= character ) && ( character <= 0x2b81f ) )
358 return TextAbstraction::CJK;
364 return TextAbstraction::UNKNOWN;
369 } // namespace Toolkit