1 /* gunicode.h - Unicode manipulation functions 2 * 3 * Copyright (C) 1999, 2000 Tom Tromey 4 * Copyright 2000, 2005 Red Hat, Inc. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This 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. 15 * 16 * You should have received a copy of the GNU Lesser General Public License 17 * along with this library; if not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __G_UNICODE_H__ 21 #define __G_UNICODE_H__ 22 23 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) 24 #error "Only <glib.h> can be included directly." 25 #endif 26 27 #include <glib/gerror.h> 28 #include <glib/gtypes.h> 29 30 G_BEGIN_DECLS 31 32 /** 33 * gunichar: 34 * 35 * A type which can hold any UTF-32 or UCS-4 character code, 36 * also known as a Unicode code point. 37 * 38 * If you want to produce the UTF-8 representation of a #gunichar, 39 * use g_ucs4_to_utf8(). See also g_utf8_to_ucs4() for the reverse 40 * process. 41 * 42 * To print/scan values of this type as integer, use 43 * %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT. 44 * 45 * The notation to express a Unicode code point in running text is 46 * as a hexadecimal number with four to six digits and uppercase 47 * letters, prefixed by the string "U+". Leading zeros are omitted, 48 * unless the code point would have fewer than four hexadecimal digits. 49 * For example, "U+0041 LATIN CAPITAL LETTER A". To print a code point 50 * in the U+-notation, use the format string "U+\%04"G_GINT32_FORMAT"X". 51 * To scan, use the format string "U+\%06"G_GINT32_FORMAT"X". 52 * 53 * |[ 54 * gunichar c; 55 * sscanf ("U+0041", "U+%06"G_GINT32_FORMAT"X", &c) 56 * g_print ("Read U+%04"G_GINT32_FORMAT"X", c); 57 * ]| 58 */ 59 typedef guint32 gunichar; 60 61 /** 62 * gunichar2: 63 * 64 * A type which can hold any UTF-16 code 65 * point<footnote id="utf16_surrogate_pairs">UTF-16 also has so called 66 * <firstterm>surrogate pairs</firstterm> to encode characters beyond 67 * the BMP as pairs of 16bit numbers. Surrogate pairs cannot be stored 68 * in a single gunichar2 field, but all GLib functions accepting gunichar2 69 * arrays will correctly interpret surrogate pairs.</footnote>. 70 * 71 * To print/scan values of this type to/from text you need to convert 72 * to/from UTF-8, using g_utf16_to_utf8()/g_utf8_to_utf16(). 73 * 74 * To print/scan values of this type as integer, use 75 * %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT. 76 */ 77 typedef guint16 gunichar2; 78 79 /** 80 * GUnicodeType: 81 * @G_UNICODE_CONTROL: General category "Other, Control" (Cc) 82 * @G_UNICODE_FORMAT: General category "Other, Format" (Cf) 83 * @G_UNICODE_UNASSIGNED: General category "Other, Not Assigned" (Cn) 84 * @G_UNICODE_PRIVATE_USE: General category "Other, Private Use" (Co) 85 * @G_UNICODE_SURROGATE: General category "Other, Surrogate" (Cs) 86 * @G_UNICODE_LOWERCASE_LETTER: General category "Letter, Lowercase" (Ll) 87 * @G_UNICODE_MODIFIER_LETTER: General category "Letter, Modifier" (Lm) 88 * @G_UNICODE_OTHER_LETTER: General category "Letter, Other" (Lo) 89 * @G_UNICODE_TITLECASE_LETTER: General category "Letter, Titlecase" (Lt) 90 * @G_UNICODE_UPPERCASE_LETTER: General category "Letter, Uppercase" (Lu) 91 * @G_UNICODE_SPACING_MARK: General category "Mark, Spacing" (Mc) 92 * @G_UNICODE_ENCLOSING_MARK: General category "Mark, Enclosing" (Me) 93 * @G_UNICODE_NON_SPACING_MARK: General category "Mark, Nonspacing" (Mn) 94 * @G_UNICODE_DECIMAL_NUMBER: General category "Number, Decimal Digit" (Nd) 95 * @G_UNICODE_LETTER_NUMBER: General category "Number, Letter" (Nl) 96 * @G_UNICODE_OTHER_NUMBER: General category "Number, Other" (No) 97 * @G_UNICODE_CONNECT_PUNCTUATION: General category "Punctuation, Connector" (Pc) 98 * @G_UNICODE_DASH_PUNCTUATION: General category "Punctuation, Dash" (Pd) 99 * @G_UNICODE_CLOSE_PUNCTUATION: General category "Punctuation, Close" (Pe) 100 * @G_UNICODE_FINAL_PUNCTUATION: General category "Punctuation, Final quote" (Pf) 101 * @G_UNICODE_INITIAL_PUNCTUATION: General category "Punctuation, Initial quote" (Pi) 102 * @G_UNICODE_OTHER_PUNCTUATION: General category "Punctuation, Other" (Po) 103 * @G_UNICODE_OPEN_PUNCTUATION: General category "Punctuation, Open" (Ps) 104 * @G_UNICODE_CURRENCY_SYMBOL: General category "Symbol, Currency" (Sc) 105 * @G_UNICODE_MODIFIER_SYMBOL: General category "Symbol, Modifier" (Sk) 106 * @G_UNICODE_MATH_SYMBOL: General category "Symbol, Math" (Sm) 107 * @G_UNICODE_OTHER_SYMBOL: General category "Symbol, Other" (So) 108 * @G_UNICODE_LINE_SEPARATOR: General category "Separator, Line" (Zl) 109 * @G_UNICODE_PARAGRAPH_SEPARATOR: General category "Separator, Paragraph" (Zp) 110 * @G_UNICODE_SPACE_SEPARATOR: General category "Separator, Space" (Zs) 111 * 112 * These are the possible character classifications from the 113 * Unicode specification. 114 * See [Unicode Character Database](http://www.unicode.org/reports/tr44/#General_Category_Values). 115 */ 116 typedef enum 117 { 118 G_UNICODE_CONTROL, 119 G_UNICODE_FORMAT, 120 G_UNICODE_UNASSIGNED, 121 G_UNICODE_PRIVATE_USE, 122 G_UNICODE_SURROGATE, 123 G_UNICODE_LOWERCASE_LETTER, 124 G_UNICODE_MODIFIER_LETTER, 125 G_UNICODE_OTHER_LETTER, 126 G_UNICODE_TITLECASE_LETTER, 127 G_UNICODE_UPPERCASE_LETTER, 128 G_UNICODE_SPACING_MARK, 129 G_UNICODE_ENCLOSING_MARK, 130 G_UNICODE_NON_SPACING_MARK, 131 G_UNICODE_DECIMAL_NUMBER, 132 G_UNICODE_LETTER_NUMBER, 133 G_UNICODE_OTHER_NUMBER, 134 G_UNICODE_CONNECT_PUNCTUATION, 135 G_UNICODE_DASH_PUNCTUATION, 136 G_UNICODE_CLOSE_PUNCTUATION, 137 G_UNICODE_FINAL_PUNCTUATION, 138 G_UNICODE_INITIAL_PUNCTUATION, 139 G_UNICODE_OTHER_PUNCTUATION, 140 G_UNICODE_OPEN_PUNCTUATION, 141 G_UNICODE_CURRENCY_SYMBOL, 142 G_UNICODE_MODIFIER_SYMBOL, 143 G_UNICODE_MATH_SYMBOL, 144 G_UNICODE_OTHER_SYMBOL, 145 G_UNICODE_LINE_SEPARATOR, 146 G_UNICODE_PARAGRAPH_SEPARATOR, 147 G_UNICODE_SPACE_SEPARATOR 148 } GUnicodeType; 149 150 /** 151 * G_UNICODE_COMBINING_MARK: 152 * 153 * Older name for %G_UNICODE_SPACING_MARK. 154 * 155 * Deprecated: 2.30: Use %G_UNICODE_SPACING_MARK. 156 */ 157 #define G_UNICODE_COMBINING_MARK G_UNICODE_SPACING_MARK GLIB_DEPRECATED_MACRO_IN_2_30_FOR(G_UNICODE_SPACING_MARK) 158 159 /** 160 * GUnicodeBreakType: 161 * @G_UNICODE_BREAK_MANDATORY: Mandatory Break (BK) 162 * @G_UNICODE_BREAK_CARRIAGE_RETURN: Carriage Return (CR) 163 * @G_UNICODE_BREAK_LINE_FEED: Line Feed (LF) 164 * @G_UNICODE_BREAK_COMBINING_MARK: Attached Characters and Combining Marks (CM) 165 * @G_UNICODE_BREAK_SURROGATE: Surrogates (SG) 166 * @G_UNICODE_BREAK_ZERO_WIDTH_SPACE: Zero Width Space (ZW) 167 * @G_UNICODE_BREAK_INSEPARABLE: Inseparable (IN) 168 * @G_UNICODE_BREAK_NON_BREAKING_GLUE: Non-breaking ("Glue") (GL) 169 * @G_UNICODE_BREAK_CONTINGENT: Contingent Break Opportunity (CB) 170 * @G_UNICODE_BREAK_SPACE: Space (SP) 171 * @G_UNICODE_BREAK_AFTER: Break Opportunity After (BA) 172 * @G_UNICODE_BREAK_BEFORE: Break Opportunity Before (BB) 173 * @G_UNICODE_BREAK_BEFORE_AND_AFTER: Break Opportunity Before and After (B2) 174 * @G_UNICODE_BREAK_HYPHEN: Hyphen (HY) 175 * @G_UNICODE_BREAK_NON_STARTER: Nonstarter (NS) 176 * @G_UNICODE_BREAK_OPEN_PUNCTUATION: Opening Punctuation (OP) 177 * @G_UNICODE_BREAK_CLOSE_PUNCTUATION: Closing Punctuation (CL) 178 * @G_UNICODE_BREAK_QUOTATION: Ambiguous Quotation (QU) 179 * @G_UNICODE_BREAK_EXCLAMATION: Exclamation/Interrogation (EX) 180 * @G_UNICODE_BREAK_IDEOGRAPHIC: Ideographic (ID) 181 * @G_UNICODE_BREAK_NUMERIC: Numeric (NU) 182 * @G_UNICODE_BREAK_INFIX_SEPARATOR: Infix Separator (Numeric) (IS) 183 * @G_UNICODE_BREAK_SYMBOL: Symbols Allowing Break After (SY) 184 * @G_UNICODE_BREAK_ALPHABETIC: Ordinary Alphabetic and Symbol Characters (AL) 185 * @G_UNICODE_BREAK_PREFIX: Prefix (Numeric) (PR) 186 * @G_UNICODE_BREAK_POSTFIX: Postfix (Numeric) (PO) 187 * @G_UNICODE_BREAK_COMPLEX_CONTEXT: Complex Content Dependent (South East Asian) (SA) 188 * @G_UNICODE_BREAK_AMBIGUOUS: Ambiguous (Alphabetic or Ideographic) (AI) 189 * @G_UNICODE_BREAK_UNKNOWN: Unknown (XX) 190 * @G_UNICODE_BREAK_NEXT_LINE: Next Line (NL) 191 * @G_UNICODE_BREAK_WORD_JOINER: Word Joiner (WJ) 192 * @G_UNICODE_BREAK_HANGUL_L_JAMO: Hangul L Jamo (JL) 193 * @G_UNICODE_BREAK_HANGUL_V_JAMO: Hangul V Jamo (JV) 194 * @G_UNICODE_BREAK_HANGUL_T_JAMO: Hangul T Jamo (JT) 195 * @G_UNICODE_BREAK_HANGUL_LV_SYLLABLE: Hangul LV Syllable (H2) 196 * @G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE: Hangul LVT Syllable (H3) 197 * @G_UNICODE_BREAK_CLOSE_PARANTHESIS: Closing Parenthesis (CP). Since 2.28 198 * @G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER: Conditional Japanese Starter (CJ). Since: 2.32 199 * @G_UNICODE_BREAK_HEBREW_LETTER: Hebrew Letter (HL). Since: 2.32 200 * @G_UNICODE_BREAK_REGIONAL_INDICATOR: Regional Indicator (RI). Since: 2.36 201 * @G_UNICODE_BREAK_EMOJI_BASE: Emoji Base (EB). Since: 2.50 202 * @G_UNICODE_BREAK_EMOJI_MODIFIER: Emoji Modifier (EM). Since: 2.50 203 * @G_UNICODE_BREAK_ZERO_WIDTH_JOINER: Zero Width Joiner (ZWJ). Since: 2.50 204 * 205 * These are the possible line break classifications. 206 * 207 * Since new unicode versions may add new types here, applications should be ready 208 * to handle unknown values. They may be regarded as %G_UNICODE_BREAK_UNKNOWN. 209 * 210 * See [Unicode Line Breaking Algorithm](http://www.unicode.org/unicode/reports/tr14/). 211 */ 212 typedef enum 213 { 214 G_UNICODE_BREAK_MANDATORY, 215 G_UNICODE_BREAK_CARRIAGE_RETURN, 216 G_UNICODE_BREAK_LINE_FEED, 217 G_UNICODE_BREAK_COMBINING_MARK, 218 G_UNICODE_BREAK_SURROGATE, 219 G_UNICODE_BREAK_ZERO_WIDTH_SPACE, 220 G_UNICODE_BREAK_INSEPARABLE, 221 G_UNICODE_BREAK_NON_BREAKING_GLUE, 222 G_UNICODE_BREAK_CONTINGENT, 223 G_UNICODE_BREAK_SPACE, 224 G_UNICODE_BREAK_AFTER, 225 G_UNICODE_BREAK_BEFORE, 226 G_UNICODE_BREAK_BEFORE_AND_AFTER, 227 G_UNICODE_BREAK_HYPHEN, 228 G_UNICODE_BREAK_NON_STARTER, 229 G_UNICODE_BREAK_OPEN_PUNCTUATION, 230 G_UNICODE_BREAK_CLOSE_PUNCTUATION, 231 G_UNICODE_BREAK_QUOTATION, 232 G_UNICODE_BREAK_EXCLAMATION, 233 G_UNICODE_BREAK_IDEOGRAPHIC, 234 G_UNICODE_BREAK_NUMERIC, 235 G_UNICODE_BREAK_INFIX_SEPARATOR, 236 G_UNICODE_BREAK_SYMBOL, 237 G_UNICODE_BREAK_ALPHABETIC, 238 G_UNICODE_BREAK_PREFIX, 239 G_UNICODE_BREAK_POSTFIX, 240 G_UNICODE_BREAK_COMPLEX_CONTEXT, 241 G_UNICODE_BREAK_AMBIGUOUS, 242 G_UNICODE_BREAK_UNKNOWN, 243 G_UNICODE_BREAK_NEXT_LINE, 244 G_UNICODE_BREAK_WORD_JOINER, 245 G_UNICODE_BREAK_HANGUL_L_JAMO, 246 G_UNICODE_BREAK_HANGUL_V_JAMO, 247 G_UNICODE_BREAK_HANGUL_T_JAMO, 248 G_UNICODE_BREAK_HANGUL_LV_SYLLABLE, 249 G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE, 250 G_UNICODE_BREAK_CLOSE_PARANTHESIS, 251 G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER, 252 G_UNICODE_BREAK_HEBREW_LETTER, 253 G_UNICODE_BREAK_REGIONAL_INDICATOR, 254 G_UNICODE_BREAK_EMOJI_BASE, 255 G_UNICODE_BREAK_EMOJI_MODIFIER, 256 G_UNICODE_BREAK_ZERO_WIDTH_JOINER 257 } GUnicodeBreakType; 258 259 /** 260 * GUnicodeScript: 261 * @G_UNICODE_SCRIPT_INVALID_CODE: 262 * a value never returned from g_unichar_get_script() 263 * @G_UNICODE_SCRIPT_COMMON: a character used by multiple different scripts 264 * @G_UNICODE_SCRIPT_INHERITED: a mark glyph that takes its script from the 265 * base glyph to which it is attached 266 * @G_UNICODE_SCRIPT_ARABIC: Arabic 267 * @G_UNICODE_SCRIPT_ARMENIAN: Armenian 268 * @G_UNICODE_SCRIPT_BENGALI: Bengali 269 * @G_UNICODE_SCRIPT_BOPOMOFO: Bopomofo 270 * @G_UNICODE_SCRIPT_CHEROKEE: Cherokee 271 * @G_UNICODE_SCRIPT_COPTIC: Coptic 272 * @G_UNICODE_SCRIPT_CYRILLIC: Cyrillic 273 * @G_UNICODE_SCRIPT_DESERET: Deseret 274 * @G_UNICODE_SCRIPT_DEVANAGARI: Devanagari 275 * @G_UNICODE_SCRIPT_ETHIOPIC: Ethiopic 276 * @G_UNICODE_SCRIPT_GEORGIAN: Georgian 277 * @G_UNICODE_SCRIPT_GOTHIC: Gothic 278 * @G_UNICODE_SCRIPT_GREEK: Greek 279 * @G_UNICODE_SCRIPT_GUJARATI: Gujarati 280 * @G_UNICODE_SCRIPT_GURMUKHI: Gurmukhi 281 * @G_UNICODE_SCRIPT_HAN: Han 282 * @G_UNICODE_SCRIPT_HANGUL: Hangul 283 * @G_UNICODE_SCRIPT_HEBREW: Hebrew 284 * @G_UNICODE_SCRIPT_HIRAGANA: Hiragana 285 * @G_UNICODE_SCRIPT_KANNADA: Kannada 286 * @G_UNICODE_SCRIPT_KATAKANA: Katakana 287 * @G_UNICODE_SCRIPT_KHMER: Khmer 288 * @G_UNICODE_SCRIPT_LAO: Lao 289 * @G_UNICODE_SCRIPT_LATIN: Latin 290 * @G_UNICODE_SCRIPT_MALAYALAM: Malayalam 291 * @G_UNICODE_SCRIPT_MONGOLIAN: Mongolian 292 * @G_UNICODE_SCRIPT_MYANMAR: Myanmar 293 * @G_UNICODE_SCRIPT_OGHAM: Ogham 294 * @G_UNICODE_SCRIPT_OLD_ITALIC: Old Italic 295 * @G_UNICODE_SCRIPT_ORIYA: Oriya 296 * @G_UNICODE_SCRIPT_RUNIC: Runic 297 * @G_UNICODE_SCRIPT_SINHALA: Sinhala 298 * @G_UNICODE_SCRIPT_SYRIAC: Syriac 299 * @G_UNICODE_SCRIPT_TAMIL: Tamil 300 * @G_UNICODE_SCRIPT_TELUGU: Telugu 301 * @G_UNICODE_SCRIPT_THAANA: Thaana 302 * @G_UNICODE_SCRIPT_THAI: Thai 303 * @G_UNICODE_SCRIPT_TIBETAN: Tibetan 304 * @G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL: 305 * Canadian Aboriginal 306 * @G_UNICODE_SCRIPT_YI: Yi 307 * @G_UNICODE_SCRIPT_TAGALOG: Tagalog 308 * @G_UNICODE_SCRIPT_HANUNOO: Hanunoo 309 * @G_UNICODE_SCRIPT_BUHID: Buhid 310 * @G_UNICODE_SCRIPT_TAGBANWA: Tagbanwa 311 * @G_UNICODE_SCRIPT_BRAILLE: Braille 312 * @G_UNICODE_SCRIPT_CYPRIOT: Cypriot 313 * @G_UNICODE_SCRIPT_LIMBU: Limbu 314 * @G_UNICODE_SCRIPT_OSMANYA: Osmanya 315 * @G_UNICODE_SCRIPT_SHAVIAN: Shavian 316 * @G_UNICODE_SCRIPT_LINEAR_B: Linear B 317 * @G_UNICODE_SCRIPT_TAI_LE: Tai Le 318 * @G_UNICODE_SCRIPT_UGARITIC: Ugaritic 319 * @G_UNICODE_SCRIPT_NEW_TAI_LUE: 320 * New Tai Lue 321 * @G_UNICODE_SCRIPT_BUGINESE: Buginese 322 * @G_UNICODE_SCRIPT_GLAGOLITIC: Glagolitic 323 * @G_UNICODE_SCRIPT_TIFINAGH: Tifinagh 324 * @G_UNICODE_SCRIPT_SYLOTI_NAGRI: 325 * Syloti Nagri 326 * @G_UNICODE_SCRIPT_OLD_PERSIAN: 327 * Old Persian 328 * @G_UNICODE_SCRIPT_KHAROSHTHI: Kharoshthi 329 * @G_UNICODE_SCRIPT_UNKNOWN: an unassigned code point 330 * @G_UNICODE_SCRIPT_BALINESE: Balinese 331 * @G_UNICODE_SCRIPT_CUNEIFORM: Cuneiform 332 * @G_UNICODE_SCRIPT_PHOENICIAN: Phoenician 333 * @G_UNICODE_SCRIPT_PHAGS_PA: Phags-pa 334 * @G_UNICODE_SCRIPT_NKO: N'Ko 335 * @G_UNICODE_SCRIPT_KAYAH_LI: Kayah Li. Since 2.16.3 336 * @G_UNICODE_SCRIPT_LEPCHA: Lepcha. Since 2.16.3 337 * @G_UNICODE_SCRIPT_REJANG: Rejang. Since 2.16.3 338 * @G_UNICODE_SCRIPT_SUNDANESE: Sundanese. Since 2.16.3 339 * @G_UNICODE_SCRIPT_SAURASHTRA: Saurashtra. Since 2.16.3 340 * @G_UNICODE_SCRIPT_CHAM: Cham. Since 2.16.3 341 * @G_UNICODE_SCRIPT_OL_CHIKI: Ol Chiki. Since 2.16.3 342 * @G_UNICODE_SCRIPT_VAI: Vai. Since 2.16.3 343 * @G_UNICODE_SCRIPT_CARIAN: Carian. Since 2.16.3 344 * @G_UNICODE_SCRIPT_LYCIAN: Lycian. Since 2.16.3 345 * @G_UNICODE_SCRIPT_LYDIAN: Lydian. Since 2.16.3 346 * @G_UNICODE_SCRIPT_AVESTAN: Avestan. Since 2.26 347 * @G_UNICODE_SCRIPT_BAMUM: Bamum. Since 2.26 348 * @G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS: 349 * Egyptian Hieroglpyhs. Since 2.26 350 * @G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC: 351 * Imperial Aramaic. Since 2.26 352 * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI: 353 * Inscriptional Pahlavi. Since 2.26 354 * @G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN: 355 * Inscriptional Parthian. Since 2.26 356 * @G_UNICODE_SCRIPT_JAVANESE: Javanese. Since 2.26 357 * @G_UNICODE_SCRIPT_KAITHI: Kaithi. Since 2.26 358 * @G_UNICODE_SCRIPT_LISU: Lisu. Since 2.26 359 * @G_UNICODE_SCRIPT_MEETEI_MAYEK: 360 * Meetei Mayek. Since 2.26 361 * @G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN: 362 * Old South Arabian. Since 2.26 363 * @G_UNICODE_SCRIPT_OLD_TURKIC: Old Turkic. Since 2.28 364 * @G_UNICODE_SCRIPT_SAMARITAN: Samaritan. Since 2.26 365 * @G_UNICODE_SCRIPT_TAI_THAM: Tai Tham. Since 2.26 366 * @G_UNICODE_SCRIPT_TAI_VIET: Tai Viet. Since 2.26 367 * @G_UNICODE_SCRIPT_BATAK: Batak. Since 2.28 368 * @G_UNICODE_SCRIPT_BRAHMI: Brahmi. Since 2.28 369 * @G_UNICODE_SCRIPT_MANDAIC: Mandaic. Since 2.28 370 * @G_UNICODE_SCRIPT_CHAKMA: Chakma. Since: 2.32 371 * @G_UNICODE_SCRIPT_MEROITIC_CURSIVE: Meroitic Cursive. Since: 2.32 372 * @G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS: Meroitic Hieroglyphs. Since: 2.32 373 * @G_UNICODE_SCRIPT_MIAO: Miao. Since: 2.32 374 * @G_UNICODE_SCRIPT_SHARADA: Sharada. Since: 2.32 375 * @G_UNICODE_SCRIPT_SORA_SOMPENG: Sora Sompeng. Since: 2.32 376 * @G_UNICODE_SCRIPT_TAKRI: Takri. Since: 2.32 377 * @G_UNICODE_SCRIPT_BASSA_VAH: Bassa. Since: 2.42 378 * @G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN: Caucasian Albanian. Since: 2.42 379 * @G_UNICODE_SCRIPT_DUPLOYAN: Duployan. Since: 2.42 380 * @G_UNICODE_SCRIPT_ELBASAN: Elbasan. Since: 2.42 381 * @G_UNICODE_SCRIPT_GRANTHA: Grantha. Since: 2.42 382 * @G_UNICODE_SCRIPT_KHOJKI: Kjohki. Since: 2.42 383 * @G_UNICODE_SCRIPT_KHUDAWADI: Khudawadi, Sindhi. Since: 2.42 384 * @G_UNICODE_SCRIPT_LINEAR_A: Linear A. Since: 2.42 385 * @G_UNICODE_SCRIPT_MAHAJANI: Mahajani. Since: 2.42 386 * @G_UNICODE_SCRIPT_MANICHAEAN: Manichaean. Since: 2.42 387 * @G_UNICODE_SCRIPT_MENDE_KIKAKUI: Mende Kikakui. Since: 2.42 388 * @G_UNICODE_SCRIPT_MODI: Modi. Since: 2.42 389 * @G_UNICODE_SCRIPT_MRO: Mro. Since: 2.42 390 * @G_UNICODE_SCRIPT_NABATAEAN: Nabataean. Since: 2.42 391 * @G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN: Old North Arabian. Since: 2.42 392 * @G_UNICODE_SCRIPT_OLD_PERMIC: Old Permic. Since: 2.42 393 * @G_UNICODE_SCRIPT_PAHAWH_HMONG: Pahawh Hmong. Since: 2.42 394 * @G_UNICODE_SCRIPT_PALMYRENE: Palmyrene. Since: 2.42 395 * @G_UNICODE_SCRIPT_PAU_CIN_HAU: Pau Cin Hau. Since: 2.42 396 * @G_UNICODE_SCRIPT_PSALTER_PAHLAVI: Psalter Pahlavi. Since: 2.42 397 * @G_UNICODE_SCRIPT_SIDDHAM: Siddham. Since: 2.42 398 * @G_UNICODE_SCRIPT_TIRHUTA: Tirhuta. Since: 2.42 399 * @G_UNICODE_SCRIPT_WARANG_CITI: Warang Citi. Since: 2.42 400 * @G_UNICODE_SCRIPT_AHOM: Ahom. Since: 2.48 401 * @G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS: Anatolian Hieroglyphs. Since: 2.48 402 * @G_UNICODE_SCRIPT_HATRAN: Hatran. Since: 2.48 403 * @G_UNICODE_SCRIPT_MULTANI: Multani. Since: 2.48 404 * @G_UNICODE_SCRIPT_OLD_HUNGARIAN: Old Hungarian. Since: 2.48 405 * @G_UNICODE_SCRIPT_SIGNWRITING: Signwriting. Since: 2.48 406 * @G_UNICODE_SCRIPT_ADLAM: Adlam. Since: 2.50 407 * @G_UNICODE_SCRIPT_BHAIKSUKI: Bhaiksuki. Since: 2.50 408 * @G_UNICODE_SCRIPT_MARCHEN: Marchen. Since: 2.50 409 * @G_UNICODE_SCRIPT_NEWA: Newa. Since: 2.50 410 * @G_UNICODE_SCRIPT_OSAGE: Osage. Since: 2.50 411 * @G_UNICODE_SCRIPT_TANGUT: Tangut. Since: 2.50 412 * @G_UNICODE_SCRIPT_MASARAM_GONDI: Masaram Gondi. Since: 2.54 413 * @G_UNICODE_SCRIPT_NUSHU: Nushu. Since: 2.54 414 * @G_UNICODE_SCRIPT_SOYOMBO: Soyombo. Since: 2.54 415 * @G_UNICODE_SCRIPT_ZANABAZAR_SQUARE: Zanabazar Square. Since: 2.54 416 * @G_UNICODE_SCRIPT_DOGRA: Dogra. Since: 2.58 417 * @G_UNICODE_SCRIPT_GUNJALA_GONDI: Gunjala Gondi. Since: 2.58 418 * @G_UNICODE_SCRIPT_HANIFI_ROHINGYA: Hanifi Rohingya. Since: 2.58 419 * @G_UNICODE_SCRIPT_MAKASAR: Makasar. Since: 2.58 420 * @G_UNICODE_SCRIPT_MEDEFAIDRIN: Medefaidrin. Since: 2.58 421 * @G_UNICODE_SCRIPT_OLD_SOGDIAN: Old Sogdian. Since: 2.58 422 * @G_UNICODE_SCRIPT_SOGDIAN: Sogdian. Since: 2.58 423 * @G_UNICODE_SCRIPT_ELYMAIC: Elym. Since: 2.62 424 * @G_UNICODE_SCRIPT_NANDINAGARI: Nand. Since: 2.62 425 * @G_UNICODE_SCRIPT_NYIAKENG_PUACHUE_HMONG: Rohg. Since: 2.62 426 * @G_UNICODE_SCRIPT_WANCHO: Wcho. Since: 2.62 427 * @G_UNICODE_SCRIPT_CHORASMIAN: Chorasmian. Since: 2.66 428 * @G_UNICODE_SCRIPT_DIVES_AKURU: Dives Akuru. Since: 2.66 429 * @G_UNICODE_SCRIPT_KHITAN_SMALL_SCRIPT: Khitan small script. Since: 2.66 430 * @G_UNICODE_SCRIPT_YEZIDI: Yezidi. Since: 2.66 431 * 432 * The #GUnicodeScript enumeration identifies different writing 433 * systems. The values correspond to the names as defined in the 434 * Unicode standard. The enumeration has been added in GLib 2.14, 435 * and is interchangeable with #PangoScript. 436 * 437 * Note that new types may be added in the future. Applications 438 * should be ready to handle unknown values. 439 * See [Unicode Standard Annex #24: Script names](http://www.unicode.org/reports/tr24/). 440 */ 441 typedef enum 442 { /* ISO 15924 code */ 443 G_UNICODE_SCRIPT_INVALID_CODE = -1, 444 G_UNICODE_SCRIPT_COMMON = 0, /* Zyyy */ 445 G_UNICODE_SCRIPT_INHERITED, /* Zinh (Qaai) */ 446 G_UNICODE_SCRIPT_ARABIC, /* Arab */ 447 G_UNICODE_SCRIPT_ARMENIAN, /* Armn */ 448 G_UNICODE_SCRIPT_BENGALI, /* Beng */ 449 G_UNICODE_SCRIPT_BOPOMOFO, /* Bopo */ 450 G_UNICODE_SCRIPT_CHEROKEE, /* Cher */ 451 G_UNICODE_SCRIPT_COPTIC, /* Copt (Qaac) */ 452 G_UNICODE_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */ 453 G_UNICODE_SCRIPT_DESERET, /* Dsrt */ 454 G_UNICODE_SCRIPT_DEVANAGARI, /* Deva */ 455 G_UNICODE_SCRIPT_ETHIOPIC, /* Ethi */ 456 G_UNICODE_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */ 457 G_UNICODE_SCRIPT_GOTHIC, /* Goth */ 458 G_UNICODE_SCRIPT_GREEK, /* Grek */ 459 G_UNICODE_SCRIPT_GUJARATI, /* Gujr */ 460 G_UNICODE_SCRIPT_GURMUKHI, /* Guru */ 461 G_UNICODE_SCRIPT_HAN, /* Hani */ 462 G_UNICODE_SCRIPT_HANGUL, /* Hang */ 463 G_UNICODE_SCRIPT_HEBREW, /* Hebr */ 464 G_UNICODE_SCRIPT_HIRAGANA, /* Hira */ 465 G_UNICODE_SCRIPT_KANNADA, /* Knda */ 466 G_UNICODE_SCRIPT_KATAKANA, /* Kana */ 467 G_UNICODE_SCRIPT_KHMER, /* Khmr */ 468 G_UNICODE_SCRIPT_LAO, /* Laoo */ 469 G_UNICODE_SCRIPT_LATIN, /* Latn (Latf, Latg) */ 470 G_UNICODE_SCRIPT_MALAYALAM, /* Mlym */ 471 G_UNICODE_SCRIPT_MONGOLIAN, /* Mong */ 472 G_UNICODE_SCRIPT_MYANMAR, /* Mymr */ 473 G_UNICODE_SCRIPT_OGHAM, /* Ogam */ 474 G_UNICODE_SCRIPT_OLD_ITALIC, /* Ital */ 475 G_UNICODE_SCRIPT_ORIYA, /* Orya */ 476 G_UNICODE_SCRIPT_RUNIC, /* Runr */ 477 G_UNICODE_SCRIPT_SINHALA, /* Sinh */ 478 G_UNICODE_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */ 479 G_UNICODE_SCRIPT_TAMIL, /* Taml */ 480 G_UNICODE_SCRIPT_TELUGU, /* Telu */ 481 G_UNICODE_SCRIPT_THAANA, /* Thaa */ 482 G_UNICODE_SCRIPT_THAI, /* Thai */ 483 G_UNICODE_SCRIPT_TIBETAN, /* Tibt */ 484 G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */ 485 G_UNICODE_SCRIPT_YI, /* Yiii */ 486 G_UNICODE_SCRIPT_TAGALOG, /* Tglg */ 487 G_UNICODE_SCRIPT_HANUNOO, /* Hano */ 488 G_UNICODE_SCRIPT_BUHID, /* Buhd */ 489 G_UNICODE_SCRIPT_TAGBANWA, /* Tagb */ 490 491 /* Unicode-4.0 additions */ 492 G_UNICODE_SCRIPT_BRAILLE, /* Brai */ 493 G_UNICODE_SCRIPT_CYPRIOT, /* Cprt */ 494 G_UNICODE_SCRIPT_LIMBU, /* Limb */ 495 G_UNICODE_SCRIPT_OSMANYA, /* Osma */ 496 G_UNICODE_SCRIPT_SHAVIAN, /* Shaw */ 497 G_UNICODE_SCRIPT_LINEAR_B, /* Linb */ 498 G_UNICODE_SCRIPT_TAI_LE, /* Tale */ 499 G_UNICODE_SCRIPT_UGARITIC, /* Ugar */ 500 501 /* Unicode-4.1 additions */ 502 G_UNICODE_SCRIPT_NEW_TAI_LUE, /* Talu */ 503 G_UNICODE_SCRIPT_BUGINESE, /* Bugi */ 504 G_UNICODE_SCRIPT_GLAGOLITIC, /* Glag */ 505 G_UNICODE_SCRIPT_TIFINAGH, /* Tfng */ 506 G_UNICODE_SCRIPT_SYLOTI_NAGRI, /* Sylo */ 507 G_UNICODE_SCRIPT_OLD_PERSIAN, /* Xpeo */ 508 G_UNICODE_SCRIPT_KHAROSHTHI, /* Khar */ 509 510 /* Unicode-5.0 additions */ 511 G_UNICODE_SCRIPT_UNKNOWN, /* Zzzz */ 512 G_UNICODE_SCRIPT_BALINESE, /* Bali */ 513 G_UNICODE_SCRIPT_CUNEIFORM, /* Xsux */ 514 G_UNICODE_SCRIPT_PHOENICIAN, /* Phnx */ 515 G_UNICODE_SCRIPT_PHAGS_PA, /* Phag */ 516 G_UNICODE_SCRIPT_NKO, /* Nkoo */ 517 518 /* Unicode-5.1 additions */ 519 G_UNICODE_SCRIPT_KAYAH_LI, /* Kali */ 520 G_UNICODE_SCRIPT_LEPCHA, /* Lepc */ 521 G_UNICODE_SCRIPT_REJANG, /* Rjng */ 522 G_UNICODE_SCRIPT_SUNDANESE, /* Sund */ 523 G_UNICODE_SCRIPT_SAURASHTRA, /* Saur */ 524 G_UNICODE_SCRIPT_CHAM, /* Cham */ 525 G_UNICODE_SCRIPT_OL_CHIKI, /* Olck */ 526 G_UNICODE_SCRIPT_VAI, /* Vaii */ 527 G_UNICODE_SCRIPT_CARIAN, /* Cari */ 528 G_UNICODE_SCRIPT_LYCIAN, /* Lyci */ 529 G_UNICODE_SCRIPT_LYDIAN, /* Lydi */ 530 531 /* Unicode-5.2 additions */ 532 G_UNICODE_SCRIPT_AVESTAN, /* Avst */ 533 G_UNICODE_SCRIPT_BAMUM, /* Bamu */ 534 G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS, /* Egyp */ 535 G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC, /* Armi */ 536 G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI, /* Phli */ 537 G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN, /* Prti */ 538 G_UNICODE_SCRIPT_JAVANESE, /* Java */ 539 G_UNICODE_SCRIPT_KAITHI, /* Kthi */ 540 G_UNICODE_SCRIPT_LISU, /* Lisu */ 541 G_UNICODE_SCRIPT_MEETEI_MAYEK, /* Mtei */ 542 G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN, /* Sarb */ 543 G_UNICODE_SCRIPT_OLD_TURKIC, /* Orkh */ 544 G_UNICODE_SCRIPT_SAMARITAN, /* Samr */ 545 G_UNICODE_SCRIPT_TAI_THAM, /* Lana */ 546 G_UNICODE_SCRIPT_TAI_VIET, /* Tavt */ 547 548 /* Unicode-6.0 additions */ 549 G_UNICODE_SCRIPT_BATAK, /* Batk */ 550 G_UNICODE_SCRIPT_BRAHMI, /* Brah */ 551 G_UNICODE_SCRIPT_MANDAIC, /* Mand */ 552 553 /* Unicode-6.1 additions */ 554 G_UNICODE_SCRIPT_CHAKMA, /* Cakm */ 555 G_UNICODE_SCRIPT_MEROITIC_CURSIVE, /* Merc */ 556 G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS, /* Mero */ 557 G_UNICODE_SCRIPT_MIAO, /* Plrd */ 558 G_UNICODE_SCRIPT_SHARADA, /* Shrd */ 559 G_UNICODE_SCRIPT_SORA_SOMPENG, /* Sora */ 560 G_UNICODE_SCRIPT_TAKRI, /* Takr */ 561 562 /* Unicode 7.0 additions */ 563 G_UNICODE_SCRIPT_BASSA_VAH, /* Bass */ 564 G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN, /* Aghb */ 565 G_UNICODE_SCRIPT_DUPLOYAN, /* Dupl */ 566 G_UNICODE_SCRIPT_ELBASAN, /* Elba */ 567 G_UNICODE_SCRIPT_GRANTHA, /* Gran */ 568 G_UNICODE_SCRIPT_KHOJKI, /* Khoj */ 569 G_UNICODE_SCRIPT_KHUDAWADI, /* Sind */ 570 G_UNICODE_SCRIPT_LINEAR_A, /* Lina */ 571 G_UNICODE_SCRIPT_MAHAJANI, /* Mahj */ 572 G_UNICODE_SCRIPT_MANICHAEAN, /* Mani */ 573 G_UNICODE_SCRIPT_MENDE_KIKAKUI, /* Mend */ 574 G_UNICODE_SCRIPT_MODI, /* Modi */ 575 G_UNICODE_SCRIPT_MRO, /* Mroo */ 576 G_UNICODE_SCRIPT_NABATAEAN, /* Nbat */ 577 G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN, /* Narb */ 578 G_UNICODE_SCRIPT_OLD_PERMIC, /* Perm */ 579 G_UNICODE_SCRIPT_PAHAWH_HMONG, /* Hmng */ 580 G_UNICODE_SCRIPT_PALMYRENE, /* Palm */ 581 G_UNICODE_SCRIPT_PAU_CIN_HAU, /* Pauc */ 582 G_UNICODE_SCRIPT_PSALTER_PAHLAVI, /* Phlp */ 583 G_UNICODE_SCRIPT_SIDDHAM, /* Sidd */ 584 G_UNICODE_SCRIPT_TIRHUTA, /* Tirh */ 585 G_UNICODE_SCRIPT_WARANG_CITI, /* Wara */ 586 587 /* Unicode 8.0 additions */ 588 G_UNICODE_SCRIPT_AHOM, /* Ahom */ 589 G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS, /* Hluw */ 590 G_UNICODE_SCRIPT_HATRAN, /* Hatr */ 591 G_UNICODE_SCRIPT_MULTANI, /* Mult */ 592 G_UNICODE_SCRIPT_OLD_HUNGARIAN, /* Hung */ 593 G_UNICODE_SCRIPT_SIGNWRITING, /* Sgnw */ 594 595 /* Unicode 9.0 additions */ 596 G_UNICODE_SCRIPT_ADLAM, /* Adlm */ 597 G_UNICODE_SCRIPT_BHAIKSUKI, /* Bhks */ 598 G_UNICODE_SCRIPT_MARCHEN, /* Marc */ 599 G_UNICODE_SCRIPT_NEWA, /* Newa */ 600 G_UNICODE_SCRIPT_OSAGE, /* Osge */ 601 G_UNICODE_SCRIPT_TANGUT, /* Tang */ 602 603 /* Unicode 10.0 additions */ 604 G_UNICODE_SCRIPT_MASARAM_GONDI, /* Gonm */ 605 G_UNICODE_SCRIPT_NUSHU, /* Nshu */ 606 G_UNICODE_SCRIPT_SOYOMBO, /* Soyo */ 607 G_UNICODE_SCRIPT_ZANABAZAR_SQUARE, /* Zanb */ 608 609 /* Unicode 11.0 additions */ 610 G_UNICODE_SCRIPT_DOGRA, /* Dogr */ 611 G_UNICODE_SCRIPT_GUNJALA_GONDI, /* Gong */ 612 G_UNICODE_SCRIPT_HANIFI_ROHINGYA, /* Rohg */ 613 G_UNICODE_SCRIPT_MAKASAR, /* Maka */ 614 G_UNICODE_SCRIPT_MEDEFAIDRIN, /* Medf */ 615 G_UNICODE_SCRIPT_OLD_SOGDIAN, /* Sogo */ 616 G_UNICODE_SCRIPT_SOGDIAN, /* Sogd */ 617 618 /* Unicode 12.0 additions */ 619 G_UNICODE_SCRIPT_ELYMAIC, /* Elym */ 620 G_UNICODE_SCRIPT_NANDINAGARI, /* Nand */ 621 G_UNICODE_SCRIPT_NYIAKENG_PUACHUE_HMONG, /* Rohg */ 622 G_UNICODE_SCRIPT_WANCHO, /* Wcho */ 623 624 /* Unicode 13.0 additions */ 625 G_UNICODE_SCRIPT_CHORASMIAN, /* Chrs */ 626 G_UNICODE_SCRIPT_DIVES_AKURU, /* Diak */ 627 G_UNICODE_SCRIPT_KHITAN_SMALL_SCRIPT, /* Kits */ 628 G_UNICODE_SCRIPT_YEZIDI /* Yezi */ 629 } GUnicodeScript; 630 631 GLIB_AVAILABLE_IN_ALL 632 guint32 g_unicode_script_to_iso15924 (GUnicodeScript script); 633 GLIB_AVAILABLE_IN_ALL 634 GUnicodeScript g_unicode_script_from_iso15924 (guint32 iso15924); 635 636 /* These are all analogs of the <ctype.h> functions. 637 */ 638 GLIB_AVAILABLE_IN_ALL 639 gboolean g_unichar_isalnum (gunichar c) G_GNUC_CONST; 640 GLIB_AVAILABLE_IN_ALL 641 gboolean g_unichar_isalpha (gunichar c) G_GNUC_CONST; 642 GLIB_AVAILABLE_IN_ALL 643 gboolean g_unichar_iscntrl (gunichar c) G_GNUC_CONST; 644 GLIB_AVAILABLE_IN_ALL 645 gboolean g_unichar_isdigit (gunichar c) G_GNUC_CONST; 646 GLIB_AVAILABLE_IN_ALL 647 gboolean g_unichar_isgraph (gunichar c) G_GNUC_CONST; 648 GLIB_AVAILABLE_IN_ALL 649 gboolean g_unichar_islower (gunichar c) G_GNUC_CONST; 650 GLIB_AVAILABLE_IN_ALL 651 gboolean g_unichar_isprint (gunichar c) G_GNUC_CONST; 652 GLIB_AVAILABLE_IN_ALL 653 gboolean g_unichar_ispunct (gunichar c) G_GNUC_CONST; 654 GLIB_AVAILABLE_IN_ALL 655 gboolean g_unichar_isspace (gunichar c) G_GNUC_CONST; 656 GLIB_AVAILABLE_IN_ALL 657 gboolean g_unichar_isupper (gunichar c) G_GNUC_CONST; 658 GLIB_AVAILABLE_IN_ALL 659 gboolean g_unichar_isxdigit (gunichar c) G_GNUC_CONST; 660 GLIB_AVAILABLE_IN_ALL 661 gboolean g_unichar_istitle (gunichar c) G_GNUC_CONST; 662 GLIB_AVAILABLE_IN_ALL 663 gboolean g_unichar_isdefined (gunichar c) G_GNUC_CONST; 664 GLIB_AVAILABLE_IN_ALL 665 gboolean g_unichar_iswide (gunichar c) G_GNUC_CONST; 666 GLIB_AVAILABLE_IN_ALL 667 gboolean g_unichar_iswide_cjk(gunichar c) G_GNUC_CONST; 668 GLIB_AVAILABLE_IN_ALL 669 gboolean g_unichar_iszerowidth(gunichar c) G_GNUC_CONST; 670 GLIB_AVAILABLE_IN_ALL 671 gboolean g_unichar_ismark (gunichar c) G_GNUC_CONST; 672 673 /* More <ctype.h> functions. These convert between the three cases. 674 * See the Unicode book to understand title case. */ 675 GLIB_AVAILABLE_IN_ALL 676 gunichar g_unichar_toupper (gunichar c) G_GNUC_CONST; 677 GLIB_AVAILABLE_IN_ALL 678 gunichar g_unichar_tolower (gunichar c) G_GNUC_CONST; 679 GLIB_AVAILABLE_IN_ALL 680 gunichar g_unichar_totitle (gunichar c) G_GNUC_CONST; 681 682 /* If C is a digit (according to 'g_unichar_isdigit'), then return its 683 numeric value. Otherwise return -1. */ 684 GLIB_AVAILABLE_IN_ALL 685 gint g_unichar_digit_value (gunichar c) G_GNUC_CONST; 686 687 GLIB_AVAILABLE_IN_ALL 688 gint g_unichar_xdigit_value (gunichar c) G_GNUC_CONST; 689 690 /* Return the Unicode character type of a given character. */ 691 GLIB_AVAILABLE_IN_ALL 692 GUnicodeType g_unichar_type (gunichar c) G_GNUC_CONST; 693 694 /* Return the line break property for a given character */ 695 GLIB_AVAILABLE_IN_ALL 696 GUnicodeBreakType g_unichar_break_type (gunichar c) G_GNUC_CONST; 697 698 /* Returns the combining class for a given character */ 699 GLIB_AVAILABLE_IN_ALL 700 gint g_unichar_combining_class (gunichar uc) G_GNUC_CONST; 701 702 GLIB_AVAILABLE_IN_ALL 703 gboolean g_unichar_get_mirror_char (gunichar ch, 704 gunichar *mirrored_ch); 705 706 GLIB_AVAILABLE_IN_ALL 707 GUnicodeScript g_unichar_get_script (gunichar ch) G_GNUC_CONST; 708 709 /* Validate a Unicode character */ 710 GLIB_AVAILABLE_IN_ALL 711 gboolean g_unichar_validate (gunichar ch) G_GNUC_CONST; 712 713 /* Pairwise canonical compose/decompose */ 714 GLIB_AVAILABLE_IN_ALL 715 gboolean g_unichar_compose (gunichar a, 716 gunichar b, 717 gunichar *ch); 718 GLIB_AVAILABLE_IN_ALL 719 gboolean g_unichar_decompose (gunichar ch, 720 gunichar *a, 721 gunichar *b); 722 723 GLIB_AVAILABLE_IN_ALL 724 gsize g_unichar_fully_decompose (gunichar ch, 725 gboolean compat, 726 gunichar *result, 727 gsize result_len); 728 729 /** 730 * G_UNICHAR_MAX_DECOMPOSITION_LENGTH: 731 * 732 * The maximum length (in codepoints) of a compatibility or canonical 733 * decomposition of a single Unicode character. 734 * 735 * This is as defined by Unicode 6.1. 736 * 737 * Since: 2.32 738 */ 739 #define G_UNICHAR_MAX_DECOMPOSITION_LENGTH 18 /* codepoints */ 740 741 /* Compute canonical ordering of a string in-place. This rearranges 742 decomposed characters in the string according to their combining 743 classes. See the Unicode manual for more information. */ 744 GLIB_AVAILABLE_IN_ALL 745 void g_unicode_canonical_ordering (gunichar *string, 746 gsize len); 747 748 749 GLIB_DEPRECATED_IN_2_30 750 gunichar *g_unicode_canonical_decomposition (gunichar ch, 751 gsize *result_len) G_GNUC_MALLOC; 752 753 /* Array of skip-bytes-per-initial character. 754 */ 755 GLIB_VAR const gchar * const g_utf8_skip; 756 757 /** 758 * g_utf8_next_char: 759 * @p: Pointer to the start of a valid UTF-8 character 760 * 761 * Skips to the next character in a UTF-8 string. The string must be 762 * valid; this macro is as fast as possible, and has no error-checking. 763 * You would use this macro to iterate over a string character by 764 * character. The macro returns the start of the next UTF-8 character. 765 * Before using this macro, use g_utf8_validate() to validate strings 766 * that may contain invalid UTF-8. 767 */ 768 #define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(const guchar *)(p)]) 769 770 GLIB_AVAILABLE_IN_ALL 771 gunichar g_utf8_get_char (const gchar *p) G_GNUC_PURE; 772 GLIB_AVAILABLE_IN_ALL 773 gunichar g_utf8_get_char_validated (const gchar *p, 774 gssize max_len) G_GNUC_PURE; 775 776 GLIB_AVAILABLE_IN_ALL 777 gchar* g_utf8_offset_to_pointer (const gchar *str, 778 glong offset) G_GNUC_PURE; 779 GLIB_AVAILABLE_IN_ALL 780 glong g_utf8_pointer_to_offset (const gchar *str, 781 const gchar *pos) G_GNUC_PURE; 782 GLIB_AVAILABLE_IN_ALL 783 gchar* g_utf8_prev_char (const gchar *p) G_GNUC_PURE; 784 GLIB_AVAILABLE_IN_ALL 785 gchar* g_utf8_find_next_char (const gchar *p, 786 const gchar *end) G_GNUC_PURE; 787 GLIB_AVAILABLE_IN_ALL 788 gchar* g_utf8_find_prev_char (const gchar *str, 789 const gchar *p) G_GNUC_PURE; 790 791 GLIB_AVAILABLE_IN_ALL 792 glong g_utf8_strlen (const gchar *p, 793 gssize max) G_GNUC_PURE; 794 795 GLIB_AVAILABLE_IN_2_30 796 gchar *g_utf8_substring (const gchar *str, 797 glong start_pos, 798 glong end_pos) G_GNUC_MALLOC; 799 800 GLIB_AVAILABLE_IN_ALL 801 gchar *g_utf8_strncpy (gchar *dest, 802 const gchar *src, 803 gsize n); 804 805 /* Find the UTF-8 character corresponding to ch, in string p. These 806 functions are equivalants to strchr and strrchr */ 807 GLIB_AVAILABLE_IN_ALL 808 gchar* g_utf8_strchr (const gchar *p, 809 gssize len, 810 gunichar c); 811 GLIB_AVAILABLE_IN_ALL 812 gchar* g_utf8_strrchr (const gchar *p, 813 gssize len, 814 gunichar c); 815 GLIB_AVAILABLE_IN_ALL 816 gchar* g_utf8_strreverse (const gchar *str, 817 gssize len); 818 819 GLIB_AVAILABLE_IN_ALL 820 gunichar2 *g_utf8_to_utf16 (const gchar *str, 821 glong len, 822 glong *items_read, 823 glong *items_written, 824 GError **error) G_GNUC_MALLOC; 825 GLIB_AVAILABLE_IN_ALL 826 gunichar * g_utf8_to_ucs4 (const gchar *str, 827 glong len, 828 glong *items_read, 829 glong *items_written, 830 GError **error) G_GNUC_MALLOC; 831 GLIB_AVAILABLE_IN_ALL 832 gunichar * g_utf8_to_ucs4_fast (const gchar *str, 833 glong len, 834 glong *items_written) G_GNUC_MALLOC; 835 GLIB_AVAILABLE_IN_ALL 836 gunichar * g_utf16_to_ucs4 (const gunichar2 *str, 837 glong len, 838 glong *items_read, 839 glong *items_written, 840 GError **error) G_GNUC_MALLOC; 841 GLIB_AVAILABLE_IN_ALL 842 gchar* g_utf16_to_utf8 (const gunichar2 *str, 843 glong len, 844 glong *items_read, 845 glong *items_written, 846 GError **error) G_GNUC_MALLOC; 847 GLIB_AVAILABLE_IN_ALL 848 gunichar2 *g_ucs4_to_utf16 (const gunichar *str, 849 glong len, 850 glong *items_read, 851 glong *items_written, 852 GError **error) G_GNUC_MALLOC; 853 GLIB_AVAILABLE_IN_ALL 854 gchar* g_ucs4_to_utf8 (const gunichar *str, 855 glong len, 856 glong *items_read, 857 glong *items_written, 858 GError **error) G_GNUC_MALLOC; 859 860 GLIB_AVAILABLE_IN_ALL 861 gint g_unichar_to_utf8 (gunichar c, 862 gchar *outbuf); 863 864 GLIB_AVAILABLE_IN_ALL 865 gboolean g_utf8_validate (const gchar *str, 866 gssize max_len, 867 const gchar **end); 868 GLIB_AVAILABLE_IN_2_60 869 gboolean g_utf8_validate_len (const gchar *str, 870 gsize max_len, 871 const gchar **end); 872 873 GLIB_AVAILABLE_IN_ALL 874 gchar *g_utf8_strup (const gchar *str, 875 gssize len) G_GNUC_MALLOC; 876 GLIB_AVAILABLE_IN_ALL 877 gchar *g_utf8_strdown (const gchar *str, 878 gssize len) G_GNUC_MALLOC; 879 GLIB_AVAILABLE_IN_ALL 880 gchar *g_utf8_casefold (const gchar *str, 881 gssize len) G_GNUC_MALLOC; 882 883 /** 884 * GNormalizeMode: 885 * @G_NORMALIZE_DEFAULT: standardize differences that do not affect the 886 * text content, such as the above-mentioned accent representation 887 * @G_NORMALIZE_NFD: another name for %G_NORMALIZE_DEFAULT 888 * @G_NORMALIZE_DEFAULT_COMPOSE: like %G_NORMALIZE_DEFAULT, but with 889 * composed forms rather than a maximally decomposed form 890 * @G_NORMALIZE_NFC: another name for %G_NORMALIZE_DEFAULT_COMPOSE 891 * @G_NORMALIZE_ALL: beyond %G_NORMALIZE_DEFAULT also standardize the 892 * "compatibility" characters in Unicode, such as SUPERSCRIPT THREE 893 * to the standard forms (in this case DIGIT THREE). Formatting 894 * information may be lost but for most text operations such 895 * characters should be considered the same 896 * @G_NORMALIZE_NFKD: another name for %G_NORMALIZE_ALL 897 * @G_NORMALIZE_ALL_COMPOSE: like %G_NORMALIZE_ALL, but with composed 898 * forms rather than a maximally decomposed form 899 * @G_NORMALIZE_NFKC: another name for %G_NORMALIZE_ALL_COMPOSE 900 * 901 * Defines how a Unicode string is transformed in a canonical 902 * form, standardizing such issues as whether a character with 903 * an accent is represented as a base character and combining 904 * accent or as a single precomposed character. Unicode strings 905 * should generally be normalized before comparing them. 906 */ 907 typedef enum { 908 G_NORMALIZE_DEFAULT, 909 G_NORMALIZE_NFD = G_NORMALIZE_DEFAULT, 910 G_NORMALIZE_DEFAULT_COMPOSE, 911 G_NORMALIZE_NFC = G_NORMALIZE_DEFAULT_COMPOSE, 912 G_NORMALIZE_ALL, 913 G_NORMALIZE_NFKD = G_NORMALIZE_ALL, 914 G_NORMALIZE_ALL_COMPOSE, 915 G_NORMALIZE_NFKC = G_NORMALIZE_ALL_COMPOSE 916 } GNormalizeMode; 917 918 GLIB_AVAILABLE_IN_ALL 919 gchar *g_utf8_normalize (const gchar *str, 920 gssize len, 921 GNormalizeMode mode) G_GNUC_MALLOC; 922 923 GLIB_AVAILABLE_IN_ALL 924 gint g_utf8_collate (const gchar *str1, 925 const gchar *str2) G_GNUC_PURE; 926 GLIB_AVAILABLE_IN_ALL 927 gchar *g_utf8_collate_key (const gchar *str, 928 gssize len) G_GNUC_MALLOC; 929 GLIB_AVAILABLE_IN_ALL 930 gchar *g_utf8_collate_key_for_filename (const gchar *str, 931 gssize len) G_GNUC_MALLOC; 932 933 GLIB_AVAILABLE_IN_2_52 934 gchar *g_utf8_make_valid (const gchar *str, 935 gssize len) G_GNUC_MALLOC; 936 937 G_END_DECLS 938 939 #endif /* __G_UNICODE_H__ */ 940