summaryrefslogtreecommitdiff
path: root/pango/pango-ot-tag.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-08-21 02:54:05 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-08-21 02:54:05 +0000
commit7c1a1c9db2cbbca42ff1e8afb2050df2a40a6854 (patch)
treec087d420438b3231a6e6c4b6b5bd866a12f3a251 /pango/pango-ot-tag.c
parent22b8a1913a9e862e5d20e90c3b9ca50d37a214b1 (diff)
downloadpango-7c1a1c9db2cbbca42ff1e8afb2050df2a40a6854.tar.gz
Bug 348348 – Add a way to get the script name of a gunichar
2007-08-20 Behdad Esfahbod <behdad@gnome.org> Bug 348348 – Add a way to get the script name of a gunichar * configure.in: Require glib 2.14, for GUnicodeScript stuff. * docs/tmpl/scripts.sgml: Document that #PangoScript is interchangeable with GUnicodeScript. * pango/pango-script.c (pango_script_for_unichar): Use g_unichar_get_script(), and document it. * tools/Makefile.am: * tools/gen-script-table.pl: * pango/Makefile.am: * pango/pango-script-table.h: Remove pango-script-table.h and its generator. * pango/pango-gravity.c (get_script_properties): * pango/pango-language.c (pango_script_get_sample_language): * pango/pango-ot-tag.c (pango_ot_tag_from_script): Protect against unexpected script values. svn path=/trunk/; revision=2406
Diffstat (limited to 'pango/pango-ot-tag.c')
-rw-r--r--pango/pango-ot-tag.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pango/pango-ot-tag.c b/pango/pango-ot-tag.c
index e12d8f4e..ce02148b 100644
--- a/pango/pango-ot-tag.c
+++ b/pango/pango-ot-tag.c
@@ -125,7 +125,10 @@ static const Tag ot_scripts[] = {
PangoOTTag
pango_ot_tag_from_script (PangoScript script)
{
- g_return_val_if_fail (script >= 0 && (guint)script < G_N_ELEMENTS (ot_scripts), PANGO_OT_TAG_DEFAULT_SCRIPT);
+ g_return_val_if_fail (script >= 0, PANGO_OT_TAG_DEFAULT_SCRIPT);
+
+ if ((guint)script >= G_N_ELEMENTS (ot_scripts))
+ return PANGO_OT_TAG_DEFAULT_SCRIPT;
return GUINT32_FROM_BE (ot_scripts[script].integer);
}