summaryrefslogtreecommitdiff
path: root/pango/pango-script.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-script.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-script.c')
-rw-r--r--pango/pango-script.c36
1 files changed, 4 insertions, 32 deletions
diff --git a/pango/pango-script.c b/pango/pango-script.c
index 3f8dadb7..09e7605b 100644
--- a/pango/pango-script.c
+++ b/pango/pango-script.c
@@ -58,7 +58,6 @@
#include <string.h>
#include "pango-script.h"
-#include "pango-script-table.h"
#define PAREN_STACK_DEPTH 128
@@ -83,33 +82,6 @@ struct _PangoScriptIter
int paren_sp;
};
-#define PANGO_SCRIPT_TABLE_MIDPOINT (G_N_ELEMENTS (pango_script_table) / 2)
-
-static inline PangoScript
-pango_script_for_unichar_bsearch (gunichar ch)
-{
- int lower = 0;
- int upper = G_N_ELEMENTS (pango_script_table) - 1;
- static int saved_mid = PANGO_SCRIPT_TABLE_MIDPOINT;
- int mid = saved_mid;
-
-
- do
- {
- if (ch < pango_script_table[mid].start)
- upper = mid - 1;
- else if (ch >= pango_script_table[mid].start + pango_script_table[mid].chars)
- lower = mid + 1;
- else
- return pango_script_table[saved_mid = mid].script;
-
- mid = (lower + upper) / 2;
- }
- while (lower <= upper);
-
- return PANGO_SCRIPT_UNKNOWN;
-}
-
/**
* pango_script_for_unichar:
* @ch: a Unicode character
@@ -119,6 +91,9 @@ pango_script_for_unichar_bsearch (gunichar ch)
* valid Unicode character; if you pass in invalid character, the
* result is undefined.
*
+ * As of Pango 1.18, this function simply returns the return value of
+ * g_unichar_get_script().
+ *
* Return value: the #PangoScript for the character.
*
* Since: 1.4
@@ -126,10 +101,7 @@ pango_script_for_unichar_bsearch (gunichar ch)
PangoScript
pango_script_for_unichar (gunichar ch)
{
- if (ch < G_N_ELEMENTS (pango_script_easy_table))
- return pango_script_easy_table[ch];
- else
- return pango_script_for_unichar_bsearch (ch);
+ return g_unichar_get_script (ch);
}
/**********************************************************************/