summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2004-07-14 21:47:18 +0000
committerOwen Taylor <otaylor@src.gnome.org>2004-07-14 21:47:18 +0000
commite5c9e78492b389b35301d56dea3788e6bc0211ab (patch)
treecf41272f3c135146cdb4819a0c420cb719fcb396
parent15d46e0d6a6b9b7b983e2a5ef9315091c87f2d29 (diff)
downloadpango-e5c9e78492b389b35301d56dea3788e6bc0211ab.tar.gz
Fix problem when we only figured out latin script for 'en' not for
Wed Jul 14 17:42:49 2004 Owen Taylor <otaylor@redhat.com> * pango/pango-script.c (pango_language_includes_script): Fix problem when we only figured out latin script for 'en' not for 'en-us'. Fix reversed arguments to bsearch.
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.pre-1-106
-rw-r--r--ChangeLog.pre-1-66
-rw-r--r--ChangeLog.pre-1-86
-rw-r--r--pango/pango-script.c33
5 files changed, 52 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 914683b6..96096afc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Jul 14 17:42:49 2004 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-script.c (pango_language_includes_script):
+ Fix problem when we only figured out latin script for 'en'
+ not for 'en-us'. Fix reversed arguments to bsearch.
+
Tue Jul 13 10:07:44 2004 Owen Taylor <otaylor@redhat.com>
* pango/Makefile.am: Reverse order of pangoft2/pangoxft
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 914683b6..96096afc 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,9 @@
+Wed Jul 14 17:42:49 2004 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-script.c (pango_language_includes_script):
+ Fix problem when we only figured out latin script for 'en'
+ not for 'en-us'. Fix reversed arguments to bsearch.
+
Tue Jul 13 10:07:44 2004 Owen Taylor <otaylor@redhat.com>
* pango/Makefile.am: Reverse order of pangoft2/pangoxft
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 914683b6..96096afc 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,9 @@
+Wed Jul 14 17:42:49 2004 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-script.c (pango_language_includes_script):
+ Fix problem when we only figured out latin script for 'en'
+ not for 'en-us'. Fix reversed arguments to bsearch.
+
Tue Jul 13 10:07:44 2004 Owen Taylor <otaylor@redhat.com>
* pango/Makefile.am: Reverse order of pangoft2/pangoxft
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 914683b6..96096afc 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,9 @@
+Wed Jul 14 17:42:49 2004 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pango-script.c (pango_language_includes_script):
+ Fix problem when we only figured out latin script for 'en'
+ not for 'en-us'. Fix reversed arguments to bsearch.
+
Tue Jul 13 10:07:44 2004 Owen Taylor <otaylor@redhat.com>
* pango/Makefile.am: Reverse order of pangoft2/pangoxft
diff --git a/pango/pango-script.c b/pango/pango-script.c
index b5045c42..68814984 100644
--- a/pango/pango-script.c
+++ b/pango/pango-script.c
@@ -351,15 +351,38 @@ pango_script_iter_next (PangoScriptIter *iter)
#include "pango-script-lang-table.h"
+/* The fact that this comparison function works is dependent
+ * on a property of the pango_script_lang_table which accidental rather
+ * than inherent.
+ *
+ * The property is if we take any element in the table and suffix it
+ * <elem>-<suffix> then that must strcmp() between any elements
+ * preceding the element in the table and any element following in the
+ * table. So, if we had something like:
+ *
+ * 'zh'
+ *' zh-cn'
+ *
+ * in the table we would have a problem since 'zh-tw' follows 'zh-cn'.
+ * On the other hand:
+ *
+ * 'zh'
+ * 'zha'
+ *
+ * Works because 'zh-tw' precedes 'zha'.
+ */
static int
script_for_lang_compare (gconstpointer key,
gconstpointer member)
{
- const char *lang = key;
+ PangoLanguage *lang = (PangoLanguage *)key;
const PangoScriptForLang *script_for_lang = member;
-
- return strcmp (lang,
- pango_language_to_string (script_for_lang->lang));
+
+ if (pango_language_matches (lang, script_for_lang->lang))
+ return 0;
+ else
+ return strcmp (pango_language_to_string (lang),
+ script_for_lang->lang);
}
/**
@@ -398,8 +421,8 @@ pango_language_includes_script (PangoLanguage *language,
*/
script_for_lang = bsearch (pango_language_to_string (language),
pango_script_for_lang,
- sizeof (PangoScriptForLang),
G_N_ELEMENTS (pango_script_for_lang),
+ sizeof (PangoScriptForLang),
script_for_lang_compare);
if (!script_for_lang)
return TRUE;