diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-02-01 18:52:17 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-02-01 18:52:17 +0000 |
commit | 82d8346691a72e4dd37a1e3999a939be269df32d (patch) | |
tree | 644477eb228b5e7f96460ae3e94bd718006d8937 | |
parent | 532c6902c34f47d5f838623c951e53d5fcdd395f (diff) | |
download | pango-82d8346691a72e4dd37a1e3999a939be269df32d.tar.gz |
Conditionally define G_N_ELEMENTS() when using glib-1.3.
Wed Feb 2 11:12:12 2000 Owen Taylor <otaylor@redhat.com>
* libpango/pango-types.h: Conditionally define G_N_ELEMENTS() when
using glib-1.3.
* modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c:
Replace MEMBERS() with G_N_ELEMENTS().
* libpango/pango-engine.h: Added a get_coverage() function
to the PangoEngineShape vtable.
* modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c:
Added get_coverage() functions. The basic.c one is incredibly
inefficient (but caching may make that matter that much).
The Hangul one needs checking.
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | ChangeLog.pre-1-0 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-1-2 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-1-4 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-1-6 | 16 | ||||
-rw-r--r-- | ChangeLog.pre-1-8 | 16 | ||||
-rw-r--r-- | modules/basic/basic-x.c | 147 | ||||
-rw-r--r-- | modules/basic/basic.c | 147 | ||||
-rw-r--r-- | modules/hangul/hangul-x.c | 111 | ||||
-rw-r--r-- | modules/hangul/hangul.c | 111 | ||||
-rw-r--r-- | modules/tamil/tamil-x.c | 54 | ||||
-rw-r--r-- | modules/tamil/tamil.c | 54 | ||||
-rw-r--r-- | pango/pango-engine.h | 6 | ||||
-rw-r--r-- | pango/pango-types.h | 7 | ||||
-rw-r--r-- | pango/pangox.c | 4 | ||||
-rw-r--r-- | pango/utils.c | 22 | ||||
-rw-r--r-- | pango/utils.h | 6 |
18 files changed, 561 insertions, 220 deletions
@@ -1,3 +1,19 @@ +Wed Feb 2 11:12:12 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/pango-types.h: Conditionally define G_N_ELEMENTS() when + using glib-1.3. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Replace MEMBERS() with G_N_ELEMENTS(). + + * libpango/pango-engine.h: Added a get_coverage() function + to the PangoEngineShape vtable. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Added get_coverage() functions. The basic.c one is incredibly + inefficient (but caching may make that matter that much). + The Hangul one needs checking. + Wed Feb 2 00:07:13 2000 Owen Taylor <otaylor@redhat.com> * libpango/pango-*.h: The great header file reorganization. diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0 index 2bc2292c..535243ba 100644 --- a/ChangeLog.pre-1-0 +++ b/ChangeLog.pre-1-0 @@ -1,3 +1,19 @@ +Wed Feb 2 11:12:12 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/pango-types.h: Conditionally define G_N_ELEMENTS() when + using glib-1.3. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Replace MEMBERS() with G_N_ELEMENTS(). + + * libpango/pango-engine.h: Added a get_coverage() function + to the PangoEngineShape vtable. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Added get_coverage() functions. The basic.c one is incredibly + inefficient (but caching may make that matter that much). + The Hangul one needs checking. + Wed Feb 2 00:07:13 2000 Owen Taylor <otaylor@redhat.com> * libpango/pango-*.h: The great header file reorganization. diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 2bc2292c..535243ba 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,19 @@ +Wed Feb 2 11:12:12 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/pango-types.h: Conditionally define G_N_ELEMENTS() when + using glib-1.3. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Replace MEMBERS() with G_N_ELEMENTS(). + + * libpango/pango-engine.h: Added a get_coverage() function + to the PangoEngineShape vtable. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Added get_coverage() functions. The basic.c one is incredibly + inefficient (but caching may make that matter that much). + The Hangul one needs checking. + Wed Feb 2 00:07:13 2000 Owen Taylor <otaylor@redhat.com> * libpango/pango-*.h: The great header file reorganization. diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2 index 2bc2292c..535243ba 100644 --- a/ChangeLog.pre-1-2 +++ b/ChangeLog.pre-1-2 @@ -1,3 +1,19 @@ +Wed Feb 2 11:12:12 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/pango-types.h: Conditionally define G_N_ELEMENTS() when + using glib-1.3. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Replace MEMBERS() with G_N_ELEMENTS(). + + * libpango/pango-engine.h: Added a get_coverage() function + to the PangoEngineShape vtable. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Added get_coverage() functions. The basic.c one is incredibly + inefficient (but caching may make that matter that much). + The Hangul one needs checking. + Wed Feb 2 00:07:13 2000 Owen Taylor <otaylor@redhat.com> * libpango/pango-*.h: The great header file reorganization. diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index 2bc2292c..535243ba 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,19 @@ +Wed Feb 2 11:12:12 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/pango-types.h: Conditionally define G_N_ELEMENTS() when + using glib-1.3. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Replace MEMBERS() with G_N_ELEMENTS(). + + * libpango/pango-engine.h: Added a get_coverage() function + to the PangoEngineShape vtable. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Added get_coverage() functions. The basic.c one is incredibly + inefficient (but caching may make that matter that much). + The Hangul one needs checking. + Wed Feb 2 00:07:13 2000 Owen Taylor <otaylor@redhat.com> * libpango/pango-*.h: The great header file reorganization. diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index 2bc2292c..535243ba 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,19 @@ +Wed Feb 2 11:12:12 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/pango-types.h: Conditionally define G_N_ELEMENTS() when + using glib-1.3. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Replace MEMBERS() with G_N_ELEMENTS(). + + * libpango/pango-engine.h: Added a get_coverage() function + to the PangoEngineShape vtable. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Added get_coverage() functions. The basic.c one is incredibly + inefficient (but caching may make that matter that much). + The Hangul one needs checking. + Wed Feb 2 00:07:13 2000 Owen Taylor <otaylor@redhat.com> * libpango/pango-*.h: The great header file reorganization. diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index 2bc2292c..535243ba 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,19 @@ +Wed Feb 2 11:12:12 2000 Owen Taylor <otaylor@redhat.com> + + * libpango/pango-types.h: Conditionally define G_N_ELEMENTS() when + using glib-1.3. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Replace MEMBERS() with G_N_ELEMENTS(). + + * libpango/pango-engine.h: Added a get_coverage() function + to the PangoEngineShape vtable. + + * modules/basic/basic.c modules/hangul/hangul.c modules/tamil/tamil.c: + Added get_coverage() functions. The basic.c one is incredibly + inefficient (but caching may make that matter that much). + The Hangul one needs checking. + Wed Feb 2 00:07:13 2000 Owen Taylor <otaylor@redhat.com> * libpango/pango-*.h: The great header file reorganization. diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c index e82d15bf..7f62ebcb 100644 --- a/modules/basic/basic-x.c +++ b/modules/basic/basic-x.c @@ -28,21 +28,19 @@ #include <unicode.h> #include <fribidi/fribidi.h> -#define MEMBERS(strct) sizeof(strct) / sizeof(strct[1]) - typedef struct _CharRange CharRange; typedef struct _Charset Charset; typedef struct _CharCache CharCache; typedef struct _MaskTable MaskTable; -typedef PangoGlyph (*ConvFunc) (CharCache *cache, - gchar *id, - gchar *input); +typedef PangoGlyph (*ConvFunc) (CharCache *cache, + const char *id, + const gchar *input); struct _Charset { - gchar *id; - gchar *x_charset; + char *id; + char *x_charset; ConvFunc conv_func; }; @@ -70,14 +68,14 @@ struct _CharCache }; static PangoGlyph conv_8bit (CharCache *cache, - gchar *id, - char *input); -static PangoGlyph conv_euc (CharCache *cache, - gchar *id, - char *input); -static PangoGlyph conv_ucs4 (CharCache *cache, - gchar *id, - char *input); + const char *id, + const char *input); +static PangoGlyph conv_euc (CharCache *cache, + const char *id, + const char *input); +static PangoGlyph conv_ucs4 (CharCache *cache, + const char *id, + const char *input); #include "tables-big.i" @@ -86,27 +84,27 @@ static PangoEngineInfo script_engines[] = { "BasicScriptEngineLang", PANGO_ENGINE_TYPE_LANG, PANGO_RENDER_TYPE_NONE, - basic_ranges, MEMBERS(basic_ranges) + basic_ranges, G_N_ELEMENTS(basic_ranges) }, { "BasicScriptEngineX", PANGO_ENGINE_TYPE_SHAPE, PANGO_RENDER_TYPE_X, - basic_ranges, MEMBERS(basic_ranges) + basic_ranges, G_N_ELEMENTS(basic_ranges) } }; -static gint n_script_engines = MEMBERS (script_engines); +static gint n_script_engines = G_N_ELEMENTS (script_engines); /* * Language script engine */ static void -basic_engine_break (gchar *text, - gint len, - PangoAnalysis *analysis, - PangoLogAttr *attrs) +basic_engine_break (const char *text, + gint len, + PangoAnalysis *analysis, + PangoLogAttr *attrs) { } @@ -135,7 +133,7 @@ find_char_mask (GUChar4 wc) int start, end, middle; start = 0; - end = MEMBERS(ranges) - 1; + end = G_N_ELEMENTS(ranges) - 1; if (ranges[start].start > wc || ranges[end].end < wc) return 0; @@ -207,7 +205,7 @@ char_cache_free (CharCache *cache) } PangoGlyph -find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) +find_char (CharCache *cache, PangoFont *font, GUChar4 wc, const char *input) { guint mask = find_char_mask (wc); GSList *tmp_list; @@ -227,8 +225,8 @@ find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) if (!tmp_list) { - char *charset_names[MEMBERS(charsets)]; - Charset *charsets_map[MEMBERS(charsets)]; + char *charset_names[G_N_ELEMENTS(charsets)]; + Charset *charsets_map[G_N_ELEMENTS(charsets)]; int n_charsets = 0; @@ -241,7 +239,7 @@ find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) /* Find the character sets that are included in this mask */ - for (i=0; i<MEMBERS(charsets); i++) + for (i=0; i<G_N_ELEMENTS(charsets); i++) { if (mask & (1 << i)) { @@ -297,7 +295,7 @@ set_glyph (PangoFont *font, PangoGlyphString *glyphs, gint i, PangoGlyph glyph) } static iconv_t -find_converter (CharCache *cache, gchar *id) +find_converter (CharCache *cache, const char *id) { iconv_t cd = g_hash_table_lookup (cache->converters, id); if (!cd) @@ -310,15 +308,15 @@ find_converter (CharCache *cache, gchar *id) } static PangoGlyph -conv_8bit (CharCache *cache, - gchar *id, - char *input) +conv_8bit (CharCache *cache, + const char *id, + const char *input) { iconv_t cd; char outbuf; - char *p; + const char *p; - char *inptr = input; + const char *inptr = input; int inbytesleft; char *outptr = &outbuf; int outbytesleft = 1; @@ -335,15 +333,15 @@ conv_8bit (CharCache *cache, } static PangoGlyph -conv_euc (CharCache *cache, - gchar *id, - char *input) +conv_euc (CharCache *cache, + const char *id, + const char *input) { iconv_t cd; char outbuf[2]; - char *p; + const char *p; - char *inptr = input; + const char *inptr = input; int inbytesleft; char *outptr = outbuf; int outbytesleft = 2; @@ -354,7 +352,7 @@ conv_euc (CharCache *cache, cd = find_converter (cache, id); g_assert (cd != (iconv_t)-1); - iconv (cd, (const char **)&inptr, &inbytesleft, &outptr, &outbytesleft); + iconv (cd, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((guchar)outbuf[0] < 128) return outbuf[0]; @@ -363,9 +361,9 @@ conv_euc (CharCache *cache, } static PangoGlyph -conv_ucs4 (CharCache *cache, - gchar *id, - char *input) +conv_ucs4 (CharCache *cache, + const char *id, + const char *input) { GUChar4 wc; @@ -393,16 +391,31 @@ swap_range (PangoGlyphString *glyphs, int start, int end) } } +static CharCache * +get_char_cache (PangoFont *font) +{ + CharCache *cache = pango_font_get_data (font, "basic-char-cache"); + if (!cache) + { + cache = char_cache_new (); + pango_font_set_data (font, "basic-char-cache", + cache, (GDestroyNotify)char_cache_free); + } + + return cache; +} + static void basic_engine_shape (PangoFont *font, - gchar *text, + const char *text, gint length, PangoAnalysis *analysis, PangoGlyphString *glyphs) { int n_chars; int i; - char *p, *next; + const char *p; + const char *next; PangoXSubfont fallback_subfont = 0; CharCache *cache; @@ -412,14 +425,8 @@ basic_engine_shape (PangoFont *font, g_return_if_fail (length >= 0); g_return_if_fail (analysis != NULL); - cache = pango_font_get_data (font, "basic-char-cache"); - if (!cache) - { - cache = char_cache_new (); - pango_font_set_data (font, "basic-char-cache", - cache, (GDestroyNotify)char_cache_free); - } - + cache = get_char_cache (font); + n_chars = unicode_strlen (text, length); pango_glyph_string_set_size (glyphs, n_chars); @@ -504,6 +511,41 @@ basic_engine_shape (PangoFont *font, } } +static PangoCoverage * +basic_engine_get_coverage (PangoFont *font, + const char *lang) +{ + CharCache *cache = get_char_cache (font); + PangoCoverage *result = pango_coverage_new (); + GUChar4 wc; + + iconv_t utf8_conv = (iconv_t)-1; + + if (utf8_conv == (iconv_t)-1) + { + utf8_conv = iconv_open ("utf-8", "ucs-4"); + if (utf8_conv == (iconv_t)-1) + g_error ("Could not open coverter from ucs-4 to utf-8!"); + } + + for (wc = 0; wc < 65536; wc++) + { + char buf[4]; + const char *inbuf = (const char *)&wc; + size_t inbytes_left = 4; + char *outbuf = buf; + size_t outbytes_left = 4; + + iconv (utf8_conv, &inbuf, &inbytes_left, &outbuf, &outbytes_left); + + if (find_char (cache, font, wc, buf)) + pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT); + + } + + return result; +} + static PangoEngine * basic_engine_x_new () { @@ -515,6 +557,7 @@ basic_engine_x_new () result->engine.type = PANGO_ENGINE_TYPE_LANG; result->engine.length = sizeof (result); result->script_shape = basic_engine_shape; + result->get_coverage = basic_engine_get_coverage; return (PangoEngine *)result; } diff --git a/modules/basic/basic.c b/modules/basic/basic.c index e82d15bf..7f62ebcb 100644 --- a/modules/basic/basic.c +++ b/modules/basic/basic.c @@ -28,21 +28,19 @@ #include <unicode.h> #include <fribidi/fribidi.h> -#define MEMBERS(strct) sizeof(strct) / sizeof(strct[1]) - typedef struct _CharRange CharRange; typedef struct _Charset Charset; typedef struct _CharCache CharCache; typedef struct _MaskTable MaskTable; -typedef PangoGlyph (*ConvFunc) (CharCache *cache, - gchar *id, - gchar *input); +typedef PangoGlyph (*ConvFunc) (CharCache *cache, + const char *id, + const gchar *input); struct _Charset { - gchar *id; - gchar *x_charset; + char *id; + char *x_charset; ConvFunc conv_func; }; @@ -70,14 +68,14 @@ struct _CharCache }; static PangoGlyph conv_8bit (CharCache *cache, - gchar *id, - char *input); -static PangoGlyph conv_euc (CharCache *cache, - gchar *id, - char *input); -static PangoGlyph conv_ucs4 (CharCache *cache, - gchar *id, - char *input); + const char *id, + const char *input); +static PangoGlyph conv_euc (CharCache *cache, + const char *id, + const char *input); +static PangoGlyph conv_ucs4 (CharCache *cache, + const char *id, + const char *input); #include "tables-big.i" @@ -86,27 +84,27 @@ static PangoEngineInfo script_engines[] = { "BasicScriptEngineLang", PANGO_ENGINE_TYPE_LANG, PANGO_RENDER_TYPE_NONE, - basic_ranges, MEMBERS(basic_ranges) + basic_ranges, G_N_ELEMENTS(basic_ranges) }, { "BasicScriptEngineX", PANGO_ENGINE_TYPE_SHAPE, PANGO_RENDER_TYPE_X, - basic_ranges, MEMBERS(basic_ranges) + basic_ranges, G_N_ELEMENTS(basic_ranges) } }; -static gint n_script_engines = MEMBERS (script_engines); +static gint n_script_engines = G_N_ELEMENTS (script_engines); /* * Language script engine */ static void -basic_engine_break (gchar *text, - gint len, - PangoAnalysis *analysis, - PangoLogAttr *attrs) +basic_engine_break (const char *text, + gint len, + PangoAnalysis *analysis, + PangoLogAttr *attrs) { } @@ -135,7 +133,7 @@ find_char_mask (GUChar4 wc) int start, end, middle; start = 0; - end = MEMBERS(ranges) - 1; + end = G_N_ELEMENTS(ranges) - 1; if (ranges[start].start > wc || ranges[end].end < wc) return 0; @@ -207,7 +205,7 @@ char_cache_free (CharCache *cache) } PangoGlyph -find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) +find_char (CharCache *cache, PangoFont *font, GUChar4 wc, const char *input) { guint mask = find_char_mask (wc); GSList *tmp_list; @@ -227,8 +225,8 @@ find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) if (!tmp_list) { - char *charset_names[MEMBERS(charsets)]; - Charset *charsets_map[MEMBERS(charsets)]; + char *charset_names[G_N_ELEMENTS(charsets)]; + Charset *charsets_map[G_N_ELEMENTS(charsets)]; int n_charsets = 0; @@ -241,7 +239,7 @@ find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) /* Find the character sets that are included in this mask */ - for (i=0; i<MEMBERS(charsets); i++) + for (i=0; i<G_N_ELEMENTS(charsets); i++) { if (mask & (1 << i)) { @@ -297,7 +295,7 @@ set_glyph (PangoFont *font, PangoGlyphString *glyphs, gint i, PangoGlyph glyph) } static iconv_t -find_converter (CharCache *cache, gchar *id) +find_converter (CharCache *cache, const char *id) { iconv_t cd = g_hash_table_lookup (cache->converters, id); if (!cd) @@ -310,15 +308,15 @@ find_converter (CharCache *cache, gchar *id) } static PangoGlyph -conv_8bit (CharCache *cache, - gchar *id, - char *input) +conv_8bit (CharCache *cache, + const char *id, + const char *input) { iconv_t cd; char outbuf; - char *p; + const char *p; - char *inptr = input; + const char *inptr = input; int inbytesleft; char *outptr = &outbuf; int outbytesleft = 1; @@ -335,15 +333,15 @@ conv_8bit (CharCache *cache, } static PangoGlyph -conv_euc (CharCache *cache, - gchar *id, - char *input) +conv_euc (CharCache *cache, + const char *id, + const char *input) { iconv_t cd; char outbuf[2]; - char *p; + const char *p; - char *inptr = input; + const char *inptr = input; int inbytesleft; char *outptr = outbuf; int outbytesleft = 2; @@ -354,7 +352,7 @@ conv_euc (CharCache *cache, cd = find_converter (cache, id); g_assert (cd != (iconv_t)-1); - iconv (cd, (const char **)&inptr, &inbytesleft, &outptr, &outbytesleft); + iconv (cd, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((guchar)outbuf[0] < 128) return outbuf[0]; @@ -363,9 +361,9 @@ conv_euc (CharCache *cache, } static PangoGlyph -conv_ucs4 (CharCache *cache, - gchar *id, - char *input) +conv_ucs4 (CharCache *cache, + const char *id, + const char *input) { GUChar4 wc; @@ -393,16 +391,31 @@ swap_range (PangoGlyphString *glyphs, int start, int end) } } +static CharCache * +get_char_cache (PangoFont *font) +{ + CharCache *cache = pango_font_get_data (font, "basic-char-cache"); + if (!cache) + { + cache = char_cache_new (); + pango_font_set_data (font, "basic-char-cache", + cache, (GDestroyNotify)char_cache_free); + } + + return cache; +} + static void basic_engine_shape (PangoFont *font, - gchar *text, + const char *text, gint length, PangoAnalysis *analysis, PangoGlyphString *glyphs) { int n_chars; int i; - char *p, *next; + const char *p; + const char *next; PangoXSubfont fallback_subfont = 0; CharCache *cache; @@ -412,14 +425,8 @@ basic_engine_shape (PangoFont *font, g_return_if_fail (length >= 0); g_return_if_fail (analysis != NULL); - cache = pango_font_get_data (font, "basic-char-cache"); - if (!cache) - { - cache = char_cache_new (); - pango_font_set_data (font, "basic-char-cache", - cache, (GDestroyNotify)char_cache_free); - } - + cache = get_char_cache (font); + n_chars = unicode_strlen (text, length); pango_glyph_string_set_size (glyphs, n_chars); @@ -504,6 +511,41 @@ basic_engine_shape (PangoFont *font, } } +static PangoCoverage * +basic_engine_get_coverage (PangoFont *font, + const char *lang) +{ + CharCache *cache = get_char_cache (font); + PangoCoverage *result = pango_coverage_new (); + GUChar4 wc; + + iconv_t utf8_conv = (iconv_t)-1; + + if (utf8_conv == (iconv_t)-1) + { + utf8_conv = iconv_open ("utf-8", "ucs-4"); + if (utf8_conv == (iconv_t)-1) + g_error ("Could not open coverter from ucs-4 to utf-8!"); + } + + for (wc = 0; wc < 65536; wc++) + { + char buf[4]; + const char *inbuf = (const char *)&wc; + size_t inbytes_left = 4; + char *outbuf = buf; + size_t outbytes_left = 4; + + iconv (utf8_conv, &inbuf, &inbytes_left, &outbuf, &outbytes_left); + + if (find_char (cache, font, wc, buf)) + pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT); + + } + + return result; +} + static PangoEngine * basic_engine_x_new () { @@ -515,6 +557,7 @@ basic_engine_x_new () result->engine.type = PANGO_ENGINE_TYPE_LANG; result->engine.length = sizeof (result); result->script_shape = basic_engine_shape; + result->get_coverage = basic_engine_get_coverage; return (PangoEngine *)result; } diff --git a/modules/hangul/hangul-x.c b/modules/hangul/hangul-x.c index 74a9208a..65e9faf3 100644 --- a/modules/hangul/hangul-x.c +++ b/modules/hangul/hangul-x.c @@ -26,8 +26,6 @@ #include "utils.h" #include <unicode.h> -#define MEMBERS(strct) sizeof(strct) / sizeof(strct[1]) - static PangoEngineRange hangul_ranges[] = { /* Hangul Jamo U+1100 -- U+11FF */ @@ -44,25 +42,25 @@ static PangoEngineInfo script_engines[] = { "HangulScriptEngineLang", PANGO_ENGINE_TYPE_LANG, PANGO_RENDER_TYPE_NONE, - hangul_ranges, MEMBERS(hangul_ranges) + hangul_ranges, G_N_ELEMENTS(hangul_ranges) }, { "HangulScriptEngineX", PANGO_ENGINE_TYPE_SHAPE, PANGO_RENDER_TYPE_X, - hangul_ranges, MEMBERS(hangul_ranges) + hangul_ranges, G_N_ELEMENTS(hangul_ranges) } }; -static gint n_script_engines = MEMBERS (script_engines); +static int n_script_engines = G_N_ELEMENTS (script_engines); /* * Language script engine */ static void -hangul_engine_break (gchar *text, - gint len, +hangul_engine_break (const char *text, + int len, PangoAnalysis *analysis, PangoLogAttr *attrs) { @@ -89,10 +87,10 @@ hangul_engine_lang_new () */ static void -set_glyph (PangoGlyphString *glyphs, gint i, +set_glyph (PangoGlyphString *glyphs, int i, PangoFont *font, PangoXSubfont subfont, guint16 gindex) { - gint width; + int width; glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, gindex); @@ -513,7 +511,7 @@ subfont_has_korean (PangoFont *font, } static gboolean -find_subfont (PangoFont *font, gchar **charsets, gint n_charsets, +find_subfont (PangoFont *font, char **charsets, int n_charsets, PangoXSubfont *subfont, RenderSyllableFunc *render_func) { int i; @@ -562,36 +560,37 @@ find_subfont (PangoFont *font, gchar **charsets, gint n_charsets, return (*subfont != 0); } +static char *default_charset[] = { + "johabs-1" +}; + +static char *secondary_charset[] = { + "johab-1" +}; + +static char *fallback_charsets[] = { + "iso10646-1", + "ksc5601.1987-0" +}; + static void hangul_engine_shape (PangoFont *font, - gchar *text, - gint length, + const char *text, + int length, PangoAnalysis *analysis, PangoGlyphString *glyphs) { PangoXSubfont subfont; RenderSyllableFunc render_func = NULL; - char *ptr, *next; + const char *ptr; + const char *next; int i, n_chars; GUChar2 jamos[4]; int n_jamos = 0; int n_glyphs = 0, n_clusters = 0; - static char *default_charset[] = { - "johabs-1" - }; - - static char *secondary_charset[] = { - "johab-1" - }; - - static char *fallback_charsets[] = { - "iso10646-1", - "ksc5601.1987-0" - }; - g_return_if_fail (font != NULL); g_return_if_fail (text != NULL); g_return_if_fail (length >= 0); @@ -601,9 +600,9 @@ hangul_engine_shape (PangoFont *font, * otherwise use iso-10646 or KSC font depending on the ordering * of the fontlist. */ - if (!find_subfont (font, default_charset, 1, &subfont, &render_func)) - if (!find_subfont (font, secondary_charset, 1, &subfont, &render_func)) - if (!find_subfont (font, fallback_charsets, 2, &subfont, &render_func)) + if (!find_subfont (font, default_charset, G_N_ELEMENTS (default_charset), &subfont, &render_func)) + if (!find_subfont (font, secondary_charset, G_N_ELEMENTS (secondary_charset), &subfont, &render_func)) + if (!find_subfont (font, fallback_charsets, G_N_ELEMENTS (fallback_charsets), &subfont, &render_func)) { g_warning ("No available Hangul fonts."); return; @@ -688,6 +687,57 @@ hangul_engine_shape (PangoFont *font, } } +static PangoCoverage * +hangul_engine_get_coverage (PangoFont *font, + const char *lang) +{ + PangoCoverage *result = pango_coverage_new (); + PangoXSubfont subfont; + RenderSyllableFunc render_func = NULL; + int i; + + /* An approximate implementation, please check and fix as necessary! + * OWT 2 Feb 2000 + */ + if (find_subfont (font, default_charset, G_N_ELEMENTS (default_charset), &subfont, &render_func) || + find_subfont (font, secondary_charset, G_N_ELEMENTS (secondary_charset), &subfont, &render_func) || + find_subfont (font, fallback_charsets, G_N_ELEMENTS (fallback_charsets), &subfont, &render_func)) + { + if (render_func == render_syllable_with_johabs || + render_func == render_syllable_with_johab) + { + for (i = 0x1100; i <= 0x11ff; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); + + for (i = 0xac00; i <= 0xd7a3; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); + + } + else if (render_func == render_syllable_with_iso10646) + { + for (i = 0x1100; i <= 0x11ff; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK); + + for (i = 0xac00; i <= 0xd7a3; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); + } + else if (render_func == render_syllable_with_ksc5601) + { + for (i = 0x1100; i <= 0x11ff; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK); + + for (i = 0xac00; i <= 0xd7a3; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK); + + for (i=0; i<KSC5601_HANGUL; i++) + pango_coverage_set (result, __ksc5601_hangul_to_ucs[i], PANGO_COVERAGE_EXACT); + } + else + g_assert_not_reached(); + } + + return result; +} static PangoEngine * hangul_engine_x_new () @@ -700,6 +750,7 @@ hangul_engine_x_new () result->engine.type = PANGO_ENGINE_TYPE_LANG; result->engine.length = sizeof (result); result->script_shape = hangul_engine_shape; + result->get_coverage = hangul_engine_get_coverage; return (PangoEngine *)result; } @@ -711,7 +762,7 @@ hangul_engine_x_new () */ void -script_engine_list (PangoEngineInfo **engines, gint *n_engines) +script_engine_list (PangoEngineInfo **engines, int *n_engines) { *engines = script_engines; *n_engines = n_script_engines; diff --git a/modules/hangul/hangul.c b/modules/hangul/hangul.c index 74a9208a..65e9faf3 100644 --- a/modules/hangul/hangul.c +++ b/modules/hangul/hangul.c @@ -26,8 +26,6 @@ #include "utils.h" #include <unicode.h> -#define MEMBERS(strct) sizeof(strct) / sizeof(strct[1]) - static PangoEngineRange hangul_ranges[] = { /* Hangul Jamo U+1100 -- U+11FF */ @@ -44,25 +42,25 @@ static PangoEngineInfo script_engines[] = { "HangulScriptEngineLang", PANGO_ENGINE_TYPE_LANG, PANGO_RENDER_TYPE_NONE, - hangul_ranges, MEMBERS(hangul_ranges) + hangul_ranges, G_N_ELEMENTS(hangul_ranges) }, { "HangulScriptEngineX", PANGO_ENGINE_TYPE_SHAPE, PANGO_RENDER_TYPE_X, - hangul_ranges, MEMBERS(hangul_ranges) + hangul_ranges, G_N_ELEMENTS(hangul_ranges) } }; -static gint n_script_engines = MEMBERS (script_engines); +static int n_script_engines = G_N_ELEMENTS (script_engines); /* * Language script engine */ static void -hangul_engine_break (gchar *text, - gint len, +hangul_engine_break (const char *text, + int len, PangoAnalysis *analysis, PangoLogAttr *attrs) { @@ -89,10 +87,10 @@ hangul_engine_lang_new () */ static void -set_glyph (PangoGlyphString *glyphs, gint i, +set_glyph (PangoGlyphString *glyphs, int i, PangoFont *font, PangoXSubfont subfont, guint16 gindex) { - gint width; + int width; glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, gindex); @@ -513,7 +511,7 @@ subfont_has_korean (PangoFont *font, } static gboolean -find_subfont (PangoFont *font, gchar **charsets, gint n_charsets, +find_subfont (PangoFont *font, char **charsets, int n_charsets, PangoXSubfont *subfont, RenderSyllableFunc *render_func) { int i; @@ -562,36 +560,37 @@ find_subfont (PangoFont *font, gchar **charsets, gint n_charsets, return (*subfont != 0); } +static char *default_charset[] = { + "johabs-1" +}; + +static char *secondary_charset[] = { + "johab-1" +}; + +static char *fallback_charsets[] = { + "iso10646-1", + "ksc5601.1987-0" +}; + static void hangul_engine_shape (PangoFont *font, - gchar *text, - gint length, + const char *text, + int length, PangoAnalysis *analysis, PangoGlyphString *glyphs) { PangoXSubfont subfont; RenderSyllableFunc render_func = NULL; - char *ptr, *next; + const char *ptr; + const char *next; int i, n_chars; GUChar2 jamos[4]; int n_jamos = 0; int n_glyphs = 0, n_clusters = 0; - static char *default_charset[] = { - "johabs-1" - }; - - static char *secondary_charset[] = { - "johab-1" - }; - - static char *fallback_charsets[] = { - "iso10646-1", - "ksc5601.1987-0" - }; - g_return_if_fail (font != NULL); g_return_if_fail (text != NULL); g_return_if_fail (length >= 0); @@ -601,9 +600,9 @@ hangul_engine_shape (PangoFont *font, * otherwise use iso-10646 or KSC font depending on the ordering * of the fontlist. */ - if (!find_subfont (font, default_charset, 1, &subfont, &render_func)) - if (!find_subfont (font, secondary_charset, 1, &subfont, &render_func)) - if (!find_subfont (font, fallback_charsets, 2, &subfont, &render_func)) + if (!find_subfont (font, default_charset, G_N_ELEMENTS (default_charset), &subfont, &render_func)) + if (!find_subfont (font, secondary_charset, G_N_ELEMENTS (secondary_charset), &subfont, &render_func)) + if (!find_subfont (font, fallback_charsets, G_N_ELEMENTS (fallback_charsets), &subfont, &render_func)) { g_warning ("No available Hangul fonts."); return; @@ -688,6 +687,57 @@ hangul_engine_shape (PangoFont *font, } } +static PangoCoverage * +hangul_engine_get_coverage (PangoFont *font, + const char *lang) +{ + PangoCoverage *result = pango_coverage_new (); + PangoXSubfont subfont; + RenderSyllableFunc render_func = NULL; + int i; + + /* An approximate implementation, please check and fix as necessary! + * OWT 2 Feb 2000 + */ + if (find_subfont (font, default_charset, G_N_ELEMENTS (default_charset), &subfont, &render_func) || + find_subfont (font, secondary_charset, G_N_ELEMENTS (secondary_charset), &subfont, &render_func) || + find_subfont (font, fallback_charsets, G_N_ELEMENTS (fallback_charsets), &subfont, &render_func)) + { + if (render_func == render_syllable_with_johabs || + render_func == render_syllable_with_johab) + { + for (i = 0x1100; i <= 0x11ff; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); + + for (i = 0xac00; i <= 0xd7a3; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); + + } + else if (render_func == render_syllable_with_iso10646) + { + for (i = 0x1100; i <= 0x11ff; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK); + + for (i = 0xac00; i <= 0xd7a3; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); + } + else if (render_func == render_syllable_with_ksc5601) + { + for (i = 0x1100; i <= 0x11ff; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK); + + for (i = 0xac00; i <= 0xd7a3; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK); + + for (i=0; i<KSC5601_HANGUL; i++) + pango_coverage_set (result, __ksc5601_hangul_to_ucs[i], PANGO_COVERAGE_EXACT); + } + else + g_assert_not_reached(); + } + + return result; +} static PangoEngine * hangul_engine_x_new () @@ -700,6 +750,7 @@ hangul_engine_x_new () result->engine.type = PANGO_ENGINE_TYPE_LANG; result->engine.length = sizeof (result); result->script_shape = hangul_engine_shape; + result->get_coverage = hangul_engine_get_coverage; return (PangoEngine *)result; } @@ -711,7 +762,7 @@ hangul_engine_x_new () */ void -script_engine_list (PangoEngineInfo **engines, gint *n_engines) +script_engine_list (PangoEngineInfo **engines, int *n_engines) { *engines = script_engines; *n_engines = n_script_engines; diff --git a/modules/tamil/tamil-x.c b/modules/tamil/tamil-x.c index f31a0e9b..908aaa94 100644 --- a/modules/tamil/tamil-x.c +++ b/modules/tamil/tamil-x.c @@ -12,8 +12,6 @@ #include "utils.h" #include "taconv.h" -#define MEMBERS(strct) sizeof(strct) / sizeof(strct[1]) - static PangoEngineRange tamil_range[] = { { 0x0b80, 0x0bff, "*" }, }; @@ -23,25 +21,25 @@ static PangoEngineInfo script_engines[] = { "TamilScriptEngineLang", PANGO_ENGINE_TYPE_LANG, PANGO_RENDER_TYPE_NONE, - tamil_range, MEMBERS(tamil_range) + tamil_range, G_N_ELEMENTS(tamil_range) }, { "TamilScriptEngineX", PANGO_ENGINE_TYPE_SHAPE, PANGO_RENDER_TYPE_X, - tamil_range, MEMBERS(tamil_range) + tamil_range, G_N_ELEMENTS(tamil_range) } }; -static gint n_script_engines = MEMBERS (script_engines); +static gint n_script_engines = G_N_ELEMENTS (script_engines); /* * Language script engine */ static void -tamil_engine_break (gchar *text, - gint len, +tamil_engine_break (const char *text, + int len, PangoAnalysis *analysis, PangoLogAttr *attrs) { @@ -49,8 +47,8 @@ tamil_engine_break (gchar *text, * only difference is char stop based on modifiers */ - gchar *cur = text; - gchar *next; + const char *cur = text; + const char *next; gint i = 0; GUChar4 wc; @@ -96,10 +94,10 @@ tamil_engine_lang_new () * But we can live with this for time being */ static void -set_glyph (PangoGlyphString *glyphs, gint i, +set_glyph (PangoGlyphString *glyphs, int i, PangoFont *font, PangoXSubfont subfont, guint16 gindex) { - gint width; + int width; glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, gindex); @@ -134,15 +132,16 @@ find_tscii_font (PangoFont *font) } static void -tamil_engine_shape (PangoFont *font, - gchar *text, - gint length, - PangoAnalysis *analysis, - PangoGlyphString *glyphs) +tamil_engine_shape (PangoFont *font, + const char *text, + int length, + PangoAnalysis *analysis, + PangoGlyphString *glyphs) { int n_chars, n_glyph; int i, j; - char *p, *next; + const char *p; + const char *next; GUChar4 *wc, *uni_str; int res; unsigned char tsc_str[6]; @@ -205,6 +204,24 @@ tamil_engine_shape (PangoFont *font, g_free(wc); } +static PangoCoverage * +tamil_engine_get_coverage (PangoFont *font, + const char *lang) +{ + PangoCoverage *result = pango_coverage_new (); + + PangoXSubfont tscii_font = find_tscii_font (font); + if (tscii_font) + { + GUChar4 i; + + for (i = 0xb80; i <= 0xbff; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); + } + + return result; +} + static PangoEngine * tamil_engine_x_new () { @@ -216,6 +233,7 @@ tamil_engine_x_new () result->engine.type = PANGO_ENGINE_TYPE_LANG; result->engine.length = sizeof (result); result->script_shape = tamil_engine_shape; + result->get_coverage = tamil_engine_get_coverage; return (PangoEngine *)result; } @@ -224,7 +242,7 @@ tamil_engine_x_new () * Pango */ void -script_engine_list (PangoEngineInfo **engines, gint *n_engines) +script_engine_list (PangoEngineInfo **engines, int *n_engines) { *engines = script_engines; *n_engines = n_script_engines; diff --git a/modules/tamil/tamil.c b/modules/tamil/tamil.c index f31a0e9b..908aaa94 100644 --- a/modules/tamil/tamil.c +++ b/modules/tamil/tamil.c @@ -12,8 +12,6 @@ #include "utils.h" #include "taconv.h" -#define MEMBERS(strct) sizeof(strct) / sizeof(strct[1]) - static PangoEngineRange tamil_range[] = { { 0x0b80, 0x0bff, "*" }, }; @@ -23,25 +21,25 @@ static PangoEngineInfo script_engines[] = { "TamilScriptEngineLang", PANGO_ENGINE_TYPE_LANG, PANGO_RENDER_TYPE_NONE, - tamil_range, MEMBERS(tamil_range) + tamil_range, G_N_ELEMENTS(tamil_range) }, { "TamilScriptEngineX", PANGO_ENGINE_TYPE_SHAPE, PANGO_RENDER_TYPE_X, - tamil_range, MEMBERS(tamil_range) + tamil_range, G_N_ELEMENTS(tamil_range) } }; -static gint n_script_engines = MEMBERS (script_engines); +static gint n_script_engines = G_N_ELEMENTS (script_engines); /* * Language script engine */ static void -tamil_engine_break (gchar *text, - gint len, +tamil_engine_break (const char *text, + int len, PangoAnalysis *analysis, PangoLogAttr *attrs) { @@ -49,8 +47,8 @@ tamil_engine_break (gchar *text, * only difference is char stop based on modifiers */ - gchar *cur = text; - gchar *next; + const char *cur = text; + const char *next; gint i = 0; GUChar4 wc; @@ -96,10 +94,10 @@ tamil_engine_lang_new () * But we can live with this for time being */ static void -set_glyph (PangoGlyphString *glyphs, gint i, +set_glyph (PangoGlyphString *glyphs, int i, PangoFont *font, PangoXSubfont subfont, guint16 gindex) { - gint width; + int width; glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, gindex); @@ -134,15 +132,16 @@ find_tscii_font (PangoFont *font) } static void -tamil_engine_shape (PangoFont *font, - gchar *text, - gint length, - PangoAnalysis *analysis, - PangoGlyphString *glyphs) +tamil_engine_shape (PangoFont *font, + const char *text, + int length, + PangoAnalysis *analysis, + PangoGlyphString *glyphs) { int n_chars, n_glyph; int i, j; - char *p, *next; + const char *p; + const char *next; GUChar4 *wc, *uni_str; int res; unsigned char tsc_str[6]; @@ -205,6 +204,24 @@ tamil_engine_shape (PangoFont *font, g_free(wc); } +static PangoCoverage * +tamil_engine_get_coverage (PangoFont *font, + const char *lang) +{ + PangoCoverage *result = pango_coverage_new (); + + PangoXSubfont tscii_font = find_tscii_font (font); + if (tscii_font) + { + GUChar4 i; + + for (i = 0xb80; i <= 0xbff; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); + } + + return result; +} + static PangoEngine * tamil_engine_x_new () { @@ -216,6 +233,7 @@ tamil_engine_x_new () result->engine.type = PANGO_ENGINE_TYPE_LANG; result->engine.length = sizeof (result); result->script_shape = tamil_engine_shape; + result->get_coverage = tamil_engine_get_coverage; return (PangoEngine *)result; } @@ -224,7 +242,7 @@ tamil_engine_x_new () * Pango */ void -script_engine_list (PangoEngineInfo **engines, gint *n_engines) +script_engine_list (PangoEngineInfo **engines, int *n_engines) { *engines = script_engines; *n_engines = n_script_engines; diff --git a/pango/pango-engine.h b/pango/pango-engine.h index ccd7b219..9d56163a 100644 --- a/pango/pango-engine.h +++ b/pango/pango-engine.h @@ -67,7 +67,7 @@ struct _PangoEngine struct _PangoEngineLang { PangoEngine engine; - void (*script_break) (gchar *text, + void (*script_break) (const char *text, int len, PangoAnalysis *analysis, PangoLogAttr *attrs); @@ -77,10 +77,12 @@ struct _PangoEngineShape { PangoEngine engine; void (*script_shape) (PangoFont *font, - char *text, + const char *text, int length, PangoAnalysis *analysis, PangoGlyphString *glyphs); + PangoCoverage *(*get_coverage) (PangoFont *font, + const char *lang); }; /* A module should export the following functions */ diff --git a/pango/pango-types.h b/pango/pango-types.h index f702a722..46dc794b 100644 --- a/pango/pango-types.h +++ b/pango/pango-types.h @@ -23,6 +23,13 @@ #define __PANGO_TYPES_H__ #include <glib.h> + +/* Include this here, since we don't depend on GLib 1.3 yet */ + +#ifndef G_N_ELEMENTS +#define G_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) +#endif + typedef struct _PangoAnalysis PangoAnalysis; typedef struct _PangoItem PangoItem; typedef struct _PangoLangRange PangoLangRange; diff --git a/pango/pangox.c b/pango/pangox.c index 60dda86b..94b70297 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -33,10 +33,6 @@ typedef struct _PangoXSubfontInfo PangoXSubfontInfo; typedef struct _PangoXFamilyEntry PangoXFamilyEntry; typedef struct _PangoXFontEntry PangoXFontEntry; -#ifndef G_N_ELEMENTS -#define G_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0])) -#endif - struct _PangoXFontEntry { char *xlfd_prefix; diff --git a/pango/utils.c b/pango/utils.c index d3ab9fdd..6790113d 100644 --- a/pango/utils.c +++ b/pango/utils.c @@ -25,10 +25,10 @@ #include <unicode.h> gboolean -_pango_utf8_iterate (gchar *cur, char **next, GUChar4 *wc_out) +_pango_utf8_iterate (const char *cur, const char **next, GUChar4 *wc_out) { - gchar *p = cur; - gchar c = *p; + const char *p = cur; + char c = *p; GUChar4 wc; gint length; @@ -83,12 +83,12 @@ _pango_utf8_iterate (gchar *cur, char **next, GUChar4 *wc_out) return TRUE; } -gint -_pango_utf8_len (gchar *str, gint limit) +int +_pango_utf8_len (const char *str, int limit) { - gchar *cur = str; - gchar *next; - gint len = 0; + const char *cur = str; + const char *next; + int len = 0; while (*cur) { @@ -112,11 +112,11 @@ _pango_utf8_len (gchar *str, gint limit) #endif GUChar2 * -_pango_utf8_to_ucs2 (gchar *str, gint len) +_pango_utf8_to_ucs2 (const char *str, int len) { iconv_t cd; - gchar *outbuf, *result; - gchar *inbuf; + char *outbuf, *result; + const char *inbuf; size_t inbytesleft; size_t outbytesleft; gint outlen; diff --git a/pango/utils.h b/pango/utils.h index 2777b5d9..cfb82d0a 100644 --- a/pango/utils.h +++ b/pango/utils.h @@ -27,8 +27,8 @@ typedef guint16 GUChar2; typedef guint32 GUChar4; -gboolean _pango_utf8_iterate (gchar *cur, char **next, GUChar4 *wc_out); -GUChar2 *_pango_utf8_to_ucs2 (gchar *str, gint len); -gint _pango_utf8_len (gchar *str, gint limit); +gboolean _pango_utf8_iterate (const char *cur, const char **next, GUChar4 *wc_out); +GUChar2 *_pango_utf8_to_ucs2 (const char *str, gint len); +int _pango_utf8_len (const char *str, gint limit); #endif /* __UTILS_H__ */ |