summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.pre-1-05
-rw-r--r--ChangeLog.pre-1-105
-rw-r--r--ChangeLog.pre-1-25
-rw-r--r--ChangeLog.pre-1-45
-rw-r--r--ChangeLog.pre-1-65
-rw-r--r--ChangeLog.pre-1-85
-rw-r--r--pango/pango-context.c10
-rw-r--r--pango/utils.c52
-rw-r--r--pango/utils.h2
10 files changed, 94 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index e495c272..e7eaf6e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Apr 4 12:01:37 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/utils.[ch] pango/pango-context.c: fribidi-0.1.9
+ wants UCS-4 not UCS2; switch accordingly.
+
Mon Apr 3 20:30:20 2000 Owen Taylor <otaylor@redhat.com>
* pango/mapping.c (pango_glyph_string_x_to_index): Fix handling
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index e495c272..e7eaf6e1 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,8 @@
+Tue Apr 4 12:01:37 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/utils.[ch] pango/pango-context.c: fribidi-0.1.9
+ wants UCS-4 not UCS2; switch accordingly.
+
Mon Apr 3 20:30:20 2000 Owen Taylor <otaylor@redhat.com>
* pango/mapping.c (pango_glyph_string_x_to_index): Fix handling
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index e495c272..e7eaf6e1 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,8 @@
+Tue Apr 4 12:01:37 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/utils.[ch] pango/pango-context.c: fribidi-0.1.9
+ wants UCS-4 not UCS2; switch accordingly.
+
Mon Apr 3 20:30:20 2000 Owen Taylor <otaylor@redhat.com>
* pango/mapping.c (pango_glyph_string_x_to_index): Fix handling
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index e495c272..e7eaf6e1 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,8 @@
+Tue Apr 4 12:01:37 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/utils.[ch] pango/pango-context.c: fribidi-0.1.9
+ wants UCS-4 not UCS2; switch accordingly.
+
Mon Apr 3 20:30:20 2000 Owen Taylor <otaylor@redhat.com>
* pango/mapping.c (pango_glyph_string_x_to_index): Fix handling
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index e495c272..e7eaf6e1 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,8 @@
+Tue Apr 4 12:01:37 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/utils.[ch] pango/pango-context.c: fribidi-0.1.9
+ wants UCS-4 not UCS2; switch accordingly.
+
Mon Apr 3 20:30:20 2000 Owen Taylor <otaylor@redhat.com>
* pango/mapping.c (pango_glyph_string_x_to_index): Fix handling
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index e495c272..e7eaf6e1 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,8 @@
+Tue Apr 4 12:01:37 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/utils.[ch] pango/pango-context.c: fribidi-0.1.9
+ wants UCS-4 not UCS2; switch accordingly.
+
Mon Apr 3 20:30:20 2000 Owen Taylor <otaylor@redhat.com>
* pango/mapping.c (pango_glyph_string_x_to_index): Fix handling
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index e495c272..e7eaf6e1 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,8 @@
+Tue Apr 4 12:01:37 2000 Owen Taylor <otaylor@redhat.com>
+
+ * pango/utils.[ch] pango/pango-context.c: fribidi-0.1.9
+ wants UCS-4 not UCS2; switch accordingly.
+
Mon Apr 3 20:30:20 2000 Owen Taylor <otaylor@redhat.com>
* pango/mapping.c (pango_glyph_string_x_to_index): Fix handling
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 5343ab27..95c5bab2 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -473,7 +473,7 @@ pango_itemize (PangoContext *context,
int length,
PangoAttrList *attrs)
{
- guint16 *text_ucs2;
+ GUChar4 *text_ucs4;
gint n_chars;
guint8 *embedding_levels;
FriBidiCharType base_dir;
@@ -506,8 +506,8 @@ pango_itemize (PangoContext *context,
/* First, apply the bidirectional algorithm to break
* the text into directional runs.
*/
- text_ucs2 = _pango_utf8_to_ucs2 (text, length);
- if (!text_ucs2)
+ text_ucs4 = _pango_utf8_to_ucs4 (text, length);
+ if (!text_ucs4)
return NULL;
n_chars = unicode_strlen (text, length);
@@ -522,7 +522,7 @@ pango_itemize (PangoContext *context,
fonts = g_new0 (PangoFont *, n_chars);
extra_attr_lists = g_new0 (GSList *, n_chars);
- fribidi_log2vis_get_embedding_levels (text_ucs2, n_chars, &base_dir,
+ fribidi_log2vis_get_embedding_levels (text_ucs4, n_chars, &base_dir,
embedding_levels);
/* Now, fill in the appropriate shapers, language engines and fonts for
@@ -595,7 +595,7 @@ pango_itemize (PangoContext *context,
g_free (fonts);
g_free (extra_attr_lists);
- g_free (text_ucs2);
+ g_free (text_ucs4);
return g_list_reverse (result);
}
diff --git a/pango/utils.c b/pango/utils.c
index b9795ffb..5a04ccc7 100644
--- a/pango/utils.c
+++ b/pango/utils.c
@@ -153,6 +153,58 @@ _pango_utf8_to_ucs2 (const char *str, int len)
}
+#ifdef __GLIBC__
+# define UCS4_CHARSET "UNICODELITTLE"
+#else
+# if G_BYTE_ORDER == G_LITTLE_ENDIAN
+# define UCS4_CHARSET "UCS-4-LE"
+# else
+# define UCS4_CHARSET "UCS-4-BE"
+# endif
+#endif
+
+GUChar4 *
+_pango_utf8_to_ucs4 (const char *str, int len)
+{
+ iconv_t cd;
+ char *outbuf, *result;
+ const char *inbuf;
+ size_t inbytesleft;
+ size_t outbytesleft;
+ gint outlen;
+
+ gint count;
+
+ cd = iconv_open (UCS4_CHARSET, "UTF-8");
+
+ if (cd == (iconv_t)-1)
+ g_error ("No converter from UTF-8 to " UCS4_CHARSET);
+
+ if (len < 0)
+ len = strlen (str);
+
+ outlen = unicode_strlen (str, len) * sizeof(GUChar4);
+ result = g_malloc (outlen);
+
+ inbuf = str;
+ inbytesleft = len;
+ outbuf = result;
+ outbytesleft = outlen;
+
+ count = iconv (cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
+
+ if (count < 0 && (errno != E2BIG))
+ {
+ g_free (result);
+ result = NULL;
+ }
+
+ iconv_close (cd);
+
+ return (GUChar4 *)result;
+
+}
+
/**
* _pango_guchar4_to_utf8:
* @ch: a ISO10646 character code
diff --git a/pango/utils.h b/pango/utils.h
index d46d44ba..9cf40dbb 100644
--- a/pango/utils.h
+++ b/pango/utils.h
@@ -32,6 +32,8 @@ gboolean _pango_utf8_iterate (const char *cur,
GUChar4 *wc_out);
GUChar2 *_pango_utf8_to_ucs2 (const char *str,
gint len);
+GUChar4 *_pango_utf8_to_ucs4 (const char *str,
+ int len);
int _pango_guchar4_to_utf8 (GUChar4 c,
char *outbuf);
int _pango_utf8_len (const char *str,