Make --enable-man and --enable-gtk-doc independent
[glib.git] / glib / gunicode.h
blobf9c2fd567c9be067a1514addd3105a5dd97b58e2
1 /* gunicode.h - Unicode manipulation functions
3 * Copyright (C) 1999, 2000 Tom Tromey
4 * Copyright 2000, 2005 Red Hat, Inc.
6 * The Gnome Library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * The Gnome Library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with the Gnome Library; see the file COPYING.LIB. If not,
18 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
23 #error "Only <glib.h> can be included directly."
24 #endif
26 #ifndef __G_UNICODE_H__
27 #define __G_UNICODE_H__
29 #include <glib/gerror.h>
30 #include <glib/gtypes.h>
32 G_BEGIN_DECLS
34 /**
35 * gunichar:
37 * A type which can hold any UTF-32 or UCS-4 character code,
38 * also known as a Unicode code point.
40 * If you want to produce the UTF-8 representation of a #gunichar,
41 * use g_ucs4_to_utf8(). See also g_utf8_to_ucs4() for the reverse
42 * process.
44 * To print/scan values of this type as integer, use
45 * %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT.
47 * The notation to express a Unicode code point in running text is
48 * as a hexadecimal number with four to six digits and uppercase
49 * letters, prefixed by the string "U+". Leading zeros are omitted,
50 * unless the code point would have fewer than four hexadecimal digits.
51 * For example, "U+0041 LATIN CAPITAL LETTER A". To print a code point
52 * in the U+-notation, use the format string "U+\%04"G_GINT32_FORMAT"X".
53 * To scan, use the format string "U+\%06"G_GINT32_FORMAT"X".
55 * |[
56 * gunichar c;
57 * sscanf ("U+0041", "U+%06"G_GINT32_FORMAT"X", &amp;c)
58 * g_print ("Read U+%04"G_GINT32_FORMAT"X", c);
59 * ]|
61 typedef guint32 gunichar;
63 /**
64 * gunichar2:
66 * A type which can hold any UTF-16 code
67 * point<footnote id="utf16_surrogate_pairs">UTF-16 also has so called
68 * <firstterm>surrogate pairs</firstterm> to encode characters beyond
69 * the BMP as pairs of 16bit numbers. Surrogate pairs cannot be stored
70 * in a single gunichar2 field, but all GLib functions accepting gunichar2
71 * arrays will correctly interpret surrogate pairs.</footnote>.
73 * To print/scan values of this type to/from text you need to convert
74 * to/from UTF-8, using g_utf16_to_utf8()/g_utf8_to_utf16().
76 * To print/scan values of this type as integer, use
77 * %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT.
79 typedef guint16 gunichar2;
81 /**
82 * GUnicodeType:
83 * @G_UNICODE_CONTROL: General category "Other, Control" (Cc)
84 * @G_UNICODE_FORMAT: General category "Other, Format" (Cf)
85 * @G_UNICODE_UNASSIGNED: General category "Other, Not Assigned" (Cn)
86 * @G_UNICODE_PRIVATE_USE: General category "Other, Private Use" (Co)
87 * @G_UNICODE_SURROGATE: General category "Other, Surrogate" (Cs)
88 * @G_UNICODE_LOWERCASE_LETTER: General category "Letter, Lowercase" (Ll)
89 * @G_UNICODE_MODIFIER_LETTER: General category "Letter, Modifier" (Lm)
90 * @G_UNICODE_OTHER_LETTER: General category "Letter, Other" (Lo)
91 * @G_UNICODE_TITLECASE_LETTER: General category "Letter, Titlecase" (Lt)
92 * @G_UNICODE_UPPERCASE_LETTER: General category "Letter, Uppercase" (Lu)
93 * @G_UNICODE_SPACING_MARK: General category "Mark, Spacing" (Mc)
94 * @G_UNICODE_ENCLOSING_MARK: General category "Mark, Enclosing" (Me)
95 * @G_UNICODE_NON_SPACING_MARK: General category "Mark, Nonspacing" (Mn)
96 * @G_UNICODE_DECIMAL_NUMBER: General category "Number, Decimal Digit" (Nd)
97 * @G_UNICODE_LETTER_NUMBER: General category "Number, Letter" (Nl)
98 * @G_UNICODE_OTHER_NUMBER: General category "Number, Other" (No)
99 * @G_UNICODE_CONNECT_PUNCTUATION: General category "Punctuation, Connector" (Pc)
100 * @G_UNICODE_DASH_PUNCTUATION: General category "Punctuation, Dash" (Pd)
101 * @G_UNICODE_CLOSE_PUNCTUATION: General category "Punctuation, Close" (Pe)
102 * @G_UNICODE_FINAL_PUNCTUATION: General category "Punctuation, Final quote" (Pf)
103 * @G_UNICODE_INITIAL_PUNCTUATION: General category "Punctuation, Initial quote" (Pi)
104 * @G_UNICODE_OTHER_PUNCTUATION: General category "Punctuation, Other" (Po)
105 * @G_UNICODE_OPEN_PUNCTUATION: General category "Punctuation, Open" (Ps)
106 * @G_UNICODE_CURRENCY_SYMBOL: General category "Symbol, Currency" (Sc)
107 * @G_UNICODE_MODIFIER_SYMBOL: General category "Symbol, Modifier" (Sk)
108 * @G_UNICODE_MATH_SYMBOL: General category "Symbol, Math" (Sm)
109 * @G_UNICODE_OTHER_SYMBOL: General category "Symbol, Other" (So)
110 * @G_UNICODE_LINE_SEPARATOR: General category "Separator, Line" (Zl)
111 * @G_UNICODE_PARAGRAPH_SEPARATOR: General category "Separator, Paragraph" (Zp)
112 * @G_UNICODE_SPACE_SEPARATOR: General category "Separator, Space" (Zs)
114 * These are the possible character classifications from the
115 * Unicode specification.
116 * See <ulink url="http://www.unicode.org/Public/UNIDATA/UnicodeData.html">http://www.unicode.org/Public/UNIDATA/UnicodeData.html</ulink>.
118 typedef enum
120 G_UNICODE_CONTROL,
121 G_UNICODE_FORMAT,
122 G_UNICODE_UNASSIGNED,
123 G_UNICODE_PRIVATE_USE,
124 G_UNICODE_SURROGATE,
125 G_UNICODE_LOWERCASE_LETTER,
126 G_UNICODE_MODIFIER_LETTER,
127 G_UNICODE_OTHER_LETTER,
128 G_UNICODE_TITLECASE_LETTER,
129 G_UNICODE_UPPERCASE_LETTER,
130 G_UNICODE_SPACING_MARK,
131 G_UNICODE_ENCLOSING_MARK,
132 G_UNICODE_NON_SPACING_MARK,
133 G_UNICODE_DECIMAL_NUMBER,
134 G_UNICODE_LETTER_NUMBER,
135 G_UNICODE_OTHER_NUMBER,
136 G_UNICODE_CONNECT_PUNCTUATION,
137 G_UNICODE_DASH_PUNCTUATION,
138 G_UNICODE_CLOSE_PUNCTUATION,
139 G_UNICODE_FINAL_PUNCTUATION,
140 G_UNICODE_INITIAL_PUNCTUATION,
141 G_UNICODE_OTHER_PUNCTUATION,
142 G_UNICODE_OPEN_PUNCTUATION,
143 G_UNICODE_CURRENCY_SYMBOL,
144 G_UNICODE_MODIFIER_SYMBOL,
145 G_UNICODE_MATH_SYMBOL,
146 G_UNICODE_OTHER_SYMBOL,
147 G_UNICODE_LINE_SEPARATOR,
148 G_UNICODE_PARAGRAPH_SEPARATOR,
149 G_UNICODE_SPACE_SEPARATOR
150 } GUnicodeType;
153 * G_UNICODE_COMBINING_MARK:
155 * Older name for %G_UNICODE_SPACING_MARK.
157 * Deprecated: 2.30: Use %G_UNICODE_SPACING_MARK.
159 #ifndef G_DISABLE_DEPRECATED
160 #define G_UNICODE_COMBINING_MARK G_UNICODE_SPACING_MARK
161 #endif
164 * GUnicodeBreakType:
165 * @G_UNICODE_BREAK_MANDATORY: Mandatory Break (BK)
166 * @G_UNICODE_BREAK_CARRIAGE_RETURN: Carriage Return (CR)
167 * @G_UNICODE_BREAK_LINE_FEED: Line Feed (LF)
168 * @G_UNICODE_BREAK_COMBINING_MARK: Attached Characters and Combining Marks (CM)
169 * @G_UNICODE_BREAK_SURROGATE: Surrogates (SG)
170 * @G_UNICODE_BREAK_ZERO_WIDTH_SPACE: Zero Width Space (ZW)
171 * @G_UNICODE_BREAK_INSEPARABLE: Inseparable (IN)
172 * @G_UNICODE_BREAK_NON_BREAKING_GLUE: Non-breaking ("Glue") (GL)
173 * @G_UNICODE_BREAK_CONTINGENT: Contingent Break Opportunity (CB)
174 * @G_UNICODE_BREAK_SPACE: Space (SP)
175 * @G_UNICODE_BREAK_AFTER: Break Opportunity After (BA)
176 * @G_UNICODE_BREAK_BEFORE: Break Opportunity Before (BB)
177 * @G_UNICODE_BREAK_BEFORE_AND_AFTER: Break Opportunity Before and After (B2)
178 * @G_UNICODE_BREAK_HYPHEN: Hyphen (HY)
179 * @G_UNICODE_BREAK_NON_STARTER: Nonstarter (NS)
180 * @G_UNICODE_BREAK_OPEN_PUNCTUATION: Opening Punctuation (OP)
181 * @G_UNICODE_BREAK_CLOSE_PUNCTUATION: Closing Punctuation (CL)
182 * @G_UNICODE_BREAK_QUOTATION: Ambiguous Quotation (QU)
183 * @G_UNICODE_BREAK_EXCLAMATION: Exclamation/Interrogation (EX)
184 * @G_UNICODE_BREAK_IDEOGRAPHIC: Ideographic (ID)
185 * @G_UNICODE_BREAK_NUMERIC: Numeric (NU)
186 * @G_UNICODE_BREAK_INFIX_SEPARATOR: Infix Separator (Numeric) (IS)
187 * @G_UNICODE_BREAK_SYMBOL: Symbols Allowing Break After (SY)
188 * @G_UNICODE_BREAK_ALPHABETIC: Ordinary Alphabetic and Symbol Characters (AL)
189 * @G_UNICODE_BREAK_PREFIX: Prefix (Numeric) (PR)
190 * @G_UNICODE_BREAK_POSTFIX: Postfix (Numeric) (PO)
191 * @G_UNICODE_BREAK_COMPLEX_CONTEXT: Complex Content Dependent (South East Asian) (SA)
192 * @G_UNICODE_BREAK_AMBIGUOUS: Ambiguous (Alphabetic or Ideographic) (AI)
193 * @G_UNICODE_BREAK_UNKNOWN: Unknown (XX)
194 * @G_UNICODE_BREAK_NEXT_LINE: Next Line (NL)
195 * @G_UNICODE_BREAK_WORD_JOINER: Word Joiner (WJ)
196 * @G_UNICODE_BREAK_HANGUL_L_JAMO: Hangul L Jamo (JL)
197 * @G_UNICODE_BREAK_HANGUL_V_JAMO: Hangul V Jamo (JV)
198 * @G_UNICODE_BREAK_HANGUL_T_JAMO: Hangul T Jamo (JT)
199 * @G_UNICODE_BREAK_HANGUL_LV_SYLLABLE: Hangul LV Syllable (H2)
200 * @G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE: Hangul LVT Syllable (H3)
201 * @G_UNICODE_BREAK_CLOSE_PARANTHESIS: Closing Parenthesis (CP). Since 2.28
202 * @G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER: Conditional Japanese Starter (CJ). Since: 2.32
203 * @G_UNICODE_BREAK_HEBREW_LETTER: Hebrew Letter (HL). Since: 2.32
205 * These are the possible line break classifications.
207 * The five Hangul types were added in Unicode 4.1, so, has been
208 * introduced in GLib 2.10. Note that new types may be added in the future.
209 * Applications should be ready to handle unknown values.
210 * They may be regarded as %G_UNICODE_BREAK_UNKNOWN.
212 * See <ulink url="http://www.unicode.org/unicode/reports/tr14/">http://www.unicode.org/unicode/reports/tr14/</ulink>.
214 typedef enum
216 G_UNICODE_BREAK_MANDATORY,
217 G_UNICODE_BREAK_CARRIAGE_RETURN,
218 G_UNICODE_BREAK_LINE_FEED,
219 G_UNICODE_BREAK_COMBINING_MARK,
220 G_UNICODE_BREAK_SURROGATE,
221 G_UNICODE_BREAK_ZERO_WIDTH_SPACE,
222 G_UNICODE_BREAK_INSEPARABLE,
223 G_UNICODE_BREAK_NON_BREAKING_GLUE,
224 G_UNICODE_BREAK_CONTINGENT,
225 G_UNICODE_BREAK_SPACE,
226 G_UNICODE_BREAK_AFTER,
227 G_UNICODE_BREAK_BEFORE,
228 G_UNICODE_BREAK_BEFORE_AND_AFTER,
229 G_UNICODE_BREAK_HYPHEN,
230 G_UNICODE_BREAK_NON_STARTER,
231 G_UNICODE_BREAK_OPEN_PUNCTUATION,
232 G_UNICODE_BREAK_CLOSE_PUNCTUATION,
233 G_UNICODE_BREAK_QUOTATION,
234 G_UNICODE_BREAK_EXCLAMATION,
235 G_UNICODE_BREAK_IDEOGRAPHIC,
236 G_UNICODE_BREAK_NUMERIC,
237 G_UNICODE_BREAK_INFIX_SEPARATOR,
238 G_UNICODE_BREAK_SYMBOL,
239 G_UNICODE_BREAK_ALPHABETIC,
240 G_UNICODE_BREAK_PREFIX,
241 G_UNICODE_BREAK_POSTFIX,
242 G_UNICODE_BREAK_COMPLEX_CONTEXT,
243 G_UNICODE_BREAK_AMBIGUOUS,
244 G_UNICODE_BREAK_UNKNOWN,
245 G_UNICODE_BREAK_NEXT_LINE,
246 G_UNICODE_BREAK_WORD_JOINER,
247 G_UNICODE_BREAK_HANGUL_L_JAMO,
248 G_UNICODE_BREAK_HANGUL_V_JAMO,
249 G_UNICODE_BREAK_HANGUL_T_JAMO,
250 G_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
251 G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE,
252 G_UNICODE_BREAK_CLOSE_PARANTHESIS,
253 G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER,
254 G_UNICODE_BREAK_HEBREW_LETTER
255 } GUnicodeBreakType;
258 * GUnicodeScript:
259 * @G_UNICODE_SCRIPT_INVALID_CODE:
260 * a value never returned from g_unichar_get_script()
261 * @G_UNICODE_SCRIPT_COMMON: a character used by multiple different scripts
262 * @G_UNICODE_SCRIPT_INHERITED: a mark glyph that takes its script from the
263 * i base glyph to which it is attached
264 * @G_UNICODE_SCRIPT_ARABIC: Arabic
265 * @G_UNICODE_SCRIPT_ARMENIAN: Armenian
266 * @G_UNICODE_SCRIPT_BENGALI: Bengali
267 * @G_UNICODE_SCRIPT_BOPOMOFO: Bopomofo
268 * @G_UNICODE_SCRIPT_CHEROKEE: Cherokee
269 * @G_UNICODE_SCRIPT_COPTIC: Coptic
270 * @G_UNICODE_SCRIPT_CYRILLIC: Cyrillic
271 * @G_UNICODE_SCRIPT_DESERET: Deseret
272 * @G_UNICODE_SCRIPT_DEVANAGARI: Devanagari
273 * @G_UNICODE_SCRIPT_ETHIOPIC: Ethiopic
274 * @G_UNICODE_SCRIPT_GEORGIAN: Georgian
275 * @G_UNICODE_SCRIPT_GOTHIC: Gothic
276 * @G_UNICODE_SCRIPT_GREEK: Greek
277 * @G_UNICODE_SCRIPT_GUJARATI: Gujarati
278 * @G_UNICODE_SCRIPT_GURMUKHI: Gurmukhi
279 * @G_UNICODE_SCRIPT_HAN: Han
280 * @G_UNICODE_SCRIPT_HANGUL: Hangul
281 * @G_UNICODE_SCRIPT_HEBREW: Hebrew
282 * @G_UNICODE_SCRIPT_HIRAGANA: Hiragana
283 * @G_UNICODE_SCRIPT_KANNADA: Kannada
284 * @G_UNICODE_SCRIPT_KATAKANA: Katakana
285 * @G_UNICODE_SCRIPT_KHMER: Khmer
286 * @G_UNICODE_SCRIPT_LAO: Lao
287 * @G_UNICODE_SCRIPT_LATIN: Latin
288 * @G_UNICODE_SCRIPT_MALAYALAM: Malayalam
289 * @G_UNICODE_SCRIPT_MONGOLIAN: Mongolian
290 * @G_UNICODE_SCRIPT_MYANMAR: Myanmar
291 * @G_UNICODE_SCRIPT_OGHAM: Ogham
292 * @G_UNICODE_SCRIPT_OLD_ITALIC: Old Italic
293 * @G_UNICODE_SCRIPT_ORIYA: Oriya
294 * @G_UNICODE_SCRIPT_RUNIC: Runic
295 * @G_UNICODE_SCRIPT_SINHALA: Sinhala
296 * @G_UNICODE_SCRIPT_SYRIAC: Syriac
297 * @G_UNICODE_SCRIPT_TAMIL: Tamil
298 * @G_UNICODE_SCRIPT_TELUGU: Telugu
299 * @G_UNICODE_SCRIPT_THAANA: Thaana
300 * @G_UNICODE_SCRIPT_THAI: Thai
301 * @G_UNICODE_SCRIPT_TIBETAN: Tibetan
302 * @G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL:
303 * Canadian Aboriginal
304 * @G_UNICODE_SCRIPT_YI: Yi
305 * @G_UNICODE_SCRIPT_TAGALOG: Tagalog
306 * @G_UNICODE_SCRIPT_HANUNOO: Hanunoo
307 * @G_UNICODE_SCRIPT_BUHID: Buhid
308 * @G_UNICODE_SCRIPT_TAGBANWA: Tagbanwa
309 * @G_UNICODE_SCRIPT_BRAILLE: Braille
310 * @G_UNICODE_SCRIPT_CYPRIOT: Cypriot
311 * @G_UNICODE_SCRIPT_LIMBU: Limbu
312 * @G_UNICODE_SCRIPT_OSMANYA: Osmanya
313 * @G_UNICODE_SCRIPT_SHAVIAN: Shavian
314 * @G_UNICODE_SCRIPT_LINEAR_B: Linear B
315 * @G_UNICODE_SCRIPT_TAI_LE: Tai Le
316 * @G_UNICODE_SCRIPT_UGARITIC: Ugaritic
317 * @G_UNICODE_SCRIPT_NEW_TAI_LUE:
318 * New Tai Lue
319 * @G_UNICODE_SCRIPT_BUGINESE: Buginese
320 * @G_UNICODE_SCRIPT_GLAGOLITIC: Glagolitic
321 * @G_UNICODE_SCRIPT_TIFINAGH: Tifinagh
322 * @G_UNICODE_SCRIPT_SYLOTI_NAGRI:
323 * Syloti Nagri
324 * @G_UNICODE_SCRIPT_OLD_PERSIAN:
325 * Old Persian
326 * @G_UNICODE_SCRIPT_KHAROSHTHI: Kharoshthi
327 * @G_UNICODE_SCRIPT_UNKNOWN: an unassigned code point
328 * @G_UNICODE_SCRIPT_BALINESE: Balinese
329 * @G_UNICODE_SCRIPT_CUNEIFORM: Cuneiform
330 * @G_UNICODE_SCRIPT_PHOENICIAN: Phoenician
331 * @G_UNICODE_SCRIPT_PHAGS_PA: Phags-pa
332 * @G_UNICODE_SCRIPT_NKO: N'Ko
333 * @G_UNICODE_SCRIPT_KAYAH_LI: Kayah Li. Since 2.16.3
334 * @G_UNICODE_SCRIPT_LEPCHA: Lepcha. Since 2.16.3
335 * @G_UNICODE_SCRIPT_REJANG: Rejang. Since 2.16.3
336 * @G_UNICODE_SCRIPT_SUNDANESE: Sundanese. Since 2.16.3
337 * @G_UNICODE_SCRIPT_SAURASHTRA: Saurashtra. Since 2.16.3
338 * @G_UNICODE_SCRIPT_CHAM: Cham. Since 2.16.3
339 * @G_UNICODE_SCRIPT_OL_CHIKI: Ol Chiki. Since 2.16.3
340 * @G_UNICODE_SCRIPT_VAI: Vai. Since 2.16.3
341 * @G_UNICODE_SCRIPT_CARIAN: Carian. Since 2.16.3
342 * @G_UNICODE_SCRIPT_LYCIAN: Lycian. Since 2.16.3
343 * @G_UNICODE_SCRIPT_LYDIAN: Lydian. Since 2.16.3
344 * @G_UNICODE_SCRIPT_AVESTAN: Avestan. Since 2.26
345 * @G_UNICODE_SCRIPT_BAMUM: Bamum. Since 2.26
346 * @G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS:
347 * Egyptian Hieroglpyhs. Since 2.26
348 * @G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC:
349 * Imperial Aramaic. Since 2.26
350 * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI:
351 * Inscriptional Pahlavi. Since 2.26
352 * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN:
353 * Inscriptional Parthian. Since 2.26
354 * @G_UNICODE_SCRIPT_JAVANESE: Javanese. Since 2.26
355 * @G_UNICODE_SCRIPT_KAITHI: Kaithi. Since 2.26
356 * @G_UNICODE_SCRIPT_LISU: Lisu. Since 2.26
357 * @G_UNICODE_SCRIPT_MEETEI_MAYEK:
358 * Meetei Mayek. Since 2.26
359 * @G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN:
360 * Old South Arabian. Since 2.26
361 * @G_UNICODE_SCRIPT_OLD_TURKIC: Old Turkic. Since 2.28
362 * @G_UNICODE_SCRIPT_SAMARITAN: Samaritan. Since 2.26
363 * @G_UNICODE_SCRIPT_TAI_THAM: Tai Tham. Since 2.26
364 * @G_UNICODE_SCRIPT_TAI_VIET: Tai Viet. Since 2.26
365 * @G_UNICODE_SCRIPT_BATAK: Batak. Since 2.28
366 * @G_UNICODE_SCRIPT_BRAHMI: Brahmi. Since 2.28
367 * @G_UNICODE_SCRIPT_MANDAIC: Mandaic. Since 2.28
368 * @G_UNICODE_SCRIPT_CHAKMA: Chakma. Since: 2.32
369 * @G_UNICODE_SCRIPT_MEROITIC_CURSIVE: Meroitic Cursive. Since: 2.32
370 * @G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS: Meroitic Hieroglyphs. Since: 2.32
371 * @G_UNICODE_SCRIPT_MIAO: Miao. Since: 2.32
372 * @G_UNICODE_SCRIPT_SHARADA: Sharada. Since: 2.32
373 * @G_UNICODE_SCRIPT_SORA_SOMPENG: Sora Sompeng. Since: 2.32
374 * @G_UNICODE_SCRIPT_TAKRI: Takri. Since: 2.32
376 * The #GUnicodeScript enumeration identifies different writing
377 * systems. The values correspond to the names as defined in the
378 * Unicode standard. The enumeration has been added in GLib 2.14,
379 * and is interchangeable with #PangoScript.
381 * Note that new types may be added in the future. Applications
382 * should be ready to handle unknown values.
383 * See <ulink
384 * url="http://www.unicode.org/reports/tr24/">Unicode Standard Annex
385 * #24: Script names</ulink>.
387 typedef enum
388 { /* ISO 15924 code */
389 G_UNICODE_SCRIPT_INVALID_CODE = -1,
390 G_UNICODE_SCRIPT_COMMON = 0, /* Zyyy */
391 G_UNICODE_SCRIPT_INHERITED, /* Zinh (Qaai) */
392 G_UNICODE_SCRIPT_ARABIC, /* Arab */
393 G_UNICODE_SCRIPT_ARMENIAN, /* Armn */
394 G_UNICODE_SCRIPT_BENGALI, /* Beng */
395 G_UNICODE_SCRIPT_BOPOMOFO, /* Bopo */
396 G_UNICODE_SCRIPT_CHEROKEE, /* Cher */
397 G_UNICODE_SCRIPT_COPTIC, /* Copt (Qaac) */
398 G_UNICODE_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */
399 G_UNICODE_SCRIPT_DESERET, /* Dsrt */
400 G_UNICODE_SCRIPT_DEVANAGARI, /* Deva */
401 G_UNICODE_SCRIPT_ETHIOPIC, /* Ethi */
402 G_UNICODE_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */
403 G_UNICODE_SCRIPT_GOTHIC, /* Goth */
404 G_UNICODE_SCRIPT_GREEK, /* Grek */
405 G_UNICODE_SCRIPT_GUJARATI, /* Gujr */
406 G_UNICODE_SCRIPT_GURMUKHI, /* Guru */
407 G_UNICODE_SCRIPT_HAN, /* Hani */
408 G_UNICODE_SCRIPT_HANGUL, /* Hang */
409 G_UNICODE_SCRIPT_HEBREW, /* Hebr */
410 G_UNICODE_SCRIPT_HIRAGANA, /* Hira */
411 G_UNICODE_SCRIPT_KANNADA, /* Knda */
412 G_UNICODE_SCRIPT_KATAKANA, /* Kana */
413 G_UNICODE_SCRIPT_KHMER, /* Khmr */
414 G_UNICODE_SCRIPT_LAO, /* Laoo */
415 G_UNICODE_SCRIPT_LATIN, /* Latn (Latf, Latg) */
416 G_UNICODE_SCRIPT_MALAYALAM, /* Mlym */
417 G_UNICODE_SCRIPT_MONGOLIAN, /* Mong */
418 G_UNICODE_SCRIPT_MYANMAR, /* Mymr */
419 G_UNICODE_SCRIPT_OGHAM, /* Ogam */
420 G_UNICODE_SCRIPT_OLD_ITALIC, /* Ital */
421 G_UNICODE_SCRIPT_ORIYA, /* Orya */
422 G_UNICODE_SCRIPT_RUNIC, /* Runr */
423 G_UNICODE_SCRIPT_SINHALA, /* Sinh */
424 G_UNICODE_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */
425 G_UNICODE_SCRIPT_TAMIL, /* Taml */
426 G_UNICODE_SCRIPT_TELUGU, /* Telu */
427 G_UNICODE_SCRIPT_THAANA, /* Thaa */
428 G_UNICODE_SCRIPT_THAI, /* Thai */
429 G_UNICODE_SCRIPT_TIBETAN, /* Tibt */
430 G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */
431 G_UNICODE_SCRIPT_YI, /* Yiii */
432 G_UNICODE_SCRIPT_TAGALOG, /* Tglg */
433 G_UNICODE_SCRIPT_HANUNOO, /* Hano */
434 G_UNICODE_SCRIPT_BUHID, /* Buhd */
435 G_UNICODE_SCRIPT_TAGBANWA, /* Tagb */
437 /* Unicode-4.0 additions */
438 G_UNICODE_SCRIPT_BRAILLE, /* Brai */
439 G_UNICODE_SCRIPT_CYPRIOT, /* Cprt */
440 G_UNICODE_SCRIPT_LIMBU, /* Limb */
441 G_UNICODE_SCRIPT_OSMANYA, /* Osma */
442 G_UNICODE_SCRIPT_SHAVIAN, /* Shaw */
443 G_UNICODE_SCRIPT_LINEAR_B, /* Linb */
444 G_UNICODE_SCRIPT_TAI_LE, /* Tale */
445 G_UNICODE_SCRIPT_UGARITIC, /* Ugar */
447 /* Unicode-4.1 additions */
448 G_UNICODE_SCRIPT_NEW_TAI_LUE, /* Talu */
449 G_UNICODE_SCRIPT_BUGINESE, /* Bugi */
450 G_UNICODE_SCRIPT_GLAGOLITIC, /* Glag */
451 G_UNICODE_SCRIPT_TIFINAGH, /* Tfng */
452 G_UNICODE_SCRIPT_SYLOTI_NAGRI, /* Sylo */
453 G_UNICODE_SCRIPT_OLD_PERSIAN, /* Xpeo */
454 G_UNICODE_SCRIPT_KHAROSHTHI, /* Khar */
456 /* Unicode-5.0 additions */
457 G_UNICODE_SCRIPT_UNKNOWN, /* Zzzz */
458 G_UNICODE_SCRIPT_BALINESE, /* Bali */
459 G_UNICODE_SCRIPT_CUNEIFORM, /* Xsux */
460 G_UNICODE_SCRIPT_PHOENICIAN, /* Phnx */
461 G_UNICODE_SCRIPT_PHAGS_PA, /* Phag */
462 G_UNICODE_SCRIPT_NKO, /* Nkoo */
464 /* Unicode-5.1 additions */
465 G_UNICODE_SCRIPT_KAYAH_LI, /* Kali */
466 G_UNICODE_SCRIPT_LEPCHA, /* Lepc */
467 G_UNICODE_SCRIPT_REJANG, /* Rjng */
468 G_UNICODE_SCRIPT_SUNDANESE, /* Sund */
469 G_UNICODE_SCRIPT_SAURASHTRA, /* Saur */
470 G_UNICODE_SCRIPT_CHAM, /* Cham */
471 G_UNICODE_SCRIPT_OL_CHIKI, /* Olck */
472 G_UNICODE_SCRIPT_VAI, /* Vaii */
473 G_UNICODE_SCRIPT_CARIAN, /* Cari */
474 G_UNICODE_SCRIPT_LYCIAN, /* Lyci */
475 G_UNICODE_SCRIPT_LYDIAN, /* Lydi */
477 /* Unicode-5.2 additions */
478 G_UNICODE_SCRIPT_AVESTAN, /* Avst */
479 G_UNICODE_SCRIPT_BAMUM, /* Bamu */
480 G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS, /* Egyp */
481 G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC, /* Armi */
482 G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI, /* Phli */
483 G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN, /* Prti */
484 G_UNICODE_SCRIPT_JAVANESE, /* Java */
485 G_UNICODE_SCRIPT_KAITHI, /* Kthi */
486 G_UNICODE_SCRIPT_LISU, /* Lisu */
487 G_UNICODE_SCRIPT_MEETEI_MAYEK, /* Mtei */
488 G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN, /* Sarb */
489 G_UNICODE_SCRIPT_OLD_TURKIC, /* Orkh */
490 G_UNICODE_SCRIPT_SAMARITAN, /* Samr */
491 G_UNICODE_SCRIPT_TAI_THAM, /* Lana */
492 G_UNICODE_SCRIPT_TAI_VIET, /* Tavt */
494 /* Unicode-6.0 additions */
495 G_UNICODE_SCRIPT_BATAK, /* Batk */
496 G_UNICODE_SCRIPT_BRAHMI, /* Brah */
497 G_UNICODE_SCRIPT_MANDAIC, /* Mand */
499 /* Unicode-6.1 additions */
500 G_UNICODE_SCRIPT_CHAKMA, /* Cakm */
501 G_UNICODE_SCRIPT_MEROITIC_CURSIVE, /* Merc */
502 G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS, /* Mero */
503 G_UNICODE_SCRIPT_MIAO, /* Plrd */
504 G_UNICODE_SCRIPT_SHARADA, /* Shrd */
505 G_UNICODE_SCRIPT_SORA_SOMPENG, /* Sora */
506 G_UNICODE_SCRIPT_TAKRI /* Takr */
507 } GUnicodeScript;
509 guint32 g_unicode_script_to_iso15924 (GUnicodeScript script);
510 GUnicodeScript g_unicode_script_from_iso15924 (guint32 iso15924);
512 /* These are all analogs of the <ctype.h> functions.
514 gboolean g_unichar_isalnum (gunichar c) G_GNUC_CONST;
515 gboolean g_unichar_isalpha (gunichar c) G_GNUC_CONST;
516 gboolean g_unichar_iscntrl (gunichar c) G_GNUC_CONST;
517 gboolean g_unichar_isdigit (gunichar c) G_GNUC_CONST;
518 gboolean g_unichar_isgraph (gunichar c) G_GNUC_CONST;
519 gboolean g_unichar_islower (gunichar c) G_GNUC_CONST;
520 gboolean g_unichar_isprint (gunichar c) G_GNUC_CONST;
521 gboolean g_unichar_ispunct (gunichar c) G_GNUC_CONST;
522 gboolean g_unichar_isspace (gunichar c) G_GNUC_CONST;
523 gboolean g_unichar_isupper (gunichar c) G_GNUC_CONST;
524 gboolean g_unichar_isxdigit (gunichar c) G_GNUC_CONST;
525 gboolean g_unichar_istitle (gunichar c) G_GNUC_CONST;
526 gboolean g_unichar_isdefined (gunichar c) G_GNUC_CONST;
527 gboolean g_unichar_iswide (gunichar c) G_GNUC_CONST;
528 gboolean g_unichar_iswide_cjk(gunichar c) G_GNUC_CONST;
529 gboolean g_unichar_iszerowidth(gunichar c) G_GNUC_CONST;
530 gboolean g_unichar_ismark (gunichar c) G_GNUC_CONST;
532 /* More <ctype.h> functions. These convert between the three cases.
533 * See the Unicode book to understand title case. */
534 gunichar g_unichar_toupper (gunichar c) G_GNUC_CONST;
535 gunichar g_unichar_tolower (gunichar c) G_GNUC_CONST;
536 gunichar g_unichar_totitle (gunichar c) G_GNUC_CONST;
538 /* If C is a digit (according to `g_unichar_isdigit'), then return its
539 numeric value. Otherwise return -1. */
540 gint g_unichar_digit_value (gunichar c) G_GNUC_CONST;
542 gint g_unichar_xdigit_value (gunichar c) G_GNUC_CONST;
544 /* Return the Unicode character type of a given character. */
545 GUnicodeType g_unichar_type (gunichar c) G_GNUC_CONST;
547 /* Return the line break property for a given character */
548 GUnicodeBreakType g_unichar_break_type (gunichar c) G_GNUC_CONST;
550 /* Returns the combining class for a given character */
551 gint g_unichar_combining_class (gunichar uc) G_GNUC_CONST;
553 gboolean g_unichar_get_mirror_char (gunichar ch,
554 gunichar *mirrored_ch);
556 GUnicodeScript g_unichar_get_script (gunichar ch) G_GNUC_CONST;
558 /* Validate a Unicode character */
559 gboolean g_unichar_validate (gunichar ch) G_GNUC_CONST;
561 /* Pairwise canonical compose/decompose */
562 gboolean g_unichar_compose (gunichar a,
563 gunichar b,
564 gunichar *ch);
565 gboolean g_unichar_decompose (gunichar ch,
566 gunichar *a,
567 gunichar *b);
569 gsize g_unichar_fully_decompose (gunichar ch,
570 gboolean compat,
571 gunichar *result,
572 gsize result_len);
575 * G_UNICHAR_MAX_DECOMPOSITION_LENGTH:
577 * The maximum length (in codepoints) of a compatibility or canonical
578 * decomposition of a single Unicode character.
580 * This is as defined by Unicode 6.1.
582 * Since: 2.32
584 #define G_UNICHAR_MAX_DECOMPOSITION_LENGTH 18 /* codepoints */
586 /* Compute canonical ordering of a string in-place. This rearranges
587 decomposed characters in the string according to their combining
588 classes. See the Unicode manual for more information. */
589 void g_unicode_canonical_ordering (gunichar *string,
590 gsize len);
593 GLIB_DEPRECATED_IN_2_30
594 gunichar *g_unicode_canonical_decomposition (gunichar ch,
595 gsize *result_len) G_GNUC_MALLOC;
597 /* Array of skip-bytes-per-initial character.
599 GLIB_VAR const gchar * const g_utf8_skip;
602 * g_utf8_next_char:
603 * @p: Pointer to the start of a valid UTF-8 character
605 * Skips to the next character in a UTF-8 string. The string must be
606 * valid; this macro is as fast as possible, and has no error-checking.
607 * You would use this macro to iterate over a string character by
608 * character. The macro returns the start of the next UTF-8 character.
609 * Before using this macro, use g_utf8_validate() to validate strings
610 * that may contain invalid UTF-8.
612 #define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(const guchar *)(p)])
614 gunichar g_utf8_get_char (const gchar *p) G_GNUC_PURE;
615 gunichar g_utf8_get_char_validated (const gchar *p,
616 gssize max_len) G_GNUC_PURE;
618 gchar* g_utf8_offset_to_pointer (const gchar *str,
619 glong offset) G_GNUC_PURE;
620 glong g_utf8_pointer_to_offset (const gchar *str,
621 const gchar *pos) G_GNUC_PURE;
622 gchar* g_utf8_prev_char (const gchar *p) G_GNUC_PURE;
623 gchar* g_utf8_find_next_char (const gchar *p,
624 const gchar *end) G_GNUC_PURE;
625 gchar* g_utf8_find_prev_char (const gchar *str,
626 const gchar *p) G_GNUC_PURE;
628 glong g_utf8_strlen (const gchar *p,
629 gssize max) G_GNUC_PURE;
631 GLIB_AVAILABLE_IN_2_30
632 gchar *g_utf8_substring (const gchar *str,
633 glong start_pos,
634 glong end_pos) G_GNUC_MALLOC;
636 gchar *g_utf8_strncpy (gchar *dest,
637 const gchar *src,
638 gsize n);
640 /* Find the UTF-8 character corresponding to ch, in string p. These
641 functions are equivalants to strchr and strrchr */
642 gchar* g_utf8_strchr (const gchar *p,
643 gssize len,
644 gunichar c);
645 gchar* g_utf8_strrchr (const gchar *p,
646 gssize len,
647 gunichar c);
648 gchar* g_utf8_strreverse (const gchar *str,
649 gssize len);
651 gunichar2 *g_utf8_to_utf16 (const gchar *str,
652 glong len,
653 glong *items_read,
654 glong *items_written,
655 GError **error) G_GNUC_MALLOC;
656 gunichar * g_utf8_to_ucs4 (const gchar *str,
657 glong len,
658 glong *items_read,
659 glong *items_written,
660 GError **error) G_GNUC_MALLOC;
661 gunichar * g_utf8_to_ucs4_fast (const gchar *str,
662 glong len,
663 glong *items_written) G_GNUC_MALLOC;
664 gunichar * g_utf16_to_ucs4 (const gunichar2 *str,
665 glong len,
666 glong *items_read,
667 glong *items_written,
668 GError **error) G_GNUC_MALLOC;
669 gchar* g_utf16_to_utf8 (const gunichar2 *str,
670 glong len,
671 glong *items_read,
672 glong *items_written,
673 GError **error) G_GNUC_MALLOC;
674 gunichar2 *g_ucs4_to_utf16 (const gunichar *str,
675 glong len,
676 glong *items_read,
677 glong *items_written,
678 GError **error) G_GNUC_MALLOC;
679 gchar* g_ucs4_to_utf8 (const gunichar *str,
680 glong len,
681 glong *items_read,
682 glong *items_written,
683 GError **error) G_GNUC_MALLOC;
685 gint g_unichar_to_utf8 (gunichar c,
686 gchar *outbuf);
688 gboolean g_utf8_validate (const gchar *str,
689 gssize max_len,
690 const gchar **end);
692 gchar *g_utf8_strup (const gchar *str,
693 gssize len) G_GNUC_MALLOC;
694 gchar *g_utf8_strdown (const gchar *str,
695 gssize len) G_GNUC_MALLOC;
696 gchar *g_utf8_casefold (const gchar *str,
697 gssize len) G_GNUC_MALLOC;
700 * GNormalizeMode:
701 * @G_NORMALIZE_DEFAULT: standardize differences that do not affect the
702 * text content, such as the above-mentioned accent representation
703 * @G_NORMALIZE_NFD: another name for %G_NORMALIZE_DEFAULT
704 * @G_NORMALIZE_DEFAULT_COMPOSE: like %G_NORMALIZE_DEFAULT, but with
705 * composed forms rather than a maximally decomposed form
706 * @G_NORMALIZE_NFC: another name for %G_NORMALIZE_DEFAULT_COMPOSE
707 * @G_NORMALIZE_ALL: beyond %G_NORMALIZE_DEFAULT also standardize the
708 * "compatibility" characters in Unicode, such as SUPERSCRIPT THREE
709 * to the standard forms (in this case DIGIT THREE). Formatting
710 * information may be lost but for most text operations such
711 * characters should be considered the same
712 * @G_NORMALIZE_NFKD: another name for %G_NORMALIZE_ALL
713 * @G_NORMALIZE_ALL_COMPOSE: like %G_NORMALIZE_ALL, but with composed
714 * forms rather than a maximally decomposed form
715 * @G_NORMALIZE_NFKC: another name for %G_NORMALIZE_ALL_COMPOSE
717 * Defines how a Unicode string is transformed in a canonical
718 * form, standardizing such issues as whether a character with
719 * an accent is represented as a base character and combining
720 * accent or as a single precomposed character. Unicode strings
721 * should generally be normalized before comparing them.
723 typedef enum {
724 G_NORMALIZE_DEFAULT,
725 G_NORMALIZE_NFD = G_NORMALIZE_DEFAULT,
726 G_NORMALIZE_DEFAULT_COMPOSE,
727 G_NORMALIZE_NFC = G_NORMALIZE_DEFAULT_COMPOSE,
728 G_NORMALIZE_ALL,
729 G_NORMALIZE_NFKD = G_NORMALIZE_ALL,
730 G_NORMALIZE_ALL_COMPOSE,
731 G_NORMALIZE_NFKC = G_NORMALIZE_ALL_COMPOSE
732 } GNormalizeMode;
734 gchar *g_utf8_normalize (const gchar *str,
735 gssize len,
736 GNormalizeMode mode) G_GNUC_MALLOC;
738 gint g_utf8_collate (const gchar *str1,
739 const gchar *str2) G_GNUC_PURE;
740 gchar *g_utf8_collate_key (const gchar *str,
741 gssize len) G_GNUC_MALLOC;
742 gchar *g_utf8_collate_key_for_filename (const gchar *str,
743 gssize len) G_GNUC_MALLOC;
746 /* private */
748 gchar *_g_utf8_make_valid (const gchar *name);
750 G_END_DECLS
752 #endif /* __G_UNICODE_H__ */