]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/unicode/uscript.h
ICU-8.11.tar.gz
[apple/icu.git] / icuSources / common / unicode / uscript.h
1 /*
2 **********************************************************************
3 * Copyright (C) 1997-2006, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 *
7 * File USCRIPT.H
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 07/06/2001 Ram Creation.
13 ******************************************************************************
14 */
15 #ifndef USCRIPT_H
16 #define USCRIPT_H
17 #include "unicode/utypes.h"
18
19 /**
20 * \file
21 * \brief C API: Unicode Script Information
22 */
23
24 /**
25 * Constants for ISO 15924 script codes.
26 *
27 * Many of these script codes - those from Unicode's ScriptNames.txt -
28 * are character property values for Unicode's Script property.
29 * See UAX #24 Script Names (http://www.unicode.org/reports/tr24/).
30 *
31 * Starting with ICU 3.6, constants for most ISO 15924 script codes
32 * are included (currently excluding private-use codes Qaaa..Qabx).
33 * For scripts for which there are codes in ISO 15924 but which are not
34 * used in the Unicode Character Database (UCD), there are no Unicode characters
35 * associated with those scripts.
36 *
37 * For example, there are no characters that have a UCD script code of
38 * Hans or Hant. All Han ideographs have the Hani script code.
39 * The Hans and Hant script codes are used with CLDR data.
40 *
41 * ISO 15924 script codes are included for use with CLDR and similar.
42 *
43 * @stable ICU 2.2
44 */
45 typedef enum UScriptCode {
46 USCRIPT_INVALID_CODE = -1,
47 USCRIPT_COMMON = 0 , /* Zyyy */
48 USCRIPT_INHERITED = 1, /* Qaai */
49 USCRIPT_ARABIC = 2, /* Arab */
50 USCRIPT_ARMENIAN = 3, /* Armn */
51 USCRIPT_BENGALI = 4, /* Beng */
52 USCRIPT_BOPOMOFO = 5, /* Bopo */
53 USCRIPT_CHEROKEE = 6, /* Cher */
54 USCRIPT_COPTIC = 7, /* Copt */
55 USCRIPT_CYRILLIC = 8, /* Cyrl */
56 USCRIPT_DESERET = 9, /* Dsrt */
57 USCRIPT_DEVANAGARI = 10, /* Deva */
58 USCRIPT_ETHIOPIC = 11, /* Ethi */
59 USCRIPT_GEORGIAN = 12, /* Geor */
60 USCRIPT_GOTHIC = 13, /* Goth */
61 USCRIPT_GREEK = 14, /* Grek */
62 USCRIPT_GUJARATI = 15, /* Gujr */
63 USCRIPT_GURMUKHI = 16, /* Guru */
64 USCRIPT_HAN = 17, /* Hani */
65 USCRIPT_HANGUL = 18, /* Hang */
66 USCRIPT_HEBREW = 19, /* Hebr */
67 USCRIPT_HIRAGANA = 20, /* Hira */
68 USCRIPT_KANNADA = 21, /* Knda */
69 USCRIPT_KATAKANA = 22, /* Kana */
70 USCRIPT_KHMER = 23, /* Khmr */
71 USCRIPT_LAO = 24, /* Laoo */
72 USCRIPT_LATIN = 25, /* Latn */
73 USCRIPT_MALAYALAM = 26, /* Mlym */
74 USCRIPT_MONGOLIAN = 27, /* Mong */
75 USCRIPT_MYANMAR = 28, /* Mymr */
76 USCRIPT_OGHAM = 29, /* Ogam */
77 USCRIPT_OLD_ITALIC = 30, /* Ital */
78 USCRIPT_ORIYA = 31, /* Orya */
79 USCRIPT_RUNIC = 32, /* Runr */
80 USCRIPT_SINHALA = 33, /* Sinh */
81 USCRIPT_SYRIAC = 34, /* Syrc */
82 USCRIPT_TAMIL = 35, /* Taml */
83 USCRIPT_TELUGU = 36, /* Telu */
84 USCRIPT_THAANA = 37, /* Thaa */
85 USCRIPT_THAI = 38, /* Thai */
86 USCRIPT_TIBETAN = 39, /* Tibt */
87 /** Canadian_Aboriginal script. @stable ICU 2.6 */
88 USCRIPT_CANADIAN_ABORIGINAL = 40, /* Cans */
89 /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */
90 USCRIPT_UCAS = USCRIPT_CANADIAN_ABORIGINAL,
91 USCRIPT_YI = 41, /* Yiii */
92 USCRIPT_TAGALOG = 42, /* Tglg */
93 USCRIPT_HANUNOO = 43, /* Hano */
94 USCRIPT_BUHID = 44, /* Buhd */
95 USCRIPT_TAGBANWA = 45, /* Tagb */
96
97 /* New scripts in Unicode 4 @stable ICU 2.6 */
98 USCRIPT_BRAILLE = 46, /* Brai */
99 USCRIPT_CYPRIOT = 47, /* Cprt */
100 USCRIPT_LIMBU = 48, /* Limb */
101 USCRIPT_LINEAR_B = 49, /* Linb */
102 USCRIPT_OSMANYA = 50, /* Osma */
103 USCRIPT_SHAVIAN = 51, /* Shaw */
104 USCRIPT_TAI_LE = 52, /* Tale */
105 USCRIPT_UGARITIC = 53, /* Ugar */
106
107 /** New script code in Unicode 4.0.1 @stable ICU 3.0 */
108 USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */
109
110 #ifndef U_HIDE_DRAFT_API
111 /* New scripts in Unicode 4.1 @draft ICU 3.4 */
112 USCRIPT_BUGINESE = 55, /* Bugi */
113 USCRIPT_GLAGOLITIC = 56, /* Glag */
114 USCRIPT_KHAROSHTHI = 57, /* Khar */
115 USCRIPT_SYLOTI_NAGRI = 58, /* Sylo */
116 USCRIPT_NEW_TAI_LUE = 59, /* Talu */
117 USCRIPT_TIFINAGH = 60, /* Tfng */
118 USCRIPT_OLD_PERSIAN = 61, /* Xpeo */
119
120 /* New script codes from ISO 15924 @draft ICU 3.6 */
121 USCRIPT_BALINESE = 62, /* Bali */
122 USCRIPT_BATAK = 63, /* Batk */
123 USCRIPT_BLISSYMBOLS = 64, /* Blis */
124 USCRIPT_BRAHMI = 65, /* Brah */
125 USCRIPT_CHAM = 66, /* Cham */
126 USCRIPT_CIRTH = 67, /* Cirt */
127 USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC = 68, /* Cyrs */
128 USCRIPT_DEMOTIC_EGYPTIAN = 69, /* Egyd */
129 USCRIPT_HIERATIC_EGYPTIAN = 70, /* Egyh */
130 USCRIPT_EGYPTIAN_HIEROGLYPHS = 71, /* Egyp */
131 USCRIPT_KHUTSURI = 72, /* Geok */
132 USCRIPT_SIMPLIFIED_HAN = 73, /* Hans */
133 USCRIPT_TRADITIONAL_HAN = 74, /* Hant */
134 USCRIPT_PAHAWH_HMONG = 75, /* Hmng */
135 USCRIPT_OLD_HUNGARIAN = 76, /* Hung */
136 USCRIPT_HARAPPAN_INDUS = 77, /* Inds */
137 USCRIPT_JAVANESE = 78, /* Java */
138 USCRIPT_KAYAH_LI = 79, /* Kali */
139 USCRIPT_LATIN_FRAKTUR = 80, /* Latf */
140 USCRIPT_LATIN_GAELIC = 81, /* Latg */
141 USCRIPT_LEPCHA = 82, /* Lepc */
142 USCRIPT_LINEAR_A = 83, /* Lina */
143 USCRIPT_MANDAEAN = 84, /* Mand */
144 USCRIPT_MAYAN_HIEROGLYPHS = 85, /* Maya */
145 USCRIPT_MEROITIC = 86, /* Mero */
146 USCRIPT_NKO = 87, /* Nkoo */
147 USCRIPT_ORKHON = 88, /* Orkh */
148 USCRIPT_OLD_PERMIC = 89, /* Perm */
149 USCRIPT_PHAGS_PA = 90, /* Phag */
150 USCRIPT_PHOENICIAN = 91, /* Phnx */
151 USCRIPT_PHONETIC_POLLARD = 92, /* Plrd */
152 USCRIPT_RONGORONGO = 93, /* Roro */
153 USCRIPT_SARATI = 94, /* Sara */
154 USCRIPT_ESTRANGELO_SYRIAC = 95, /* Syre */
155 USCRIPT_WESTERN_SYRIAC = 96, /* Syrj */
156 USCRIPT_EASTERN_SYRIAC = 97, /* Syrn */
157 USCRIPT_TENGWAR = 98, /* Teng */
158 USCRIPT_VAI = 99, /* Vaii */
159 USCRIPT_VISIBLE_SPEECH = 100, /* Visp */
160 USCRIPT_CUNEIFORM = 101,/* Xsux */
161 USCRIPT_UNWRITTEN_LANGUAGES = 102,/* Zxxx */
162 USCRIPT_UNKNOWN = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */
163 /* Private use codes from Qaaa - Qabx are not supported*/
164 #endif /* U_HIDE_DRAFT_API */
165 USCRIPT_CODE_LIMIT = 104
166 } UScriptCode;
167
168 /**
169 * Gets script codes associated with the given locale or ISO 15924 abbreviation or name.
170 * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym".
171 * Fills in USCRIPT_LATIN given "en" OR "en_US"
172 * If required capacity is greater than capacity of the destination buffer then the error code
173 * is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned
174 *
175 * <p>Note: To search by short or long script alias only, use
176 * u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead. This does
177 * a fast lookup with no access of the locale data.
178 * @param nameOrAbbrOrLocale name of the script, as given in
179 * PropertyValueAliases.txt, or ISO 15924 code or locale
180 * @param fillIn the UScriptCode buffer to fill in the script code
181 * @param capacity the capacity (size) fo UScriptCode buffer passed in.
182 * @param err the error status code.
183 * @return The number of script codes filled in the buffer passed in
184 * @stable ICU 2.4
185 */
186 U_STABLE int32_t U_EXPORT2
187 uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err);
188
189 /**
190 * Gets a script name associated with the given script code.
191 * Returns "Malayam" given USCRIPT_MALAYALAM
192 * @param scriptCode UScriptCode enum
193 * @return script long name as given in
194 * PropertyValueAliases.txt, or NULL if scriptCode is invalid
195 * @stable ICU 2.4
196 */
197 U_STABLE const char* U_EXPORT2
198 uscript_getName(UScriptCode scriptCode);
199
200 /**
201 * Gets a script name associated with the given script code.
202 * Returns "Mlym" given USCRIPT_MALAYALAM
203 * @param scriptCode UScriptCode enum
204 * @return script abbreviated name as given in
205 * PropertyValueAliases.txt, or NULL if scriptCode is invalid
206 * @stable ICU 2.4
207 */
208 U_STABLE const char* U_EXPORT2
209 uscript_getShortName(UScriptCode scriptCode);
210
211 /**
212 * Gets the script code associated with the given codepoint.
213 * Returns USCRIPT_MALAYALAM given 0x0D02
214 * @param codepoint UChar32 codepoint
215 * @param err the error status code.
216 * @return The UScriptCode, or 0 if codepoint is invalid
217 * @stable ICU 2.4
218 */
219 U_STABLE UScriptCode U_EXPORT2
220 uscript_getScript(UChar32 codepoint, UErrorCode *err);
221
222 #endif
223
224