summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-03-20 20:07:27 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-03-20 20:07:27 +0000
commite74e8dd104a88fcecac3ddc40f30f291a052d739 (patch)
treed39fd7ff56dc875a4928910203387b3cb55475da
parent4b35e1039d51eb17ba30cd83639b6c377176d57d (diff)
downloadpango-e74e8dd104a88fcecac3ddc40f30f291a052d739.tar.gz
When loading an iconv converter fails, recover gracefully and warn rather
Wed Mar 20 14:57:48 2002 Owen Taylor <otaylor@redhat.com> * modules/basic/basic-x.c modules/basic/tables-{big,small}.i: When loading an iconv converter fails, recover gracefully and warn rather than aborting. (#73861, report about problems on IRIX from Soeren Sandmann)
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.pre-1-107
-rw-r--r--ChangeLog.pre-1-27
-rw-r--r--ChangeLog.pre-1-47
-rw-r--r--ChangeLog.pre-1-67
-rw-r--r--ChangeLog.pre-1-87
-rw-r--r--modules/basic/basic-x.c68
-rw-r--r--modules/basic/tables-big.i4
-rw-r--r--modules/basic/tables-small.i4
9 files changed, 78 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a6586f0..c031ae4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Mar 20 14:57:48 2002 Owen Taylor <otaylor@redhat.com>
+
+ * modules/basic/basic-x.c modules/basic/tables-{big,small}.i:
+ When loading an iconv converter fails, recover gracefully
+ and warn rather than aborting. (#73861, report about problems
+ on IRIX from Soeren Sandmann)
+
2002-03-18 Changwoo Ryu <cwryu@debian.org>
* modules/basic/tables-big.i: Enabled ksc5601 fonts for the Hangul
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 7a6586f0..c031ae4a 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,10 @@
+Wed Mar 20 14:57:48 2002 Owen Taylor <otaylor@redhat.com>
+
+ * modules/basic/basic-x.c modules/basic/tables-{big,small}.i:
+ When loading an iconv converter fails, recover gracefully
+ and warn rather than aborting. (#73861, report about problems
+ on IRIX from Soeren Sandmann)
+
2002-03-18 Changwoo Ryu <cwryu@debian.org>
* modules/basic/tables-big.i: Enabled ksc5601 fonts for the Hangul
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 7a6586f0..c031ae4a 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,10 @@
+Wed Mar 20 14:57:48 2002 Owen Taylor <otaylor@redhat.com>
+
+ * modules/basic/basic-x.c modules/basic/tables-{big,small}.i:
+ When loading an iconv converter fails, recover gracefully
+ and warn rather than aborting. (#73861, report about problems
+ on IRIX from Soeren Sandmann)
+
2002-03-18 Changwoo Ryu <cwryu@debian.org>
* modules/basic/tables-big.i: Enabled ksc5601 fonts for the Hangul
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 7a6586f0..c031ae4a 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,10 @@
+Wed Mar 20 14:57:48 2002 Owen Taylor <otaylor@redhat.com>
+
+ * modules/basic/basic-x.c modules/basic/tables-{big,small}.i:
+ When loading an iconv converter fails, recover gracefully
+ and warn rather than aborting. (#73861, report about problems
+ on IRIX from Soeren Sandmann)
+
2002-03-18 Changwoo Ryu <cwryu@debian.org>
* modules/basic/tables-big.i: Enabled ksc5601 fonts for the Hangul
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 7a6586f0..c031ae4a 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,10 @@
+Wed Mar 20 14:57:48 2002 Owen Taylor <otaylor@redhat.com>
+
+ * modules/basic/basic-x.c modules/basic/tables-{big,small}.i:
+ When loading an iconv converter fails, recover gracefully
+ and warn rather than aborting. (#73861, report about problems
+ on IRIX from Soeren Sandmann)
+
2002-03-18 Changwoo Ryu <cwryu@debian.org>
* modules/basic/tables-big.i: Enabled ksc5601 fonts for the Hangul
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 7a6586f0..c031ae4a 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,10 @@
+Wed Mar 20 14:57:48 2002 Owen Taylor <otaylor@redhat.com>
+
+ * modules/basic/basic-x.c modules/basic/tables-{big,small}.i:
+ When loading an iconv converter fails, recover gracefully
+ and warn rather than aborting. (#73861, report about problems
+ on IRIX from Soeren Sandmann)
+
2002-03-18 Changwoo Ryu <cwryu@debian.org>
* modules/basic/tables-big.i: Enabled ksc5601 fonts for the Hangul
diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c
index ce49a6cd..6e92531b 100644
--- a/modules/basic/basic-x.c
+++ b/modules/basic/basic-x.c
@@ -52,7 +52,7 @@ typedef struct _CharCachePointer CharCachePointer;
typedef struct _MaskTable MaskTable;
typedef PangoGlyph (*ConvFunc) (CharCache *cache,
- Charset *charset,
+ GIConv cd,
const gchar *input);
#define MAX_CHARSETS 32
@@ -103,16 +103,16 @@ struct _CharCachePointer
};
static PangoGlyph conv_8bit (CharCache *cache,
- Charset *charset,
+ GIConv cd,
const char *input);
static PangoGlyph conv_eucjp (CharCache *cache,
- Charset *charset,
+ GIConv cd,
const char *input);
static PangoGlyph conv_16bit (CharCache *cache,
- Charset *charset,
+ GIConv cd,
const char *input);
static PangoGlyph conv_ucs4 (CharCache *cache,
- Charset *charset,
+ GIConv cd,
const char *input);
#include "tables-big.i"
@@ -271,13 +271,32 @@ find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input)
{
PangoGlyph index;
PangoGlyph glyph;
+ Charset *charset;
- index = (*mask_table->charsets[i]->conv_func) (cache, mask_table->charsets[i], input);
+ charset = mask_table->charsets[i];
+ if (charset)
+ {
+ GIConv cd = cache->converters[charset->index];
- glyph = PANGO_X_MAKE_GLYPH (mask_table->subfonts[i], index);
+ if (charset->id && cd == (GIConv)-1)
+ {
+ cd = g_iconv_open (charset->id, "UTF-8");
+ if (cd == (GIConv)-1)
+ {
+ g_warning ("Could not load converter from %s to UTF-8", charset->id);
+ mask_table->charsets[i] = NULL;
+ continue;
+ }
+
+ cache->converters[charset->index] = cd;
+ }
+
+ index = (*charset->conv_func) (cache, cd, input);
+ glyph = PANGO_X_MAKE_GLYPH (mask_table->subfonts[i], index);
- if (pango_x_has_glyph (font, glyph))
- return glyph;
+ if (pango_x_has_glyph (font, glyph))
+ return glyph;
+ }
}
return 0;
@@ -299,26 +318,11 @@ set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGl
glyphs->glyphs[i].geometry.width = logical_rect.width;
}
-static GIConv
-find_converter (CharCache *cache, Charset *charset)
-{
- GIConv cd = cache->converters[charset->index];
- if (cd == (GIConv)-1)
- {
- cd = g_iconv_open (charset->id, "UTF-8");
- g_assert (cd != (GIConv)-1);
- cache->converters[charset->index] = cd;
- }
-
- return cd;
-}
-
static PangoGlyph
conv_8bit (CharCache *cache,
- Charset *charset,
+ GIConv cd,
const char *input)
{
- GIConv cd;
char outbuf;
const char *inptr = input;
@@ -328,8 +332,6 @@ conv_8bit (CharCache *cache,
inbytesleft = g_utf8_next_char (input) - input;
- cd = find_converter (cache, charset);
-
g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
return (guchar)outbuf;
@@ -337,10 +339,9 @@ conv_8bit (CharCache *cache,
static PangoGlyph
conv_eucjp (CharCache *cache,
- Charset *charset,
+ GIConv cd,
const char *input)
{
- GIConv cd;
char outbuf[4];
const char *inptr = input;
@@ -350,8 +351,6 @@ conv_eucjp (CharCache *cache,
inbytesleft = g_utf8_next_char (input) - input;
- cd = find_converter (cache, charset);
-
g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
if ((guchar)outbuf[0] < 128)
@@ -366,10 +365,9 @@ conv_eucjp (CharCache *cache,
static PangoGlyph
conv_16bit (CharCache *cache,
- Charset *charset,
+ GIConv cd,
const char *input)
{
- GIConv cd;
char outbuf[2];
const char *inptr = input;
@@ -379,8 +377,6 @@ conv_16bit (CharCache *cache,
inbytesleft = g_utf8_next_char (input) - input;
- cd = find_converter (cache, charset);
-
g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
if ((guchar)outbuf[0] < 128)
@@ -391,7 +387,7 @@ conv_16bit (CharCache *cache,
static PangoGlyph
conv_ucs4 (CharCache *cache,
- Charset *charset,
+ GIConv cd,
const char *input)
{
return g_utf8_get_char (input);
diff --git a/modules/basic/tables-big.i b/modules/basic/tables-big.i
index 97ada990..535b684e 100644
--- a/modules/basic/tables-big.i
+++ b/modules/basic/tables-big.i
@@ -24,7 +24,7 @@ enum {
};
Charset charsets[] = {
- { 0, "ISO-8859-1", "iso8859-1", conv_ucs4 },
+ { 0, NULL, "iso8859-1", conv_ucs4 },
{ 1, "ISO-8859-2", "iso8859-2", conv_8bit },
{ 2, "ISO-8859-3", "iso8859-3", conv_8bit },
{ 3, "ISO-8859-4", "iso8859-4", conv_8bit },
@@ -45,7 +45,7 @@ Charset charsets[] = {
{ 18, "EUC-JP", "jisx0201.1976-0", conv_eucjp },
{ 19, "EUC-JP", "jisx0212.1990-0", conv_eucjp },
{ 20, "BIG5", "big5-0", conv_16bit },
- { 21, "ISO-10646", "iso10646-1", conv_ucs4 }
+ { 21, NULL, "iso10646-1", conv_ucs4 }
};
CharsetOrdering charset_orderings[] = {
diff --git a/modules/basic/tables-small.i b/modules/basic/tables-small.i
index dc7be3e1..c626913b 100644
--- a/modules/basic/tables-small.i
+++ b/modules/basic/tables-small.i
@@ -15,7 +15,7 @@ enum {
};
Charset charsets[] = {
- { 0, "ISO-8859-1", "iso8859-1", conv_ucs4 },
+ { 0, NULL, "iso8859-1", conv_ucs4 },
{ 1, "ISO-8859-2", "iso8859-2", conv_8bit },
{ 2, "ISO-8859-3", "iso8859-3", conv_8bit },
{ 3, "ISO-8859-4", "iso8859-4", conv_8bit },
@@ -24,7 +24,7 @@ Charset charsets[] = {
{ 6, "ISO-8859-7", "iso8859-7", conv_8bit },
{ 7, "ISO-8859-8", "iso8859-8", conv_8bit },
{ 8, "ISO-8859-9", "iso8859-9", conv_8bit },
- { 9, "ISO-10646", "iso10646-1", conv_ucs4 }
+ { 9, NULL, "iso10646-1", conv_ucs4 }
};
static PangoEngineRange basic_ranges[] = {