diff options
-rw-r--r-- | pango/break-indic.c | 2 | ||||
-rw-r--r-- | pango/break.c | 52 | ||||
-rw-r--r-- | pango/glyphstring.c | 2 | ||||
-rw-r--r-- | pango/itemize.c | 4 | ||||
-rw-r--r-- | pango/pango-gravity.c | 6 | ||||
-rw-r--r-- | pango/pango-gravity.h | 4 | ||||
-rw-r--r-- | pango/pango-language.c | 212 | ||||
-rw-r--r-- | pango/pango-language.h | 4 | ||||
-rw-r--r-- | pango/pango-script-private.h | 4 | ||||
-rw-r--r-- | pango/pango-script.c | 155 | ||||
-rw-r--r-- | pango/pango-script.h | 274 | ||||
-rw-r--r-- | pango/pangocairo-font.c | 2 | ||||
-rw-r--r-- | pango/serializer.c | 22 | ||||
-rw-r--r-- | tests/testmisc.c | 18 | ||||
-rw-r--r-- | tests/testscript.c | 26 |
15 files changed, 251 insertions, 536 deletions
diff --git a/pango/break-indic.c b/pango/break-indic.c index 64f300a9..045cd760 100644 --- a/pango/break-indic.c +++ b/pango/break-indic.c @@ -144,7 +144,7 @@ break_indic (const char *text, switch (analysis->script) { - case PANGO_SCRIPT_SINHALA: + case G_UNICODE_SCRIPT_SINHALA: /* * TODO: The cursor position should be based on the state table. * This is the wrong place to be doing this. diff --git a/pango/break.c b/pango/break.c index db36847c..ce701496 100644 --- a/pango/break.c +++ b/pango/break.c @@ -169,7 +169,7 @@ default_break (const char *text, GUnicodeBreakType prev_break_type; GUnicodeBreakType prev_prev_break_type; - PangoScript prev_script; + GUnicodeScript prev_script; /* See Grapheme_Cluster_Break Property Values table of UAX#29 */ typedef enum @@ -263,7 +263,7 @@ default_break (const char *text, prev_break_type = G_UNICODE_BREAK_UNKNOWN; prev_prev_break_type = G_UNICODE_BREAK_UNKNOWN; prev_wc = 0; - prev_script = PANGO_SCRIPT_COMMON; + prev_script = G_UNICODE_SCRIPT_COMMON; prev_jamo = NO_JAMO; prev_space_or_hyphen = FALSE; @@ -296,7 +296,7 @@ default_break (const char *text, /* Emoji extended pictographics */ gboolean is_Extended_Pictographic; - PangoScript script; + GUnicodeScript script; wc = next_wc; break_type = next_break_type; @@ -540,7 +540,7 @@ default_break (const char *text, prev_GB_type = GB_type; } - script = (PangoScript)g_unichar_get_script (wc); + script = g_unichar_get_script (wc); /* ---- UAX#29 Word Boundaries ---- */ { is_word_boundary = FALSE; @@ -552,10 +552,10 @@ default_break (const char *text, /* Find the WordBreakType of wc */ WB_type = WB_Other; - if (script == PANGO_SCRIPT_KATAKANA) + if (script == G_UNICODE_SCRIPT_KATAKANA) WB_type = WB_Katakana; - if (script == PANGO_SCRIPT_HEBREW && type == G_UNICODE_OTHER_LETTER) + if (script == G_UNICODE_SCRIPT_HEBREW && type == G_UNICODE_OTHER_LETTER) WB_type = WB_Hebrew_Letter; if (WB_type == WB_Other) @@ -673,7 +673,7 @@ default_break (const char *text, case G_UNICODE_TITLECASE_LETTER: case G_UNICODE_UPPERCASE_LETTER: Alphabetic: - if (break_type != G_UNICODE_BREAK_COMPLEX_CONTEXT && script != PANGO_SCRIPT_HIRAGANA) + if (break_type != G_UNICODE_BREAK_COMPLEX_CONTEXT && script != G_UNICODE_SCRIPT_HIRAGANA) WB_type = WB_ALetter; /* ALetter */ break; default: @@ -1574,13 +1574,13 @@ default_break (const char *text, switch ((int)prev_script) { - case PANGO_SCRIPT_COMMON: + case G_UNICODE_SCRIPT_COMMON: insert_hyphens = prev_wc == 0x00ad; break; - case PANGO_SCRIPT_HAN: - case PANGO_SCRIPT_HANGUL: - case PANGO_SCRIPT_HIRAGANA: - case PANGO_SCRIPT_KATAKANA: + case G_UNICODE_SCRIPT_HAN: + case G_UNICODE_SCRIPT_HANGUL: + case G_UNICODE_SCRIPT_HIRAGANA: + case G_UNICODE_SCRIPT_KATAKANA: insert_hyphens = FALSE; break; default: @@ -1678,28 +1678,28 @@ break_script (const char *item_text, { switch (analysis->script) { - case PANGO_SCRIPT_ARABIC: + case G_UNICODE_SCRIPT_ARABIC: break_arabic (item_text, item_length, analysis, attrs, attrs_len); break; - case PANGO_SCRIPT_DEVANAGARI: - case PANGO_SCRIPT_BENGALI: - case PANGO_SCRIPT_GURMUKHI: - case PANGO_SCRIPT_GUJARATI: - case PANGO_SCRIPT_ORIYA: - case PANGO_SCRIPT_TAMIL: - case PANGO_SCRIPT_TELUGU: - case PANGO_SCRIPT_KANNADA: - case PANGO_SCRIPT_MALAYALAM: - case PANGO_SCRIPT_SINHALA: + case G_UNICODE_SCRIPT_DEVANAGARI: + case G_UNICODE_SCRIPT_BENGALI: + case G_UNICODE_SCRIPT_GURMUKHI: + case G_UNICODE_SCRIPT_GUJARATI: + case G_UNICODE_SCRIPT_ORIYA: + case G_UNICODE_SCRIPT_TAMIL: + case G_UNICODE_SCRIPT_TELUGU: + case G_UNICODE_SCRIPT_KANNADA: + case G_UNICODE_SCRIPT_MALAYALAM: + case G_UNICODE_SCRIPT_SINHALA: break_indic (item_text, item_length, analysis, attrs, attrs_len); break; - case PANGO_SCRIPT_THAI: + case G_UNICODE_SCRIPT_THAI: break_thai (item_text, item_length, analysis, attrs, attrs_len); break; - case PANGO_SCRIPT_LATIN: + case G_UNICODE_SCRIPT_LATIN: break_latin (item_text, item_length, analysis, attrs, attrs_len); break; @@ -2330,7 +2330,7 @@ pango_get_log_attrs (const char *text, do { const char *run_start, *run_end; - PangoScript script; + GUnicodeScript script; int chars_in_range; pango_script_iter_get_range (&iter, &run_start, &run_end, &script); diff --git a/pango/glyphstring.c b/pango/glyphstring.c index 20ee58ce..f12f15f2 100644 --- a/pango/glyphstring.c +++ b/pango/glyphstring.c @@ -340,7 +340,7 @@ pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs, PangoItem item = {0, length, pango_utf8_strlen (text, length), 0, {NULL, NULL, embedding_level, PANGO_GRAVITY_AUTO, 0, - PANGO_SCRIPT_UNKNOWN, NULL, + G_UNICODE_SCRIPT_UNKNOWN, NULL, NULL}}; PangoGlyphItem glyph_item = {&item, glyphs}; diff --git a/pango/itemize.c b/pango/itemize.c index 2f5376bf..49820626 100644 --- a/pango/itemize.c +++ b/pango/itemize.c @@ -315,7 +315,7 @@ struct _ItemizeState PangoScriptIter script_iter; const char *script_end; - PangoScript script; + GUnicodeScript script; PangoWidthIter width_iter; PangoEmojiIter emoji_iter; @@ -800,7 +800,7 @@ get_font (ItemizeState *state, static PangoLanguage * compute_derived_language (PangoLanguage *lang, - PangoScript script) + GUnicodeScript script) { PangoLanguage *derived_lang; diff --git a/pango/pango-gravity.c b/pango/pango-gravity.c index bf41bf61..42c9e032 100644 --- a/pango/pango-gravity.c +++ b/pango/pango-gravity.c @@ -338,7 +338,7 @@ const PangoScriptProperties script_properties[] = #undef W static PangoScriptProperties -get_script_properties (PangoScript script) +get_script_properties (GUnicodeScript script) { g_return_val_if_fail (script >= 0, script_properties[0]); @@ -368,7 +368,7 @@ get_script_properties (PangoScript script) * Since: 1.16 */ PangoGravity -pango_gravity_get_for_script (PangoScript script, +pango_gravity_get_for_script (GUnicodeScript script, PangoGravity base_gravity, PangoGravityHint hint) { @@ -407,7 +407,7 @@ pango_gravity_get_for_script (PangoScript script, * Since: 1.26 */ PangoGravity -pango_gravity_get_for_script_and_width (PangoScript script, +pango_gravity_get_for_script_and_width (GUnicodeScript script, gboolean wide, PangoGravity base_gravity, PangoGravityHint hint) diff --git a/pango/pango-gravity.h b/pango/pango-gravity.h index 12e8d689..96cf5d2d 100644 --- a/pango/pango-gravity.h +++ b/pango/pango-gravity.h @@ -121,12 +121,12 @@ double pango_gravity_to_rotation (PangoGravity gravity) G_GNUC_CO PANGO_AVAILABLE_IN_1_16 PangoGravity pango_gravity_get_for_matrix (const PangoMatrix *matrix) G_GNUC_PURE; PANGO_AVAILABLE_IN_1_16 -PangoGravity pango_gravity_get_for_script (PangoScript script, +PangoGravity pango_gravity_get_for_script (GUnicodeScript script, PangoGravity base_gravity, PangoGravityHint hint) G_GNUC_CONST; PANGO_AVAILABLE_IN_1_26 PangoGravity pango_gravity_get_for_script_and_width - (PangoScript script, + (GUnicodeScript script, gboolean wide, PangoGravity base_gravity, PangoGravityHint hint) G_GNUC_CONST; diff --git a/pango/pango-language.c b/pango/pango-language.c index b963ef13..bfe84bb7 100644 --- a/pango/pango-language.c +++ b/pango/pango-language.c @@ -640,19 +640,15 @@ pango_language_get_sample_string (PangoLanguage *language) * The [method@Pango.Language.includes_script] function uses this * function internally. * - * Note: while the return value is declared as `PangoScript`, the - * returned values are from the `GUnicodeScript` enumeration, which - * may have more values. Callers need to handle unknown values. - * * Return value: (transfer none) (array length=num_scripts) (nullable): - * An array of `PangoScript` values, with the number of entries in + * An array of `GUnicodeScript` values, with the number of entries in * the array stored in @num_scripts, or %NULL if Pango does not have * any information about this particular language tag (also the case * if @language is %NULL). * * Since: 1.22 */ -const PangoScript * +const GUnicodeScript * pango_language_get_scripts (PangoLanguage *language, int *num_scripts) { @@ -682,13 +678,13 @@ pango_language_get_scripts (PangoLanguage *language, *num_scripts = j; } - return (const PangoScript *) script_for_lang->scripts; + return (const GUnicodeScript *) script_for_lang->scripts; } /** * pango_language_includes_script: * @language: (nullable): a `PangoLanguage` - * @script: a `PangoScript` + * @script: a `GUnicodeScript` * * Determines if @script is one of the scripts used to * write @language. @@ -712,14 +708,14 @@ pango_language_get_scripts (PangoLanguage *language, */ gboolean pango_language_includes_script (PangoLanguage *language, - PangoScript script) + GUnicodeScript script) { - const PangoScript *scripts; + const GUnicodeScript *scripts; int num_scripts, j; /* copied from the one in pango-script.c */ #define REAL_SCRIPT(script) \ - ((script) > PANGO_SCRIPT_INHERITED && (script) != PANGO_SCRIPT_UNKNOWN) + ((script) > G_UNICODE_SCRIPT_INHERITED && (script) != G_UNICODE_SCRIPT_UNKNOWN) if (!REAL_SCRIPT (script)) return TRUE; @@ -800,7 +796,7 @@ static PangoLanguage * const * languages = NULL; /* MT-safe */ static GHashTable *hash = NULL; /* MT-safe */ static PangoLanguage * -_pango_script_get_default_language (PangoScript script) +_pango_script_get_default_language (GUnicodeScript script) { PangoLanguage *result, * const * p; @@ -862,25 +858,25 @@ PangoLanguage ** pango_language_get_preferred (void) { /* We call this just for its side-effect of initializing languages */ - _pango_script_get_default_language (PANGO_SCRIPT_COMMON); + _pango_script_get_default_language (G_UNICODE_SCRIPT_COMMON); return (PangoLanguage **) languages; } /** * pango_script_get_sample_language: - * @script: a `PangoScript` + * @script: a `GUnicodeScript` * * Finds a language tag that is reasonably representative of @script. * * The language will usually be the most widely spoken or used language * written in that script: for instance, the sample language for - * %PANGO_SCRIPT_CYRILLIC is ru (Russian), the sample language for - * %PANGO_SCRIPT_ARABIC is ar. + * %G_UNICODE_SCRIPT_CYRILLIC is ru (Russian), the sample language for + * %G_UNICODE_SCRIPT_ARABIC is ar. * * For some scripts, no sample language will be returned because * there is no language that is sufficiently representative. The - * best example of this is %PANGO_SCRIPT_HAN, where various different + * best example of this is %G_UNICODE_SCRIPT_HAN, where various different * variants of written Chinese, Japanese, and Korean all use * significantly different sets of Han characters and forms * of shared characters. No sample language can be provided @@ -898,7 +894,7 @@ pango_language_get_preferred (void) * set to "en:fa" makes Pango choose fonts suitable for Persian (fa) * instead of Arabic (ar) when a segment of Arabic text is found * in an otherwise non-Arabic text. The same trick can be used to - * choose a default language for %PANGO_SCRIPT_HAN when setting + * choose a default language for %G_UNICODE_SCRIPT_HAN when setting * context language is not feasible. * * Return value: (nullable): a `PangoLanguage` that is representative @@ -907,7 +903,7 @@ pango_language_get_preferred (void) * Since: 1.4 */ PangoLanguage * -pango_script_get_sample_language (PangoScript script) +pango_script_get_sample_language (GUnicodeScript script) { /* Note that in the following, we want * pango_language_includes_script() for the sample language @@ -916,113 +912,113 @@ pango_script_get_sample_language (PangoScript script) * have no sample language */ static const char sample_languages[][4] = { - "", /* PANGO_SCRIPT_COMMON */ - "", /* PANGO_SCRIPT_INHERITED */ - "ar", /* PANGO_SCRIPT_ARABIC */ - "hy", /* PANGO_SCRIPT_ARMENIAN */ - "bn", /* PANGO_SCRIPT_BENGALI */ + "", /* G_UNICODE_SCRIPT_COMMON */ + "", /* G_UNICODE_SCRIPT_INHERITED */ + "ar", /* G_UNICODE_SCRIPT_ARABIC */ + "hy", /* G_UNICODE_SCRIPT_ARMENIAN */ + "bn", /* G_UNICODE_SCRIPT_BENGALI */ /* Used primarily in Taiwan, but not part of the standard * zh-tw orthography */ - "", /* PANGO_SCRIPT_BOPOMOFO */ - "chr", /* PANGO_SCRIPT_CHEROKEE */ - "cop", /* PANGO_SCRIPT_COPTIC */ - "ru", /* PANGO_SCRIPT_CYRILLIC */ + "", /* G_UNICODE_SCRIPT_BOPOMOFO */ + "chr", /* G_UNICODE_SCRIPT_CHEROKEE */ + "cop", /* G_UNICODE_SCRIPT_COPTIC */ + "ru", /* G_UNICODE_SCRIPT_CYRILLIC */ /* Deseret was used to write English */ - "", /* PANGO_SCRIPT_DESERET */ - "hi", /* PANGO_SCRIPT_DEVANAGARI */ - "am", /* PANGO_SCRIPT_ETHIOPIC */ - "ka", /* PANGO_SCRIPT_GEORGIAN */ - "", /* PANGO_SCRIPT_GOTHIC */ - "el", /* PANGO_SCRIPT_GREEK */ - "gu", /* PANGO_SCRIPT_GUJARATI */ - "pa", /* PANGO_SCRIPT_GURMUKHI */ - "", /* PANGO_SCRIPT_HAN */ - "ko", /* PANGO_SCRIPT_HANGUL */ - "he", /* PANGO_SCRIPT_HEBREW */ - "ja", /* PANGO_SCRIPT_HIRAGANA */ - "kn", /* PANGO_SCRIPT_KANNADA */ - "ja", /* PANGO_SCRIPT_KATAKANA */ - "km", /* PANGO_SCRIPT_KHMER */ - "lo", /* PANGO_SCRIPT_LAO */ - "en", /* PANGO_SCRIPT_LATIN */ - "ml", /* PANGO_SCRIPT_MALAYALAM */ - "mn", /* PANGO_SCRIPT_MONGOLIAN */ - "my", /* PANGO_SCRIPT_MYANMAR */ + "", /* G_UNICODE_SCRIPT_DESERET */ + "hi", /* G_UNICODE_SCRIPT_DEVANAGARI */ + "am", /* G_UNICODE_SCRIPT_ETHIOPIC */ + "ka", /* G_UNICODE_SCRIPT_GEORGIAN */ + "", /* G_UNICODE_SCRIPT_GOTHIC */ + "el", /* G_UNICODE_SCRIPT_GREEK */ + "gu", /* G_UNICODE_SCRIPT_GUJARATI */ + "pa", /* G_UNICODE_SCRIPT_GURMUKHI */ + "", /* G_UNICODE_SCRIPT_HAN */ + "ko", /* G_UNICODE_SCRIPT_HANGUL */ + "he", /* G_UNICODE_SCRIPT_HEBREW */ + "ja", /* G_UNICODE_SCRIPT_HIRAGANA */ + "kn", /* G_UNICODE_SCRIPT_KANNADA */ + "ja", /* G_UNICODE_SCRIPT_KATAKANA */ + "km", /* G_UNICODE_SCRIPT_KHMER */ + "lo", /* G_UNICODE_SCRIPT_LAO */ + "en", /* G_UNICODE_SCRIPT_LATIN */ + "ml", /* G_UNICODE_SCRIPT_MALAYALAM */ + "mn", /* G_UNICODE_SCRIPT_MONGOLIAN */ + "my", /* G_UNICODE_SCRIPT_MYANMAR */ /* Ogham was used to write old Irish */ - "", /* PANGO_SCRIPT_OGHAM */ - "", /* PANGO_SCRIPT_OLD_ITALIC */ - "or", /* PANGO_SCRIPT_ORIYA */ - "", /* PANGO_SCRIPT_RUNIC */ - "si", /* PANGO_SCRIPT_SINHALA */ - "syr", /* PANGO_SCRIPT_SYRIAC */ - "ta", /* PANGO_SCRIPT_TAMIL */ - "te", /* PANGO_SCRIPT_TELUGU */ - "dv", /* PANGO_SCRIPT_THAANA */ - "th", /* PANGO_SCRIPT_THAI */ - "bo", /* PANGO_SCRIPT_TIBETAN */ - "iu", /* PANGO_SCRIPT_CANADIAN_ABORIGINAL */ - "", /* PANGO_SCRIPT_YI */ - "tl", /* PANGO_SCRIPT_TAGALOG */ + "", /* G_UNICODE_SCRIPT_OGHAM */ + "", /* G_UNICODE_SCRIPT_OLD_ITALIC */ + "or", /* G_UNICODE_SCRIPT_ORIYA */ + "", /* G_UNICODE_SCRIPT_RUNIC */ + "si", /* G_UNICODE_SCRIPT_SINHALA */ + "syr", /* G_UNICODE_SCRIPT_SYRIAC */ + "ta", /* G_UNICODE_SCRIPT_TAMIL */ + "te", /* G_UNICODE_SCRIPT_TELUGU */ + "dv", /* G_UNICODE_SCRIPT_THAANA */ + "th", /* G_UNICODE_SCRIPT_THAI */ + "bo", /* G_UNICODE_SCRIPT_TIBETAN */ + "iu", /* G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL */ + "", /* G_UNICODE_SCRIPT_YI */ + "tl", /* G_UNICODE_SCRIPT_TAGALOG */ /* Phillipino languages/scripts */ - "hnn", /* PANGO_SCRIPT_HANUNOO */ - "bku", /* PANGO_SCRIPT_BUHID */ - "tbw", /* PANGO_SCRIPT_TAGBANWA */ + "hnn", /* G_UNICODE_SCRIPT_HANUNOO */ + "bku", /* G_UNICODE_SCRIPT_BUHID */ + "tbw", /* G_UNICODE_SCRIPT_TAGBANWA */ - "", /* PANGO_SCRIPT_BRAILLE */ - "", /* PANGO_SCRIPT_CYPRIOT */ - "", /* PANGO_SCRIPT_LIMBU */ + "", /* G_UNICODE_SCRIPT_BRAILLE */ + "", /* G_UNICODE_SCRIPT_CYPRIOT */ + "", /* G_UNICODE_SCRIPT_LIMBU */ /* Used for Somali (so) in the past */ - "", /* PANGO_SCRIPT_OSMANYA */ + "", /* G_UNICODE_SCRIPT_OSMANYA */ /* The Shavian alphabet was designed for English */ - "", /* PANGO_SCRIPT_SHAVIAN */ - "", /* PANGO_SCRIPT_LINEAR_B */ - "", /* PANGO_SCRIPT_TAI_LE */ - "uga", /* PANGO_SCRIPT_UGARITIC */ + "", /* G_UNICODE_SCRIPT_SHAVIAN */ + "", /* G_UNICODE_SCRIPT_LINEAR_B */ + "", /* G_UNICODE_SCRIPT_TAI_LE */ + "uga", /* G_UNICODE_SCRIPT_UGARITIC */ - "", /* PANGO_SCRIPT_NEW_TAI_LUE */ - "bug", /* PANGO_SCRIPT_BUGINESE */ + "", /* G_UNICODE_SCRIPT_NEW_TAI_LUE */ + "bug", /* G_UNICODE_SCRIPT_BUGINESE */ /* The original script for Old Church Slavonic (chu), later * written with Cyrillic */ - "", /* PANGO_SCRIPT_GLAGOLITIC */ + "", /* G_UNICODE_SCRIPT_GLAGOLITIC */ /* Used for for Berber (ber), but Arabic script is more common */ - "", /* PANGO_SCRIPT_TIFINAGH */ - "syl", /* PANGO_SCRIPT_SYLOTI_NAGRI */ - "peo", /* PANGO_SCRIPT_OLD_PERSIAN */ - "", /* PANGO_SCRIPT_KHAROSHTHI */ - - "", /* PANGO_SCRIPT_UNKNOWN */ - "", /* PANGO_SCRIPT_BALINESE */ - "", /* PANGO_SCRIPT_CUNEIFORM */ - "", /* PANGO_SCRIPT_PHOENICIAN */ - "", /* PANGO_SCRIPT_PHAGS_PA */ - "nqo", /* PANGO_SCRIPT_NKO */ + "", /* G_UNICODE_SCRIPT_TIFINAGH */ + "syl", /* G_UNICODE_SCRIPT_SYLOTI_NAGRI */ + "peo", /* G_UNICODE_SCRIPT_OLD_PERSIAN */ + "", /* G_UNICODE_SCRIPT_KHAROSHTHI */ + + "", /* G_UNICODE_SCRIPT_UNKNOWN */ + "", /* G_UNICODE_SCRIPT_BALINESE */ + "", /* G_UNICODE_SCRIPT_CUNEIFORM */ + "", /* G_UNICODE_SCRIPT_PHOENICIAN */ + "", /* G_UNICODE_SCRIPT_PHAGS_PA */ + "nqo", /* G_UNICODE_SCRIPT_NKO */ /* Unicode-5.1 additions */ - "", /* PANGO_SCRIPT_KAYAH_LI */ - "", /* PANGO_SCRIPT_LEPCHA */ - "", /* PANGO_SCRIPT_REJANG */ - "", /* PANGO_SCRIPT_SUNDANESE */ - "", /* PANGO_SCRIPT_SAURASHTRA */ - "", /* PANGO_SCRIPT_CHAM */ - "", /* PANGO_SCRIPT_OL_CHIKI */ - "", /* PANGO_SCRIPT_VAI */ - "", /* PANGO_SCRIPT_CARIAN */ - "", /* PANGO_SCRIPT_LYCIAN */ - "", /* PANGO_SCRIPT_LYDIAN */ + "", /* G_UNICODE_SCRIPT_KAYAH_LI */ + "", /* G_UNICODE_SCRIPT_LEPCHA */ + "", /* G_UNICODE_SCRIPT_REJANG */ + "", /* G_UNICODE_SCRIPT_SUNDANESE */ + "", /* G_UNICODE_SCRIPT_SAURASHTRA */ + "", /* G_UNICODE_SCRIPT_CHAM */ + "", /* G_UNICODE_SCRIPT_OL_CHIKI */ + "", /* G_UNICODE_SCRIPT_VAI */ + "", /* G_UNICODE_SCRIPT_CARIAN */ + "", /* G_UNICODE_SCRIPT_LYCIAN */ + "", /* G_UNICODE_SCRIPT_LYDIAN */ /* Unicode-6.0 additions */ - "", /* PANGO_SCRIPT_BATAK */ - "", /* PANGO_SCRIPT_BRAHMI */ - "", /* PANGO_SCRIPT_MANDAIC */ + "", /* G_UNICODE_SCRIPT_BATAK */ + "", /* G_UNICODE_SCRIPT_BRAHMI */ + "", /* G_UNICODE_SCRIPT_MANDAIC */ /* Unicode-6.1 additions */ - "", /* PANGO_SCRIPT_CHAKMA */ - "", /* PANGO_SCRIPT_MEROITIC_CURSIVE */ - "", /* PANGO_SCRIPT_MEROITIC_HIEROGLYPHS */ - "", /* PANGO_SCRIPT_MIAO */ - "", /* PANGO_SCRIPT_SHARADA */ - "", /* PANGO_SCRIPT_SORA_SOMPENG */ - "", /* PANGO_SCRIPT_TAKRI */ + "", /* G_UNICODE_SCRIPT_CHAKMA */ + "", /* G_UNICODE_SCRIPT_MEROITIC_CURSIVE */ + "", /* G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS */ + "", /* G_UNICODE_SCRIPT_MIAO */ + "", /* G_UNICODE_SCRIPT_SHARADA */ + "", /* G_UNICODE_SCRIPT_SORA_SOMPENG */ + "", /* G_UNICODE_SCRIPT_TAKRI */ }; const char *sample_language; PangoLanguage *result; diff --git a/pango/pango-language.h b/pango/pango-language.h index a71316dd..3f2ba895 100644 --- a/pango/pango-language.h +++ b/pango/pango-language.h @@ -60,9 +60,9 @@ gboolean pango_language_matches (PangoLanguage PANGO_AVAILABLE_IN_1_4 gboolean pango_language_includes_script (PangoLanguage *language, - PangoScript script) G_GNUC_PURE; + GUnicodeScript script) G_GNUC_PURE; PANGO_AVAILABLE_IN_1_22 -const PangoScript * pango_language_get_scripts (PangoLanguage *language, +const GUnicodeScript * pango_language_get_scripts (PangoLanguage *language, int *num_scripts); G_END_DECLS diff --git a/pango/pango-script-private.h b/pango/pango-script-private.h index b77209c6..108109cd 100644 --- a/pango/pango-script-private.h +++ b/pango/pango-script-private.h @@ -29,7 +29,7 @@ typedef struct _ParenStackEntry ParenStackEntry; struct _ParenStackEntry { int pair_index; - PangoScript script_code; + GUnicodeScript script_code; }; struct _PangoScriptIter @@ -39,7 +39,7 @@ struct _PangoScriptIter const gchar *script_start; const gchar *script_end; - PangoScript script_code; + GUnicodeScript script_code; ParenStackEntry paren_stack[PAREN_STACK_DEPTH]; int paren_sp; diff --git a/pango/pango-script.c b/pango/pango-script.c index 05c8c4be..aa9bcc3c 100644 --- a/pango/pango-script.c +++ b/pango/pango-script.c @@ -10,7 +10,7 @@ * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public @@ -72,8 +72,8 @@ G_DEFINE_BOXED_TYPE (PangoScriptIter, PangoScriptIter * _pango_script_iter_init (PangoScriptIter *iter, - const char *text, - int length) + const char *text, + int length) { iter->text_start = text; if (length >= 0) @@ -83,7 +83,7 @@ _pango_script_iter_init (PangoScriptIter *iter, iter->script_start = text; iter->script_end = text; - iter->script_code = PANGO_SCRIPT_COMMON; + iter->script_code = G_UNICODE_SCRIPT_COMMON; iter->paren_sp = -1; @@ -113,7 +113,7 @@ _pango_script_iter_init (PangoScriptIter *iter, **/ PangoScriptIter * pango_script_iter_new (const char *text, - int length) + int length) { return _pango_script_iter_init (g_slice_new (PangoScriptIter), text, length); } @@ -156,18 +156,13 @@ pango_script_iter_free (PangoScriptIter *iter) * The range is the set of locations p where *start <= p < *end. * (That is, it doesn't include the character stored at *end) * - * Note that while the type of the @script argument is declared - * as `PangoScript`, as of Pango 1.18, this function simply returns - * `GUnicodeScript` values. Callers must be prepared to handle unknown - * values. - * * Since: 1.4 */ void pango_script_iter_get_range (PangoScriptIter *iter, const char **start, const char **end, - PangoScript *script) + GUnicodeScript *script) { if (start) *start = iter->script_start; @@ -249,11 +244,11 @@ get_pair_index (gunichar ch) int mid = (lower + upper) / 2; if (ch < paired_chars[mid]) - upper = mid - 1; + upper = mid - 1; else if (ch > paired_chars[mid]) - lower = mid + 1; + lower = mid + 1; else - return mid; + return mid; } return -1; @@ -261,7 +256,7 @@ get_pair_index (gunichar ch) /* duplicated in pango-language.c */ #define REAL_SCRIPT(script) \ - ((script) > PANGO_SCRIPT_INHERITED && (script) != PANGO_SCRIPT_UNKNOWN) + ((script) > G_UNICODE_SCRIPT_INHERITED && (script) != G_UNICODE_SCRIPT_UNKNOWN) #define SAME_SCRIPT(script1, script2) \ (!REAL_SCRIPT (script1) || !REAL_SCRIPT (script2) || (script1) == (script2)) @@ -290,20 +285,20 @@ pango_script_iter_next (PangoScriptIter *iter) return FALSE; start_sp = iter->paren_sp; - iter->script_code = PANGO_SCRIPT_COMMON; + iter->script_code = G_UNICODE_SCRIPT_COMMON; iter->script_start = iter->script_end; for (; iter->script_end < iter->text_end; iter->script_end = g_utf8_next_char (iter->script_end)) { gunichar ch = g_utf8_get_char (iter->script_end); - PangoScript sc; + GUnicodeScript sc; int pair_index; - sc = (PangoScript)g_unichar_get_script (ch); - if (sc != PANGO_SCRIPT_COMMON) - pair_index = -1; + sc = g_unichar_get_script (ch); + if (sc != G_UNICODE_SCRIPT_COMMON) + pair_index = -1; else - pair_index = get_pair_index (ch); + pair_index = get_pair_index (ch); /* * Paired character handling: @@ -314,68 +309,68 @@ pango_script_iter_next (PangoScriptIter *iter) * characters above it on the stack will be poped. */ if (pair_index >= 0) - { - if (IS_OPEN (pair_index)) - { - /* - * If the paren stack is full, empty it. This - * means that deeply nested paired punctuation - * characters will be ignored, but that's an unusual - * case, and it's better to ignore them than to - * write off the end of the stack... - */ - if (++iter->paren_sp >= PAREN_STACK_DEPTH) - iter->paren_sp = 0; - - iter->paren_stack[iter->paren_sp].pair_index = pair_index; - iter->paren_stack[iter->paren_sp].script_code = iter->script_code; - } - else if (iter->paren_sp >= 0) - { - int pi = pair_index & ~1; - - while (iter->paren_sp >= 0 && iter->paren_stack[iter->paren_sp].pair_index != pi) - iter->paren_sp--; - - if (iter->paren_sp < start_sp) - start_sp = iter->paren_sp; - - if (iter->paren_sp >= 0) - sc = iter->paren_stack[iter->paren_sp].script_code; - } - } + { + if (IS_OPEN (pair_index)) + { + /* + * If the paren stack is full, empty it. This + * means that deeply nested paired punctuation + * characters will be ignored, but that's an unusual + * case, and it's better to ignore them than to + * write off the end of the stack... + */ + if (++iter->paren_sp >= PAREN_STACK_DEPTH) + iter->paren_sp = 0; + + iter->paren_stack[iter->paren_sp].pair_index = pair_index; + iter->paren_stack[iter->paren_sp].script_code = iter->script_code; + } + else if (iter->paren_sp >= 0) + { + int pi = pair_index & ~1; + + while (iter->paren_sp >= 0 && iter->paren_stack[iter->paren_sp].pair_index != pi) + iter->paren_sp--; + + if (iter->paren_sp < start_sp) + start_sp = iter->paren_sp; + + if (iter->paren_sp >= 0) + sc = iter->paren_stack[iter->paren_sp].script_code; + } + } if (SAME_SCRIPT (iter->script_code, sc)) - { - if (!REAL_SCRIPT (iter->script_code) && REAL_SCRIPT (sc)) - { - iter->script_code = sc; - - /* - * now that we have a final script code, fix any open - * characters we pushed before we knew the script code. - */ - while (start_sp < iter->paren_sp) - iter->paren_stack[++start_sp].script_code = iter->script_code; - } - - /* - * if this character is a close paired character, - * pop it from the stack - */ - if (pair_index >= 0 && !IS_OPEN (pair_index) && iter->paren_sp >= 0) - { - iter->paren_sp--; - - if (iter->paren_sp < start_sp) - start_sp = iter->paren_sp; - } - } + { + if (!REAL_SCRIPT (iter->script_code) && REAL_SCRIPT (sc)) + { + iter->script_code = sc; + + /* + * now that we have a final script code, fix any open + * characters we pushed before we knew the script code. + */ + while (start_sp < iter->paren_sp) + iter->paren_stack[++start_sp].script_code = iter->script_code; + } + + /* + * if this character is a close paired character, + * pop it from the stack + */ + if (pair_index >= 0 && !IS_OPEN (pair_index) && iter->paren_sp >= 0) + { + iter->paren_sp--; + + if (iter->paren_sp < start_sp) + start_sp = iter->paren_sp; + } + } else - { - /* Different script, we're done */ - break; - } + { + /* Different script, we're done */ + break; + } } return TRUE; diff --git a/pango/pango-script.h b/pango/pango-script.h index 86993d58..c936b5cc 100644 --- a/pango/pango-script.h +++ b/pango/pango-script.h @@ -36,276 +36,6 @@ G_BEGIN_DECLS **/ typedef struct _PangoScriptIter PangoScriptIter; -/** - * PangoScript: - * @PANGO_SCRIPT_INVALID_CODE: a value never returned from pango_script_for_unichar() - * @PANGO_SCRIPT_COMMON: a character used by multiple different scripts - * @PANGO_SCRIPT_INHERITED: a mark glyph that takes its script from the - * base glyph to which it is attached - * @PANGO_SCRIPT_ARABIC: Arabic - * @PANGO_SCRIPT_ARMENIAN: Armenian - * @PANGO_SCRIPT_BENGALI: Bengali - * @PANGO_SCRIPT_BOPOMOFO: Bopomofo - * @PANGO_SCRIPT_CHEROKEE: Cherokee - * @PANGO_SCRIPT_COPTIC: Coptic - * @PANGO_SCRIPT_CYRILLIC: Cyrillic - * @PANGO_SCRIPT_DESERET: Deseret - * @PANGO_SCRIPT_DEVANAGARI: Devanagari - * @PANGO_SCRIPT_ETHIOPIC: Ethiopic - * @PANGO_SCRIPT_GEORGIAN: Georgian - * @PANGO_SCRIPT_GOTHIC: Gothic - * @PANGO_SCRIPT_GREEK: Greek - * @PANGO_SCRIPT_GUJARATI: Gujarati - * @PANGO_SCRIPT_GURMUKHI: Gurmukhi - * @PANGO_SCRIPT_HAN: Han - * @PANGO_SCRIPT_HANGUL: Hangul - * @PANGO_SCRIPT_HEBREW: Hebrew - * @PANGO_SCRIPT_HIRAGANA: Hiragana - * @PANGO_SCRIPT_KANNADA: Kannada - * @PANGO_SCRIPT_KATAKANA: Katakana - * @PANGO_SCRIPT_KHMER: Khmer - * @PANGO_SCRIPT_LAO: Lao - * @PANGO_SCRIPT_LATIN: Latin - * @PANGO_SCRIPT_MALAYALAM: Malayalam - * @PANGO_SCRIPT_MONGOLIAN: Mongolian - * @PANGO_SCRIPT_MYANMAR: Myanmar - * @PANGO_SCRIPT_OGHAM: Ogham - * @PANGO_SCRIPT_OLD_ITALIC: Old Italic - * @PANGO_SCRIPT_ORIYA: Oriya - * @PANGO_SCRIPT_RUNIC: Runic - * @PANGO_SCRIPT_SINHALA: Sinhala - * @PANGO_SCRIPT_SYRIAC: Syriac - * @PANGO_SCRIPT_TAMIL: Tamil - * @PANGO_SCRIPT_TELUGU: Telugu - * @PANGO_SCRIPT_THAANA: Thaana - * @PANGO_SCRIPT_THAI: Thai - * @PANGO_SCRIPT_TIBETAN: Tibetan - * @PANGO_SCRIPT_CANADIAN_ABORIGINAL: Canadian Aboriginal - * @PANGO_SCRIPT_YI: Yi - * @PANGO_SCRIPT_TAGALOG: Tagalog - * @PANGO_SCRIPT_HANUNOO: Hanunoo - * @PANGO_SCRIPT_BUHID: Buhid - * @PANGO_SCRIPT_TAGBANWA: Tagbanwa - * @PANGO_SCRIPT_BRAILLE: Braille - * @PANGO_SCRIPT_CYPRIOT: Cypriot - * @PANGO_SCRIPT_LIMBU: Limbu - * @PANGO_SCRIPT_OSMANYA: Osmanya - * @PANGO_SCRIPT_SHAVIAN: Shavian - * @PANGO_SCRIPT_LINEAR_B: Linear B - * @PANGO_SCRIPT_TAI_LE: Tai Le - * @PANGO_SCRIPT_UGARITIC: Ugaritic - * @PANGO_SCRIPT_NEW_TAI_LUE: New Tai Lue. Since 1.10 - * @PANGO_SCRIPT_BUGINESE: Buginese. Since 1.10 - * @PANGO_SCRIPT_GLAGOLITIC: Glagolitic. Since 1.10 - * @PANGO_SCRIPT_TIFINAGH: Tifinagh. Since 1.10 - * @PANGO_SCRIPT_SYLOTI_NAGRI: Syloti Nagri. Since 1.10 - * @PANGO_SCRIPT_OLD_PERSIAN: Old Persian. Since 1.10 - * @PANGO_SCRIPT_KHAROSHTHI: Kharoshthi. Since 1.10 - * @PANGO_SCRIPT_UNKNOWN: an unassigned code point. Since 1.14 - * @PANGO_SCRIPT_BALINESE: Balinese. Since 1.14 - * @PANGO_SCRIPT_CUNEIFORM: Cuneiform. Since 1.14 - * @PANGO_SCRIPT_PHOENICIAN: Phoenician. Since 1.14 - * @PANGO_SCRIPT_PHAGS_PA: Phags-pa. Since 1.14 - * @PANGO_SCRIPT_NKO: N'Ko. Since 1.14 - * @PANGO_SCRIPT_KAYAH_LI: Kayah Li. Since 1.20.1 - * @PANGO_SCRIPT_LEPCHA: Lepcha. Since 1.20.1 - * @PANGO_SCRIPT_REJANG: Rejang. Since 1.20.1 - * @PANGO_SCRIPT_SUNDANESE: Sundanese. Since 1.20.1 - * @PANGO_SCRIPT_SAURASHTRA: Saurashtra. Since 1.20.1 - * @PANGO_SCRIPT_CHAM: Cham. Since 1.20.1 - * @PANGO_SCRIPT_OL_CHIKI: Ol Chiki. Since 1.20.1 - * @PANGO_SCRIPT_VAI: Vai. Since 1.20.1 - * @PANGO_SCRIPT_CARIAN: Carian. Since 1.20.1 - * @PANGO_SCRIPT_LYCIAN: Lycian. Since 1.20.1 - * @PANGO_SCRIPT_LYDIAN: Lydian. Since 1.20.1 - * @PANGO_SCRIPT_BATAK: Batak. Since 1.32 - * @PANGO_SCRIPT_BRAHMI: Brahmi. Since 1.32 - * @PANGO_SCRIPT_MANDAIC: Mandaic. Since 1.32 - * @PANGO_SCRIPT_CHAKMA: Chakma. Since: 1.32 - * @PANGO_SCRIPT_MEROITIC_CURSIVE: Meroitic Cursive. Since: 1.32 - * @PANGO_SCRIPT_MEROITIC_HIEROGLYPHS: Meroitic Hieroglyphs. Since: 1.32 - * @PANGO_SCRIPT_MIAO: Miao. Since: 1.32 - * @PANGO_SCRIPT_SHARADA: Sharada. Since: 1.32 - * @PANGO_SCRIPT_SORA_SOMPENG: Sora Sompeng. Since: 1.32 - * @PANGO_SCRIPT_TAKRI: Takri. Since: 1.32 - * @PANGO_SCRIPT_BASSA_VAH: Bassa. Since: 1.40 - * @PANGO_SCRIPT_CAUCASIAN_ALBANIAN: Caucasian Albanian. Since: 1.40 - * @PANGO_SCRIPT_DUPLOYAN: Duployan. Since: 1.40 - * @PANGO_SCRIPT_ELBASAN: Elbasan. Since: 1.40 - * @PANGO_SCRIPT_GRANTHA: Grantha. Since: 1.40 - * @PANGO_SCRIPT_KHOJKI: Kjohki. Since: 1.40 - * @PANGO_SCRIPT_KHUDAWADI: Khudawadi, Sindhi. Since: 1.40 - * @PANGO_SCRIPT_LINEAR_A: Linear A. Since: 1.40 - * @PANGO_SCRIPT_MAHAJANI: Mahajani. Since: 1.40 - * @PANGO_SCRIPT_MANICHAEAN: Manichaean. Since: 1.40 - * @PANGO_SCRIPT_MENDE_KIKAKUI: Mende Kikakui. Since: 1.40 - * @PANGO_SCRIPT_MODI: Modi. Since: 1.40 - * @PANGO_SCRIPT_MRO: Mro. Since: 1.40 - * @PANGO_SCRIPT_NABATAEAN: Nabataean. Since: 1.40 - * @PANGO_SCRIPT_OLD_NORTH_ARABIAN: Old North Arabian. Since: 1.40 - * @PANGO_SCRIPT_OLD_PERMIC: Old Permic. Since: 1.40 - * @PANGO_SCRIPT_PAHAWH_HMONG: Pahawh Hmong. Since: 1.40 - * @PANGO_SCRIPT_PALMYRENE: Palmyrene. Since: 1.40 - * @PANGO_SCRIPT_PAU_CIN_HAU: Pau Cin Hau. Since: 1.40 - * @PANGO_SCRIPT_PSALTER_PAHLAVI: Psalter Pahlavi. Since: 1.40 - * @PANGO_SCRIPT_SIDDHAM: Siddham. Since: 1.40 - * @PANGO_SCRIPT_TIRHUTA: Tirhuta. Since: 1.40 - * @PANGO_SCRIPT_WARANG_CITI: Warang Citi. Since: 1.40 - * @PANGO_SCRIPT_AHOM: Ahom. Since: 1.40 - * @PANGO_SCRIPT_ANATOLIAN_HIEROGLYPHS: Anatolian Hieroglyphs. Since: 1.40 - * @PANGO_SCRIPT_HATRAN: Hatran. Since: 1.40 - * @PANGO_SCRIPT_MULTANI: Multani. Since: 1.40 - * @PANGO_SCRIPT_OLD_HUNGARIAN: Old Hungarian. Since: 1.40 - * @PANGO_SCRIPT_SIGNWRITING: Signwriting. Since: 1.40 - * - * The `PangoScript` enumeration identifies different writing - * systems. - * - * The values correspond to the names as defined in the Unicode standard. See - * [Unicode Standard Annex 24: Script names](http://www.unicode.org/reports/tr24/) - * - * Note that this enumeration is deprecated and will not be updated to include values - * in newer versions of the Unicode standard. Applications should use the - * [enum@GLib.UnicodeScript] enumeration instead, - * whose values are interchangeable with `PangoScript`. - */ -typedef enum { /* ISO 15924 code */ - PANGO_SCRIPT_INVALID_CODE = -1, - PANGO_SCRIPT_COMMON = 0, /* Zyyy */ - PANGO_SCRIPT_INHERITED, /* Qaai */ - PANGO_SCRIPT_ARABIC, /* Arab */ - PANGO_SCRIPT_ARMENIAN, /* Armn */ - PANGO_SCRIPT_BENGALI, /* Beng */ - PANGO_SCRIPT_BOPOMOFO, /* Bopo */ - PANGO_SCRIPT_CHEROKEE, /* Cher */ - PANGO_SCRIPT_COPTIC, /* Qaac */ - PANGO_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */ - PANGO_SCRIPT_DESERET, /* Dsrt */ - PANGO_SCRIPT_DEVANAGARI, /* Deva */ - PANGO_SCRIPT_ETHIOPIC, /* Ethi */ - PANGO_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */ - PANGO_SCRIPT_GOTHIC, /* Goth */ - PANGO_SCRIPT_GREEK, /* Grek */ - PANGO_SCRIPT_GUJARATI, /* Gujr */ - PANGO_SCRIPT_GURMUKHI, /* Guru */ - PANGO_SCRIPT_HAN, /* Hani */ - PANGO_SCRIPT_HANGUL, /* Hang */ - PANGO_SCRIPT_HEBREW, /* Hebr */ - PANGO_SCRIPT_HIRAGANA, /* Hira */ - PANGO_SCRIPT_KANNADA, /* Knda */ - PANGO_SCRIPT_KATAKANA, /* Kana */ - PANGO_SCRIPT_KHMER, /* Khmr */ - PANGO_SCRIPT_LAO, /* Laoo */ - PANGO_SCRIPT_LATIN, /* Latn (Latf, Latg) */ - PANGO_SCRIPT_MALAYALAM, /* Mlym */ - PANGO_SCRIPT_MONGOLIAN, /* Mong */ - PANGO_SCRIPT_MYANMAR, /* Mymr */ - PANGO_SCRIPT_OGHAM, /* Ogam */ - PANGO_SCRIPT_OLD_ITALIC, /* Ital */ - PANGO_SCRIPT_ORIYA, /* Orya */ - PANGO_SCRIPT_RUNIC, /* Runr */ - PANGO_SCRIPT_SINHALA, /* Sinh */ - PANGO_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */ - PANGO_SCRIPT_TAMIL, /* Taml */ - PANGO_SCRIPT_TELUGU, /* Telu */ - PANGO_SCRIPT_THAANA, /* Thaa */ - PANGO_SCRIPT_THAI, /* Thai */ - PANGO_SCRIPT_TIBETAN, /* Tibt */ - PANGO_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */ - PANGO_SCRIPT_YI, /* Yiii */ - PANGO_SCRIPT_TAGALOG, /* Tglg */ - PANGO_SCRIPT_HANUNOO, /* Hano */ - PANGO_SCRIPT_BUHID, /* Buhd */ - PANGO_SCRIPT_TAGBANWA, /* Tagb */ - - /* Unicode-4.0 additions */ - PANGO_SCRIPT_BRAILLE, /* Brai */ - PANGO_SCRIPT_CYPRIOT, /* Cprt */ - PANGO_SCRIPT_LIMBU, /* Limb */ - PANGO_SCRIPT_OSMANYA, /* Osma */ - PANGO_SCRIPT_SHAVIAN, /* Shaw */ - PANGO_SCRIPT_LINEAR_B, /* Linb */ - PANGO_SCRIPT_TAI_LE, /* Tale */ - PANGO_SCRIPT_UGARITIC, /* Ugar */ - - /* Unicode-4.1 additions */ - PANGO_SCRIPT_NEW_TAI_LUE, /* Talu */ - PANGO_SCRIPT_BUGINESE, /* Bugi */ - PANGO_SCRIPT_GLAGOLITIC, /* Glag */ - PANGO_SCRIPT_TIFINAGH, /* Tfng */ - PANGO_SCRIPT_SYLOTI_NAGRI, /* Sylo */ - PANGO_SCRIPT_OLD_PERSIAN, /* Xpeo */ - PANGO_SCRIPT_KHAROSHTHI, /* Khar */ - - /* Unicode-5.0 additions */ - PANGO_SCRIPT_UNKNOWN, /* Zzzz */ - PANGO_SCRIPT_BALINESE, /* Bali */ - PANGO_SCRIPT_CUNEIFORM, /* Xsux */ - PANGO_SCRIPT_PHOENICIAN, /* Phnx */ - PANGO_SCRIPT_PHAGS_PA, /* Phag */ - PANGO_SCRIPT_NKO, /* Nkoo */ - - /* Unicode-5.1 additions */ - PANGO_SCRIPT_KAYAH_LI, /* Kali */ - PANGO_SCRIPT_LEPCHA, /* Lepc */ - PANGO_SCRIPT_REJANG, /* Rjng */ - PANGO_SCRIPT_SUNDANESE, /* Sund */ - PANGO_SCRIPT_SAURASHTRA, /* Saur */ - PANGO_SCRIPT_CHAM, /* Cham */ - PANGO_SCRIPT_OL_CHIKI, /* Olck */ - PANGO_SCRIPT_VAI, /* Vaii */ - PANGO_SCRIPT_CARIAN, /* Cari */ - PANGO_SCRIPT_LYCIAN, /* Lyci */ - PANGO_SCRIPT_LYDIAN, /* Lydi */ - - /* Unicode-6.0 additions */ - PANGO_SCRIPT_BATAK, /* Batk */ - PANGO_SCRIPT_BRAHMI, /* Brah */ - PANGO_SCRIPT_MANDAIC, /* Mand */ - - /* Unicode-6.1 additions */ - PANGO_SCRIPT_CHAKMA, /* Cakm */ - PANGO_SCRIPT_MEROITIC_CURSIVE, /* Merc */ - PANGO_SCRIPT_MEROITIC_HIEROGLYPHS,/* Mero */ - PANGO_SCRIPT_MIAO, /* Plrd */ - PANGO_SCRIPT_SHARADA, /* Shrd */ - PANGO_SCRIPT_SORA_SOMPENG, /* Sora */ - PANGO_SCRIPT_TAKRI, /* Takr */ - - /* Unicode 7.0 additions */ - PANGO_SCRIPT_BASSA_VAH, /* Bass */ - PANGO_SCRIPT_CAUCASIAN_ALBANIAN, /* Aghb */ - PANGO_SCRIPT_DUPLOYAN, /* Dupl */ - PANGO_SCRIPT_ELBASAN, /* Elba */ - PANGO_SCRIPT_GRANTHA, /* Gran */ - PANGO_SCRIPT_KHOJKI, /* Khoj */ - PANGO_SCRIPT_KHUDAWADI, /* Sind */ - PANGO_SCRIPT_LINEAR_A, /* Lina */ - PANGO_SCRIPT_MAHAJANI, /* Mahj */ - PANGO_SCRIPT_MANICHAEAN, /* Manu */ - PANGO_SCRIPT_MENDE_KIKAKUI, /* Mend */ - PANGO_SCRIPT_MODI, /* Modi */ - PANGO_SCRIPT_MRO, /* Mroo */ - PANGO_SCRIPT_NABATAEAN, /* Nbat */ - PANGO_SCRIPT_OLD_NORTH_ARABIAN, /* Narb */ - PANGO_SCRIPT_OLD_PERMIC, /* Perm */ - PANGO_SCRIPT_PAHAWH_HMONG, /* Hmng */ - PANGO_SCRIPT_PALMYRENE, /* Palm */ - PANGO_SCRIPT_PAU_CIN_HAU, /* Pauc */ - PANGO_SCRIPT_PSALTER_PAHLAVI, /* Phlp */ - PANGO_SCRIPT_SIDDHAM, /* Sidd */ - PANGO_SCRIPT_TIRHUTA, /* Tirh */ - PANGO_SCRIPT_WARANG_CITI, /* Wara */ - - /* Unicode 8.0 additions */ - PANGO_SCRIPT_AHOM, /* Ahom */ - PANGO_SCRIPT_ANATOLIAN_HIEROGLYPHS, /* Hluw */ - PANGO_SCRIPT_HATRAN, /* Hatr */ - PANGO_SCRIPT_MULTANI, /* Mult */ - PANGO_SCRIPT_OLD_HUNGARIAN, /* Hung */ - PANGO_SCRIPT_SIGNWRITING /* Sgnw */ -} PangoScript; - PANGO_AVAILABLE_IN_1_44 GType pango_script_iter_get_type (void) G_GNUC_CONST; @@ -316,7 +46,7 @@ PANGO_AVAILABLE_IN_1_4 void pango_script_iter_get_range (PangoScriptIter *iter, const char **start, const char **end, - PangoScript *script); + GUnicodeScript *script); PANGO_AVAILABLE_IN_1_4 gboolean pango_script_iter_next (PangoScriptIter *iter); PANGO_AVAILABLE_IN_1_4 @@ -325,7 +55,7 @@ void pango_script_iter_free (PangoScriptIter *iter); #include <pango/pango-language.h> PANGO_AVAILABLE_IN_1_4 -PangoLanguage *pango_script_get_sample_language (PangoScript script) G_GNUC_PURE; +PangoLanguage *pango_script_get_sample_language (GUnicodeScript script) G_GNUC_PURE; G_END_DECLS diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c index 519a69aa..50a72239 100644 --- a/pango/pangocairo-font.c +++ b/pango/pangocairo-font.c @@ -496,7 +496,7 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv) context = pango_font_map_create_context (fontmap); pango_context_set_matrix (context, &pango_ctm); - pango_context_set_language (context, pango_script_get_sample_language (PANGO_SCRIPT_LATIN)); + pango_context_set_language (context, pango_script_get_sample_language (G_UNICODE_SCRIPT_LATIN)); pango_cairo_context_set_font_options (context, font_options); mini_font = pango_font_map_load_font (fontmap, context, desc); diff --git a/pango/serializer.c b/pango/serializer.c index d9d92be6..bd47f364 100644 --- a/pango/serializer.c +++ b/pango/serializer.c @@ -204,20 +204,12 @@ static const char *attr_type_names[] = { NULL }; -static const char * -get_script_name (PangoScript script) +static void +get_script_name (GUnicodeScript script, + char *buf) { - GEnumClass *enum_class; - GEnumValue *enum_value; - - enum_class = g_type_class_ref (PANGO_TYPE_SCRIPT); - enum_value = g_enum_get_value (enum_class, script); - g_type_class_unref (enum_class); - - if (enum_value) - return enum_value->value_nick; - - return NULL; + guint32 tag = g_unicode_script_to_iso15924 (script); + hb_tag_to_string (tag, buf); } static const char *tab_align_names[] = { @@ -638,6 +630,7 @@ add_run (GtkJsonPrinter *printer, PangoLayoutRun *run) { char *str; + char buf[5] = { 0, }; gtk_json_printer_start_object (printer, NULL); @@ -651,7 +644,8 @@ add_run (GtkJsonPrinter *printer, gtk_json_printer_add_integer (printer, "bidi-level", run->item->analysis.level); gtk_json_printer_add_string (printer, "gravity", gravity_names[run->item->analysis.gravity]); gtk_json_printer_add_string (printer, "language", pango_language_to_string (run->item->analysis.language)); - gtk_json_printer_add_string (printer, "script", get_script_name (run->item->analysis.script)); + get_script_name (run->item->analysis.script, buf); + gtk_json_printer_add_string (printer, "script", buf); add_font (printer, "font", run->item->analysis.font); diff --git a/tests/testmisc.c b/tests/testmisc.c index f71932fd..63d21119 100644 --- a/tests/testmisc.c +++ b/tests/testmisc.c @@ -91,7 +91,7 @@ static void test_language_emoji_crash (void) { PangoLanguage *lang; - const PangoScript *scripts; + const GUnicodeScript *scripts; int num; lang = pango_language_from_string ("und-zsye"); @@ -360,18 +360,18 @@ static void test_gravity_for_script (void) { struct { - PangoScript script; + GUnicodeScript script; PangoGravity gravity; PangoGravity gravity_natural; PangoGravity gravity_line; } tests[] = { - { PANGO_SCRIPT_ARABIC, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_NORTH }, - { PANGO_SCRIPT_BOPOMOFO, PANGO_GRAVITY_EAST, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH }, - { PANGO_SCRIPT_LATIN, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH }, - { PANGO_SCRIPT_HANGUL, PANGO_GRAVITY_EAST, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH }, - { PANGO_SCRIPT_MONGOLIAN, PANGO_GRAVITY_WEST, PANGO_GRAVITY_SOUTH }, - { PANGO_SCRIPT_OGHAM, PANGO_GRAVITY_WEST, PANGO_GRAVITY_NORTH, PANGO_GRAVITY_SOUTH }, - { PANGO_SCRIPT_TIBETAN, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH }, + { G_UNICODE_SCRIPT_ARABIC, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_NORTH }, + { G_UNICODE_SCRIPT_BOPOMOFO, PANGO_GRAVITY_EAST, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH }, + { G_UNICODE_SCRIPT_LATIN, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH }, + { G_UNICODE_SCRIPT_HANGUL, PANGO_GRAVITY_EAST, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH }, + { G_UNICODE_SCRIPT_MONGOLIAN, PANGO_GRAVITY_WEST, PANGO_GRAVITY_SOUTH }, + { G_UNICODE_SCRIPT_OGHAM, PANGO_GRAVITY_WEST, PANGO_GRAVITY_NORTH, PANGO_GRAVITY_SOUTH }, + { G_UNICODE_SCRIPT_TIBETAN, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH }, }; for (int i = 0; i < G_N_ELEMENTS (tests); i++) diff --git a/tests/testscript.c b/tests/testscript.c index 7260dbbe..eb066af2 100644 --- a/tests/testscript.c +++ b/tests/testscript.c @@ -64,7 +64,7 @@ typedef struct { const char *run_text_escaped; char *run_text; - PangoScript run_code; + GUnicodeScript run_code; } RunTestData; static gchar * @@ -130,16 +130,16 @@ static void test_script_iter (void) { static RunTestData test_data[] = { - { "\\u0020\\u0946\\u0939\\u093F\\u0928\\u094D\\u0926\\u0940\\u0020", NULL, PANGO_SCRIPT_DEVANAGARI }, - { "\\u0627\\u0644\\u0639\\u0631\\u0628\\u064A\\u0629\\u0020", NULL, PANGO_SCRIPT_ARABIC }, - { "\\u0420\\u0443\\u0441\\u0441\\u043A\\u0438\\u0439\\u0020", NULL, PANGO_SCRIPT_CYRILLIC }, - { "English (", NULL, PANGO_SCRIPT_LATIN }, - { "\\u0E44\\u0E17\\u0E22", NULL, PANGO_SCRIPT_THAI }, - { ") ", NULL, PANGO_SCRIPT_LATIN }, - { "\\u6F22\\u5B75", NULL, PANGO_SCRIPT_HAN }, - { "\\u3068\\u3072\\u3089\\u304C\\u306A\\u3068", NULL, PANGO_SCRIPT_HIRAGANA }, - { "\\u30AB\\u30BF\\u30AB\\u30CA", NULL, PANGO_SCRIPT_KATAKANA }, - { "\\U00010400\\U00010401\\U00010402\\U00010403", NULL, PANGO_SCRIPT_DESERET } + { "\\u0020\\u0946\\u0939\\u093F\\u0928\\u094D\\u0926\\u0940\\u0020", NULL, G_UNICODE_SCRIPT_DEVANAGARI }, + { "\\u0627\\u0644\\u0639\\u0631\\u0628\\u064A\\u0629\\u0020", NULL, G_UNICODE_SCRIPT_ARABIC }, + { "\\u0420\\u0443\\u0441\\u0441\\u043A\\u0438\\u0439\\u0020", NULL, G_UNICODE_SCRIPT_CYRILLIC }, + { "English (", NULL, G_UNICODE_SCRIPT_LATIN }, + { "\\u0E44\\u0E17\\u0E22", NULL, G_UNICODE_SCRIPT_THAI }, + { ") ", NULL, G_UNICODE_SCRIPT_LATIN }, + { "\\u6F22\\u5B75", NULL, G_UNICODE_SCRIPT_HAN }, + { "\\u3068\\u3072\\u3089\\u304C\\u306A\\u3068", NULL, G_UNICODE_SCRIPT_HIRAGANA }, + { "\\u30AB\\u30BF\\u30AB\\u30CA", NULL, G_UNICODE_SCRIPT_KATAKANA }, + { "\\U00010400\\U00010401\\U00010402\\U00010403", NULL, G_UNICODE_SCRIPT_DESERET } }; PangoScriptIter *iter; @@ -148,7 +148,7 @@ test_script_iter (void) char *pos; const char *start; const char *end; - PangoScript script; + GUnicodeScript script; unsigned int i; for (i = 0; i < G_N_ELEMENTS(test_data); i++) @@ -204,7 +204,7 @@ test_script_iter (void) g_assert_true (start == all->str); g_assert_true (end == all->str); - g_assert_true (script == PANGO_SCRIPT_COMMON); + g_assert_true (script == G_UNICODE_SCRIPT_COMMON); g_assert_true (!pango_script_iter_next (iter)); pango_script_iter_free (iter); |