diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-06-21 16:13:42 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-06-21 16:13:42 +0000 |
commit | 0e6409a158d9dd76a31b9eccf7c4f26c5466d082 (patch) | |
tree | dc120946f7efa23c6c91c64aee2686d2637e3970 /modules | |
parent | 197a2a68c145d3568cd4f0f2fee3d3b55570134f (diff) | |
download | pango-0e6409a158d9dd76a31b9eccf7c4f26c5466d082.tar.gz |
Remove tests for libunicode
Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com>
* configure.in: Remove tests for libunicode
* pango/utils.[ch]: Removed. The functions from here are now in
GLib.
* **.[ch]: Removed use of libunicode and utils.c in favor of
Unicode functions in GLib. Requires latest GLib from CVS.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/arabic/arabic-x.c | 42 | ||||
-rw-r--r-- | modules/arabic/arabic.c | 42 | ||||
-rw-r--r-- | modules/arabic/arconv.c | 36 | ||||
-rw-r--r-- | modules/arabic/arconv.h | 7 | ||||
-rw-r--r-- | modules/arabic/langboxfont.c | 4 | ||||
-rw-r--r-- | modules/arabic/mulefont.c | 4 | ||||
-rw-r--r-- | modules/basic/basic-x.c | 34 | ||||
-rw-r--r-- | modules/basic/basic.c | 34 | ||||
-rw-r--r-- | modules/devanagari/devanagari.c | 71 | ||||
-rw-r--r-- | modules/hangul/hangul-x.c | 32 | ||||
-rw-r--r-- | modules/hangul/hangul.c | 32 | ||||
-rw-r--r-- | modules/tamil/tamil-x.c | 35 | ||||
-rw-r--r-- | modules/tamil/tamil.c | 35 | ||||
-rw-r--r-- | modules/thai/thai-x.c | 26 | ||||
-rw-r--r-- | modules/thai/thai.c | 26 |
15 files changed, 201 insertions, 259 deletions
diff --git a/modules/arabic/arabic-x.c b/modules/arabic/arabic-x.c index 05df83f9..807ce793 100644 --- a/modules/arabic/arabic-x.c +++ b/modules/arabic/arabic-x.c @@ -10,8 +10,6 @@ #include <glib.h> #include "pango.h" #include "pangox.h" -#include "utils.h" -#include <unicode.h> #include "arconv.h" #include "mulefont.h" @@ -62,27 +60,24 @@ arabic_engine_break (const char *text, */ const char *cur = text; - const char *next; gint i = 0; - GUChar4 wc; + gunichar wc; - while (*cur) - { - if (!_pango_utf8_iterate (cur, &next, &wc)) - return; - if (cur == next) - break; - if ((next - text) > len) - break; - cur = next; + while (*cur && cur - text < len) + { + wc = g_utf8_get_char (cur); + if (wc == (gunichar)-1) + break; /* FIXME: ERROR */ attrs[i].is_white = (wc == ' ' || wc == '\t' || wc == 'n') ? 1 : 0; attrs[i].is_break = (i > 0 && attrs[i-1].is_white) || attrs[i].is_white; attrs[i].is_char_stop = 1; attrs[i].is_word_stop = (i == 0) || attrs[i-1].is_white; /* actually, is_word_stop in not correct, but simple and good enough. */ + i++; - } + cur = g_utf8_next_char (cur); + } } static PangoEngine * @@ -222,8 +217,7 @@ arabic_engine_shape (PangoFont *font, int i; const char *p; const char *pold; - const char *next; - GUChar4 *wc; + gunichar *wc; int lvl = 1; g_return_if_fail (font != NULL); @@ -235,7 +229,7 @@ arabic_engine_shape (PangoFont *font, ** the needed chars -- or tree mulearabic-coded fonts ... */ - n_chars = n_glyph = unicode_strlen (text, length); + n_chars = n_glyph = g_utf8_strlen (text, length); if (!(lvl = find_unic_font (font, default_charset,arfonts))) { @@ -250,19 +244,19 @@ arabic_engine_shape (PangoFont *font, set_glyph (glyphs, font, PANGO_X_GLYPH_SUBFONT (unknown_glyph), i, p - text, PANGO_X_GLYPH_INDEX (unknown_glyph),0); - p = unicode_next_utf8 (p); + p = g_utf8_next_char (p); } return; } subfont = arfonts[0]; - wc = (GUChar4 *)g_malloc(sizeof(GUChar4)*n_chars); + wc = (gunichar *)g_malloc(sizeof(gunichar)*n_chars); p = text; for (i=0; i < n_chars; i++) { - _pango_utf8_iterate (p, &next, &wc[n_chars - i - 1]); - p = next; + wc[n_chars - i - 1] = g_utf8_get_char (p); + p = g_utf8_next_char (p); } @@ -290,7 +284,7 @@ arabic_engine_shape (PangoFont *font, { if (wc[i] == 0) { - p = unicode_next_utf8 (p); + p = g_utf8_next_char (p); i--; } else @@ -323,7 +317,7 @@ arabic_engine_shape (PangoFont *font, cluster_start, wc[i], is_vowel); pold = p; - p = unicode_next_utf8 (p); + p = g_utf8_next_char (p); n_glyph--; i--; } @@ -337,7 +331,7 @@ static PangoCoverage * arabic_engine_get_coverage (PangoFont *font, const char *lang) { - GUChar4 i; + gunichar i; PangoCoverage *result = pango_coverage_new (); for (i = 0x60B; i <= 0x66D; i++) diff --git a/modules/arabic/arabic.c b/modules/arabic/arabic.c index 05df83f9..807ce793 100644 --- a/modules/arabic/arabic.c +++ b/modules/arabic/arabic.c @@ -10,8 +10,6 @@ #include <glib.h> #include "pango.h" #include "pangox.h" -#include "utils.h" -#include <unicode.h> #include "arconv.h" #include "mulefont.h" @@ -62,27 +60,24 @@ arabic_engine_break (const char *text, */ const char *cur = text; - const char *next; gint i = 0; - GUChar4 wc; + gunichar wc; - while (*cur) - { - if (!_pango_utf8_iterate (cur, &next, &wc)) - return; - if (cur == next) - break; - if ((next - text) > len) - break; - cur = next; + while (*cur && cur - text < len) + { + wc = g_utf8_get_char (cur); + if (wc == (gunichar)-1) + break; /* FIXME: ERROR */ attrs[i].is_white = (wc == ' ' || wc == '\t' || wc == 'n') ? 1 : 0; attrs[i].is_break = (i > 0 && attrs[i-1].is_white) || attrs[i].is_white; attrs[i].is_char_stop = 1; attrs[i].is_word_stop = (i == 0) || attrs[i-1].is_white; /* actually, is_word_stop in not correct, but simple and good enough. */ + i++; - } + cur = g_utf8_next_char (cur); + } } static PangoEngine * @@ -222,8 +217,7 @@ arabic_engine_shape (PangoFont *font, int i; const char *p; const char *pold; - const char *next; - GUChar4 *wc; + gunichar *wc; int lvl = 1; g_return_if_fail (font != NULL); @@ -235,7 +229,7 @@ arabic_engine_shape (PangoFont *font, ** the needed chars -- or tree mulearabic-coded fonts ... */ - n_chars = n_glyph = unicode_strlen (text, length); + n_chars = n_glyph = g_utf8_strlen (text, length); if (!(lvl = find_unic_font (font, default_charset,arfonts))) { @@ -250,19 +244,19 @@ arabic_engine_shape (PangoFont *font, set_glyph (glyphs, font, PANGO_X_GLYPH_SUBFONT (unknown_glyph), i, p - text, PANGO_X_GLYPH_INDEX (unknown_glyph),0); - p = unicode_next_utf8 (p); + p = g_utf8_next_char (p); } return; } subfont = arfonts[0]; - wc = (GUChar4 *)g_malloc(sizeof(GUChar4)*n_chars); + wc = (gunichar *)g_malloc(sizeof(gunichar)*n_chars); p = text; for (i=0; i < n_chars; i++) { - _pango_utf8_iterate (p, &next, &wc[n_chars - i - 1]); - p = next; + wc[n_chars - i - 1] = g_utf8_get_char (p); + p = g_utf8_next_char (p); } @@ -290,7 +284,7 @@ arabic_engine_shape (PangoFont *font, { if (wc[i] == 0) { - p = unicode_next_utf8 (p); + p = g_utf8_next_char (p); i--; } else @@ -323,7 +317,7 @@ arabic_engine_shape (PangoFont *font, cluster_start, wc[i], is_vowel); pold = p; - p = unicode_next_utf8 (p); + p = g_utf8_next_char (p); n_glyph--; i--; } @@ -337,7 +331,7 @@ static PangoCoverage * arabic_engine_get_coverage (PangoFont *font, const char *lang) { - GUChar4 i; + gunichar i; PangoCoverage *result = pango_coverage_new (); for (i = 0x60B; i <= 0x66D; i++) diff --git a/modules/arabic/arconv.c b/modules/arabic/arconv.c index 94da5a4c..e722a86d 100644 --- a/modules/arabic/arconv.c +++ b/modules/arabic/arconv.c @@ -18,15 +18,15 @@ #endif typedef struct { - GUChar4 basechar; - GUChar4 charstart; + gunichar basechar; + gunichar charstart; int count; } shapestruct; typedef struct { - GUChar4 basechar; - GUChar4 mark1; /* has to be initialized to zero */ - GUChar4 vowel; /* */ + gunichar basechar; + gunichar mark1; /* has to be initialized to zero */ + gunichar vowel; /* */ char connecttoleft; signed char lignum; /* is a ligature with lignum aditional characters */ char numshapes; @@ -155,7 +155,7 @@ charstruct_init(charstruct* s) } void -copycstostring(GUChar4* string,int* i,charstruct* s,int level) +copycstostring(gunichar* string,int* i,charstruct* s,int level) { /* s is a shaped charstruct; i is the index into the string */ if (s->basechar == 0) return; @@ -189,7 +189,7 @@ copycstostring(GUChar4* string,int* i,charstruct* s,int level) } int -arabic_isvowel(GUChar4 s) +arabic_isvowel(gunichar s) { /* is this 'joining HAMZA' ( strange but has to be handled like a vowel ) * Kasra, Fatha, Damma, Sukun ? */ @@ -199,8 +199,8 @@ arabic_isvowel(GUChar4 s) return 0; } -static GUChar4 -unshape(GUChar4 s) +static gunichar +unshape(gunichar s) { int j = 0; if ( (s > 0xFE80) && ( s < 0xFEFF )) @@ -218,8 +218,8 @@ unshape(GUChar4 s) } } -static GUChar4 -charshape(GUChar4 s,short which) +static gunichar +charshape(gunichar s,short which) { /* which 0=alone 1=end 2=start 3=middle */ int j = 0; if ((s >= chartable[1].basechar) && (s <= 0x64A) && ( s != TATWEEL)) @@ -245,7 +245,7 @@ charshape(GUChar4 s,short which) static short -shapecount(GUChar4 s) +shapecount(gunichar s) { int j = 0; if (arabic_isvowel(s)) @@ -269,10 +269,10 @@ shapecount(GUChar4 s) } int -ligature(GUChar4* string,int si,int len,charstruct* oldchar) +ligature(gunichar* string,int si,int len,charstruct* oldchar) { /* no ligature possible --> return 0; 1 == vowel; 2 = two chars */ int retval = 0; - GUChar4 newchar = string[si]; + gunichar newchar = string[si]; if (arabic_isvowel(newchar)) { retval = 1; @@ -395,7 +395,7 @@ ligature(GUChar4* string,int si,int len,charstruct* oldchar) } static void -shape(int olen,int* len,GUChar4* string,int level) +shape(int olen,int* len,gunichar* string,int level) { /* The string must be in visual order already. ** This routine does the basic arabic reshaping. @@ -468,10 +468,10 @@ shape(int olen,int* len,GUChar4* string,int level) } static void -doublelig(int olen,int* len,GUChar4* string,int level) +doublelig(int olen,int* len,gunichar* string,int level) { /* Ok. We have presentation ligatures in our font. */ int si = (olen)-1; - GUChar4 lapresult; + gunichar lapresult; while (si > 0) { @@ -550,7 +550,7 @@ doublelig(int olen,int* len,GUChar4* string,int level) } void -arabic_reshape(int* len,GUChar4* string,int level) +arabic_reshape(int* len,gunichar* string,int level) { int i; int olen = *len; diff --git a/modules/arabic/arconv.h b/modules/arabic/arconv.h index d266b9d7..2e3416d9 100644 --- a/modules/arabic/arconv.h +++ b/modules/arabic/arconv.h @@ -7,7 +7,8 @@ #ifndef __arconv_h_ #define __arconv_h_ -#include "utils.h" + +#include <glib.h> /* * arabic_reshape: reshapes string ( ordered left-to right visual order ) @@ -19,7 +20,7 @@ * 4 : with some extra Ligatures * */ -void arabic_reshape(int* len,GUChar4* string,int level); -int arabic_isvowel(GUChar4 s); +void arabic_reshape(int* len,gunichar* string,int level); +int arabic_isvowel(gunichar s); #endif diff --git a/modules/arabic/langboxfont.c b/modules/arabic/langboxfont.c index 3073b539..784fdd0b 100644 --- a/modules/arabic/langboxfont.c +++ b/modules/arabic/langboxfont.c @@ -10,8 +10,6 @@ #include <glib.h> #include "pango.h" #include "pangox.h" -#include "utils.h" -#include <unicode.h> /* #define DEBUG */ #ifdef DEBUG @@ -50,7 +48,7 @@ arabic_lboxinit(PangoFont *font,PangoXSubfont* lboxfonts) typedef struct { - GUChar4 unicodechar; + gunichar unicodechar; int charindex; } fontentry; diff --git a/modules/arabic/mulefont.c b/modules/arabic/mulefont.c index e087ce0d..6766b7c1 100644 --- a/modules/arabic/mulefont.c +++ b/modules/arabic/mulefont.c @@ -10,8 +10,6 @@ #include <glib.h> #include "pango.h" #include "pangox.h" -#include "utils.h" -#include <unicode.h> /* #define DEBUG */ #ifdef DEBUG @@ -80,7 +78,7 @@ arabic_muleinit(PangoFont *font,PangoXSubfont* mulefonts) typedef struct { - GUChar4 unicodechar; + gunichar unicodechar; int fontindex; int charindex; } fontentry; diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c index 8f639a2b..944ec41c 100644 --- a/modules/basic/basic-x.c +++ b/modules/basic/basic-x.c @@ -24,8 +24,6 @@ #include <glib.h> #include "pango.h" #include "pangox.h" -#include "utils.h" -#include <unicode.h> #include <fribidi/fribidi.h> typedef struct _CharRange CharRange; @@ -164,7 +162,7 @@ char_cache_free (CharCache *cache) } PangoGlyph -find_char (CharCache *cache, PangoFont *font, GUChar4 wc, const char *input) +find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input) { int mask_index; MaskTable *mask_table; @@ -267,15 +265,13 @@ conv_8bit (CharCache *cache, { iconv_t cd; char outbuf; - const char *p; const char *inptr = input; size_t inbytesleft; char *outptr = &outbuf; size_t outbytesleft = 1; - _pango_utf8_iterate (input, &p, NULL); - inbytesleft = p - input; + inbytesleft = g_utf8_next_char (input) - input; cd = find_converter (cache, charset); @@ -291,15 +287,13 @@ conv_euc (CharCache *cache, { iconv_t cd; char outbuf[2]; - const char *p; const char *inptr = input; size_t inbytesleft; char *outptr = outbuf; size_t outbytesleft = 2; - _pango_utf8_iterate (input, &p, NULL); - inbytesleft = p - input; + inbytesleft = g_utf8_next_char (input) - input; cd = find_converter (cache, charset); @@ -316,10 +310,7 @@ conv_ucs4 (CharCache *cache, Charset *charset, const char *input) { - GUChar4 wc; - - unicode_get_utf8 (input, &wc); - return wc; + return g_utf8_get_char (input); } static void @@ -368,7 +359,6 @@ basic_engine_shape (PangoFont *font, int n_chars; int i; const char *p; - const char *next; CharCache *cache; @@ -379,19 +369,19 @@ basic_engine_shape (PangoFont *font, cache = get_char_cache (font); - n_chars = unicode_strlen (text, length); + n_chars = g_utf8_strlen (text, length); pango_glyph_string_set_size (glyphs, n_chars); p = text; for (i=0; i < n_chars; i++) { - GUChar4 wc; + gunichar wc; FriBidiChar mirrored_ch; PangoGlyph index; char buf[6]; const char *input; - _pango_utf8_iterate (p, &next, &wc); + wc = g_utf8_get_char (p); input = p; if (analysis->level % 2) @@ -399,7 +389,7 @@ basic_engine_shape (PangoFont *font, { wc = mirrored_ch; - _pango_guchar4_to_utf8 (wc, buf); + g_unichar_to_utf8 (wc, buf); input = buf; } @@ -414,7 +404,7 @@ basic_engine_shape (PangoFont *font, { set_glyph (font, glyphs, i, p - text, index); - if (unicode_type (wc) == UNICODE_NON_SPACING_MARK) + if (g_unichar_type (wc) == G_UNICODE_NON_SPACING_MARK) { if (i > 0) { @@ -438,7 +428,7 @@ basic_engine_shape (PangoFont *font, set_glyph (font, glyphs, i, p - text, pango_x_get_unknown_glyph (font)); } - p = next; + p = g_utf8_next_char (p); } /* Simple bidi support... may have separate modules later */ @@ -470,13 +460,13 @@ basic_engine_get_coverage (PangoFont *font, { CharCache *cache = get_char_cache (font); PangoCoverage *result = pango_coverage_new (); - GUChar4 wc; + gunichar wc; for (wc = 0; wc < 65536; wc++) { char buf[6]; - _pango_guchar4_to_utf8 (wc, buf); + g_unichar_to_utf8 (wc, buf); if (find_char (cache, font, wc, buf)) pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT); } diff --git a/modules/basic/basic.c b/modules/basic/basic.c index 8f639a2b..944ec41c 100644 --- a/modules/basic/basic.c +++ b/modules/basic/basic.c @@ -24,8 +24,6 @@ #include <glib.h> #include "pango.h" #include "pangox.h" -#include "utils.h" -#include <unicode.h> #include <fribidi/fribidi.h> typedef struct _CharRange CharRange; @@ -164,7 +162,7 @@ char_cache_free (CharCache *cache) } PangoGlyph -find_char (CharCache *cache, PangoFont *font, GUChar4 wc, const char *input) +find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input) { int mask_index; MaskTable *mask_table; @@ -267,15 +265,13 @@ conv_8bit (CharCache *cache, { iconv_t cd; char outbuf; - const char *p; const char *inptr = input; size_t inbytesleft; char *outptr = &outbuf; size_t outbytesleft = 1; - _pango_utf8_iterate (input, &p, NULL); - inbytesleft = p - input; + inbytesleft = g_utf8_next_char (input) - input; cd = find_converter (cache, charset); @@ -291,15 +287,13 @@ conv_euc (CharCache *cache, { iconv_t cd; char outbuf[2]; - const char *p; const char *inptr = input; size_t inbytesleft; char *outptr = outbuf; size_t outbytesleft = 2; - _pango_utf8_iterate (input, &p, NULL); - inbytesleft = p - input; + inbytesleft = g_utf8_next_char (input) - input; cd = find_converter (cache, charset); @@ -316,10 +310,7 @@ conv_ucs4 (CharCache *cache, Charset *charset, const char *input) { - GUChar4 wc; - - unicode_get_utf8 (input, &wc); - return wc; + return g_utf8_get_char (input); } static void @@ -368,7 +359,6 @@ basic_engine_shape (PangoFont *font, int n_chars; int i; const char *p; - const char *next; CharCache *cache; @@ -379,19 +369,19 @@ basic_engine_shape (PangoFont *font, cache = get_char_cache (font); - n_chars = unicode_strlen (text, length); + n_chars = g_utf8_strlen (text, length); pango_glyph_string_set_size (glyphs, n_chars); p = text; for (i=0; i < n_chars; i++) { - GUChar4 wc; + gunichar wc; FriBidiChar mirrored_ch; PangoGlyph index; char buf[6]; const char *input; - _pango_utf8_iterate (p, &next, &wc); + wc = g_utf8_get_char (p); input = p; if (analysis->level % 2) @@ -399,7 +389,7 @@ basic_engine_shape (PangoFont *font, { wc = mirrored_ch; - _pango_guchar4_to_utf8 (wc, buf); + g_unichar_to_utf8 (wc, buf); input = buf; } @@ -414,7 +404,7 @@ basic_engine_shape (PangoFont *font, { set_glyph (font, glyphs, i, p - text, index); - if (unicode_type (wc) == UNICODE_NON_SPACING_MARK) + if (g_unichar_type (wc) == G_UNICODE_NON_SPACING_MARK) { if (i > 0) { @@ -438,7 +428,7 @@ basic_engine_shape (PangoFont *font, set_glyph (font, glyphs, i, p - text, pango_x_get_unknown_glyph (font)); } - p = next; + p = g_utf8_next_char (p); } /* Simple bidi support... may have separate modules later */ @@ -470,13 +460,13 @@ basic_engine_get_coverage (PangoFont *font, { CharCache *cache = get_char_cache (font); PangoCoverage *result = pango_coverage_new (); - GUChar4 wc; + gunichar wc; for (wc = 0; wc < 65536; wc++) { char buf[6]; - _pango_guchar4_to_utf8 (wc, buf); + g_unichar_to_utf8 (wc, buf); if (find_char (cache, font, wc, buf)) pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT); } diff --git a/modules/devanagari/devanagari.c b/modules/devanagari/devanagari.c index 0fe59422..7f3c1528 100644 --- a/modules/devanagari/devanagari.c +++ b/modules/devanagari/devanagari.c @@ -20,10 +20,8 @@ */ #include <glib.h> -#include <unicode.h> #include <stdio.h> -#include "utils.h" #include "pango.h" #include "pangox.h" @@ -94,7 +92,7 @@ static gboolean static PangoCoverage * devanagari_engine_get_coverage (PangoFont * font, const char *lang) { - GUChar4 i; + gunichar i; PangoCoverage *result = pango_coverage_new (); PangoXSubfont subfont; @@ -171,14 +169,14 @@ is_ind_vowel (int i) } static int -is_nonspacing_vowel (GUChar4 c) +is_nonspacing_vowel (gunichar c) { /* one that doesn't space. ie 93f and 940 don't count */ return (c >= 0x941 && c <= 0x948) || (c >= 0x962 && c <= 0x963); } static int -get_char (GUChar4 * chars, GUChar4 * end) +get_char (gunichar * chars, gunichar * end) { if (chars >= end) return 0; @@ -186,15 +184,15 @@ get_char (GUChar4 * chars, GUChar4 * end) } static void -devanagari_shift_vowels (GUChar4 * chars, GUChar4 * end) +devanagari_shift_vowels (gunichar * chars, gunichar * end) { /* moves 0x93f (I) before consonant clusters where appropriate. */ - GUChar4 *strt = chars; + gunichar *strt = chars; while (chars < end) { if (*chars == 0x93f && chars > strt) { - GUChar4 *bubble = chars; + gunichar *bubble = chars; int i = 1; /* move back TO START! */ @@ -212,12 +210,12 @@ devanagari_shift_vowels (GUChar4 * chars, GUChar4 * end) } void -devanagari_convert_vowels (int *num, GUChar4 * chars) +devanagari_convert_vowels (int *num, gunichar * chars) { /* goes along and converts matras to vowel letters if needed. * this is only currently done at the beginning of the string. */ - GUChar4 *end = chars + *num; - GUChar4 *start = chars; + gunichar *end = chars + *num; + gunichar *start = chars; while (chars < end) { if ((chars == start && is_comb_vowel (chars[0])) || @@ -231,11 +229,11 @@ devanagari_convert_vowels (int *num, GUChar4 * chars) } static void -devanagari_compact (int *num, GUChar4 * chars, gint * cluster) +devanagari_compact (int *num, gunichar * chars, gint * cluster) { /* shuffle stuff up into the blanked out elements. */ - GUChar4 *dest = chars; - GUChar4 *end = chars + *num; + gunichar *dest = chars; + gunichar *end = chars + *num; gint *cluster_dest = cluster; while (chars < end) { @@ -296,12 +294,12 @@ const char *bar[] = #endif static void -devanagari_make_ligs (GUChar4 * start, GUChar4 * end, int *cluster) +devanagari_make_ligs (gunichar * start, gunichar * end, int *cluster) { - GUChar4 t0 = get_char (start, end); - GUChar4 t1 = get_char (start + 1, end); - GUChar4 t2 = get_char (start + 2, end); - GUChar4 t3 = get_char (start + 3, end); + gunichar t0 = get_char (start, end); + gunichar t1 = get_char (start + 1, end); + gunichar t2 = get_char (start + 2, end); + gunichar t3 = get_char (start + 3, end); int i, j; int repha = 0, ligature = 0; @@ -425,19 +423,19 @@ devanagari_engine_shape (PangoFont * font, int n_chars, n_glyph; int lvl; - const char *p, *next; + const char *p; int i; - GUChar4 *wc; + gunichar *wc; int sb; int n_syls; - GUChar4 **syls = g_malloc (sizeof (GUChar4 **)); + gunichar **syls = g_malloc (sizeof (gunichar **)); g_return_if_fail (font != NULL); g_return_if_fail (text != NULL); g_return_if_fail (length >= 0); g_return_if_fail (analysis != NULL); - n_chars = n_glyph = unicode_strlen (text, length); + n_chars = n_glyph = g_utf8_strlen (text, length); lvl = find_unic_font (font, default_charset, &subfont); if (!lvl) { @@ -454,18 +452,18 @@ devanagari_engine_shape (PangoFont * font, glyphs->glyphs[i].geometry.width = logical_rect.width; glyphs->log_clusters[i] = 0; - p = unicode_next_utf8 (p); + p = g_utf8_next_char (p); } return; } p = text; - wc = (GUChar4 *) g_malloc (sizeof (GUChar4) * n_chars); + wc = (gunichar *) g_malloc (sizeof (gunichar) * n_chars); pango_glyph_string_set_size (glyphs, n_glyph); for (i = 0; i < n_chars; i++) { - _pango_utf8_iterate (p, &next, &wc[i]); + wc[i] = g_utf8_get_char (p); glyphs->log_clusters[i] = p - text; - p = next; + p = g_utf8_next_char (p); } devanagari_convert_vowels (&n_glyph, wc); @@ -478,7 +476,7 @@ devanagari_engine_shape (PangoFont * font, if (i && (is_consonant (wc[i]) | is_ind_vowel (wc[i])) && wc[i - 1] != 0x94d) { - syls = g_realloc (syls, ((n_syls + 2) * sizeof (GUChar4 **))); + syls = g_realloc (syls, ((n_syls + 2) * sizeof (gunichar **))); syls[n_syls] = wc + i; n_syls++; sb = glyphs->log_clusters[i]; @@ -550,19 +548,14 @@ devanagari_engine_break (const char *text, PangoAnalysis * analysis, PangoLogAttr * attrs) { const char *cur = text; - const char *next; gint i = 0; - GUChar4 wc; + gunichar wc; - while (*cur) + while (*cur && cur - text < len) { - if (!_pango_utf8_iterate (cur, &next, &wc)) - return; - if (cur == next) - break; - if ((next - text) > len) - break; - cur = next; + wc = g_utf8_get_char (cur); + if (wc == (gunichar)-1) + break; /* FIXME: ERROR */ attrs[i].is_white = (wc == ' ' || wc == '\t' || wc == 'n') ? 1 : 0; attrs[i].is_break = (i > 0 && attrs[i - 1].is_white) || @@ -570,7 +563,9 @@ devanagari_engine_break (const char *text, attrs[i].is_char_stop = 1; attrs[i].is_word_stop = (i == 0) || attrs[i - 1].is_white; /* actually, is_word_stop in not correct, but simple and good enough. */ + i++; + cur = g_utf8_next_char (cur); } } diff --git a/modules/hangul/hangul-x.c b/modules/hangul/hangul-x.c index 6265b77b..8df658ed 100644 --- a/modules/hangul/hangul-x.c +++ b/modules/hangul/hangul-x.c @@ -23,8 +23,6 @@ #include "pango.h" #include "pangox.h" -#include "utils.h" -#include <unicode.h> static PangoEngineRange hangul_ranges[] = { @@ -134,7 +132,7 @@ set_glyph (PangoGlyphString *glyphs, typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont, - GUChar2 *text, int length, + gunichar2 *text, int length, PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset); @@ -171,7 +169,7 @@ typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont, \ if (n_cho <= 1 && n_jung <= 1 && n_jong <= 1) \ { \ - GUChar2 l, v, t; \ + gunichar2 l, v, t; \ \ if (n_cho > 0) \ l = text[0]; \ @@ -260,7 +258,7 @@ typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont, static void render_syllable_with_johabs (PangoFont *font, PangoXSubfont subfont, - GUChar2 *text, int length, + gunichar2 *text, int length, PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset) { @@ -302,7 +300,7 @@ JOHAB_COMMON static void render_syllable_with_johab (PangoFont *font, PangoXSubfont subfont, - GUChar2 *text, int length, + gunichar2 *text, int length, PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset) { @@ -312,7 +310,7 @@ JOHAB_COMMON for (i = 0; i < length; i++) { int j; - GUChar2 wc; + gunichar2 wc; wc = text[i]; for (j = 0; (j < 3) && (__jamo_to_johabfont[wc-LBASE][j] != 0); j++) @@ -335,7 +333,7 @@ JOHAB_COMMON static void render_syllable_with_iso10646 (PangoFont *font, PangoXSubfont subfont, - GUChar2 *text, int length, + gunichar2 *text, int length, PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset) { @@ -403,7 +401,7 @@ render_syllable_with_iso10646 (PangoFont *font, PangoXSubfont subfont, static void render_syllable_with_ksc5601 (PangoFont *font, PangoXSubfont subfont, - GUChar2 *text, int length, + gunichar2 *text, int length, PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset) { @@ -588,7 +586,7 @@ hangul_engine_shape (PangoFont *font, const char *ptr; const char *next; int i, n_chars; - GUChar2 jamos[4]; + gunichar2 jamos[4]; int n_jamos = 0; int n_glyphs = 0, cluster_offset = 0; @@ -608,7 +606,7 @@ hangul_engine_shape (PangoFont *font, { PangoGlyph unknown_glyph = pango_x_get_unknown_glyph (font); - n_chars = unicode_strlen (text, length); + n_chars = g_utf8_strlen (text, length); pango_glyph_string_set_size (glyphs, n_chars); for (i=0; i<n_chars; i++) @@ -619,16 +617,18 @@ hangul_engine_shape (PangoFont *font, return; } - n_chars = unicode_strlen (text, length); + n_chars = g_utf8_strlen (text, length); ptr = text; for (i = 0; i < n_chars; i++) { - GUChar4 wc4; - GUChar2 wcs[4], wc; + gunichar wc4; + gunichar2 wcs[4], wc; int n_code = 0; - _pango_utf8_iterate (ptr, &next, &wc4); + wc4 = g_utf8_get_char (ptr); + next = g_utf8_next_char (ptr); + if (wc4 >= SBASE && wc4 < (SBASE + SCOUNT)) { /* decompose the syllable. */ @@ -656,7 +656,7 @@ hangul_engine_shape (PangoFont *font, } else if (wc4 >= 0x1100 && wc4 <= 0x11ff) { - wc = (GUChar2) wc4; + wc = (gunichar2) wc4; if (n_jamos == 0) { diff --git a/modules/hangul/hangul.c b/modules/hangul/hangul.c index 6265b77b..8df658ed 100644 --- a/modules/hangul/hangul.c +++ b/modules/hangul/hangul.c @@ -23,8 +23,6 @@ #include "pango.h" #include "pangox.h" -#include "utils.h" -#include <unicode.h> static PangoEngineRange hangul_ranges[] = { @@ -134,7 +132,7 @@ set_glyph (PangoGlyphString *glyphs, typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont, - GUChar2 *text, int length, + gunichar2 *text, int length, PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset); @@ -171,7 +169,7 @@ typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont, \ if (n_cho <= 1 && n_jung <= 1 && n_jong <= 1) \ { \ - GUChar2 l, v, t; \ + gunichar2 l, v, t; \ \ if (n_cho > 0) \ l = text[0]; \ @@ -260,7 +258,7 @@ typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont, static void render_syllable_with_johabs (PangoFont *font, PangoXSubfont subfont, - GUChar2 *text, int length, + gunichar2 *text, int length, PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset) { @@ -302,7 +300,7 @@ JOHAB_COMMON static void render_syllable_with_johab (PangoFont *font, PangoXSubfont subfont, - GUChar2 *text, int length, + gunichar2 *text, int length, PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset) { @@ -312,7 +310,7 @@ JOHAB_COMMON for (i = 0; i < length; i++) { int j; - GUChar2 wc; + gunichar2 wc; wc = text[i]; for (j = 0; (j < 3) && (__jamo_to_johabfont[wc-LBASE][j] != 0); j++) @@ -335,7 +333,7 @@ JOHAB_COMMON static void render_syllable_with_iso10646 (PangoFont *font, PangoXSubfont subfont, - GUChar2 *text, int length, + gunichar2 *text, int length, PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset) { @@ -403,7 +401,7 @@ render_syllable_with_iso10646 (PangoFont *font, PangoXSubfont subfont, static void render_syllable_with_ksc5601 (PangoFont *font, PangoXSubfont subfont, - GUChar2 *text, int length, + gunichar2 *text, int length, PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset) { @@ -588,7 +586,7 @@ hangul_engine_shape (PangoFont *font, const char *ptr; const char *next; int i, n_chars; - GUChar2 jamos[4]; + gunichar2 jamos[4]; int n_jamos = 0; int n_glyphs = 0, cluster_offset = 0; @@ -608,7 +606,7 @@ hangul_engine_shape (PangoFont *font, { PangoGlyph unknown_glyph = pango_x_get_unknown_glyph (font); - n_chars = unicode_strlen (text, length); + n_chars = g_utf8_strlen (text, length); pango_glyph_string_set_size (glyphs, n_chars); for (i=0; i<n_chars; i++) @@ -619,16 +617,18 @@ hangul_engine_shape (PangoFont *font, return; } - n_chars = unicode_strlen (text, length); + n_chars = g_utf8_strlen (text, length); ptr = text; for (i = 0; i < n_chars; i++) { - GUChar4 wc4; - GUChar2 wcs[4], wc; + gunichar wc4; + gunichar2 wcs[4], wc; int n_code = 0; - _pango_utf8_iterate (ptr, &next, &wc4); + wc4 = g_utf8_get_char (ptr); + next = g_utf8_next_char (ptr); + if (wc4 >= SBASE && wc4 < (SBASE + SCOUNT)) { /* decompose the syllable. */ @@ -656,7 +656,7 @@ hangul_engine_shape (PangoFont *font, } else if (wc4 >= 0x1100 && wc4 <= 0x11ff) { - wc = (GUChar2) wc4; + wc = (gunichar2) wc4; if (n_jamos == 0) { diff --git a/modules/tamil/tamil-x.c b/modules/tamil/tamil-x.c index e55362b8..98c31548 100644 --- a/modules/tamil/tamil-x.c +++ b/modules/tamil/tamil-x.c @@ -9,9 +9,7 @@ #include <glib.h> #include "pango.h" #include "pangox.h" -#include "utils.h" #include "taconv.h" -#include <unicode.h> static PangoEngineRange tamil_range[] = { { 0x0b80, 0x0bff, "*" }, @@ -49,19 +47,14 @@ tamil_engine_break (const char *text, */ const char *cur = text; - const char *next; gint i = 0; - GUChar4 wc; + gunichar wc; - while (*cur) + while (*cur && cur - text < len) { - if (!_pango_utf8_iterate (cur, &next, &wc)) - return; - if (cur == next) - break; - if ((next - text) > len) - break; - cur = next; + wc = g_utf8_get_char (cur); + if (wc == (gunichar)-1) + break; /* FIXME: ERROR */ attrs[i].is_white = (wc == ' ' || wc == '\t' || wc == 'n') ? 1 : 0; attrs[i].is_break = (i > 0 && attrs[i-1].is_white) || attrs[i].is_white; @@ -69,6 +62,7 @@ tamil_engine_break (const char *text, attrs[i].is_word_stop = (i == 0) || attrs[i-1].is_white; i++; + cur = g_utf8_next_char (cur); } } @@ -98,7 +92,6 @@ static void set_glyph (PangoGlyphString *glyphs, int i, int cluster_start, PangoFont *font, PangoXSubfont subfont, guint16 gindex) { - int width; PangoRectangle logical_rect; glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, gindex); @@ -143,8 +136,7 @@ tamil_engine_shape (PangoFont *font, int i, j; const char *cluster_start; const char *p; - const char *next; - GUChar4 *wc, *uni_str; + gunichar *wc, *uni_str; int res; unsigned char tsc_str[6]; int ntsc, nuni; @@ -163,17 +155,18 @@ tamil_engine_shape (PangoFont *font, return; } - n_chars = _pango_utf8_len (text, length); + n_chars = g_utf8_strlen (text, length); /* temporarily set the size to 3 times the number of unicode chars */ pango_glyph_string_set_size (glyphs, n_chars * 3); - wc = (GUChar4 *)g_malloc(sizeof(GUChar4)*n_chars); + + wc = (gunichar *)g_malloc(sizeof(gunichar)*n_chars); p = text; for (i=0; i < n_chars; i++) { - _pango_utf8_iterate (p, &next, &wc[i]); - p = next; + wc[i] = g_utf8_get_char (p); + p = g_utf8_next_char (p); } n_glyph = 0; @@ -201,7 +194,7 @@ tamil_engine_shape (PangoFont *font, } j = j + nuni; while (nuni--) - cluster_start = unicode_next_utf8 (cluster_start); + cluster_start = g_utf8_next_char (cluster_start); } pango_glyph_string_set_size (glyphs, n_glyph); @@ -218,7 +211,7 @@ tamil_engine_get_coverage (PangoFont *font, PangoXSubfont tscii_font = find_tscii_font (font); if (tscii_font) { - GUChar4 i; + gunichar i; for (i = 0xb80; i <= 0xbff; i++) pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); diff --git a/modules/tamil/tamil.c b/modules/tamil/tamil.c index e55362b8..98c31548 100644 --- a/modules/tamil/tamil.c +++ b/modules/tamil/tamil.c @@ -9,9 +9,7 @@ #include <glib.h> #include "pango.h" #include "pangox.h" -#include "utils.h" #include "taconv.h" -#include <unicode.h> static PangoEngineRange tamil_range[] = { { 0x0b80, 0x0bff, "*" }, @@ -49,19 +47,14 @@ tamil_engine_break (const char *text, */ const char *cur = text; - const char *next; gint i = 0; - GUChar4 wc; + gunichar wc; - while (*cur) + while (*cur && cur - text < len) { - if (!_pango_utf8_iterate (cur, &next, &wc)) - return; - if (cur == next) - break; - if ((next - text) > len) - break; - cur = next; + wc = g_utf8_get_char (cur); + if (wc == (gunichar)-1) + break; /* FIXME: ERROR */ attrs[i].is_white = (wc == ' ' || wc == '\t' || wc == 'n') ? 1 : 0; attrs[i].is_break = (i > 0 && attrs[i-1].is_white) || attrs[i].is_white; @@ -69,6 +62,7 @@ tamil_engine_break (const char *text, attrs[i].is_word_stop = (i == 0) || attrs[i-1].is_white; i++; + cur = g_utf8_next_char (cur); } } @@ -98,7 +92,6 @@ static void set_glyph (PangoGlyphString *glyphs, int i, int cluster_start, PangoFont *font, PangoXSubfont subfont, guint16 gindex) { - int width; PangoRectangle logical_rect; glyphs->glyphs[i].glyph = PANGO_X_MAKE_GLYPH (subfont, gindex); @@ -143,8 +136,7 @@ tamil_engine_shape (PangoFont *font, int i, j; const char *cluster_start; const char *p; - const char *next; - GUChar4 *wc, *uni_str; + gunichar *wc, *uni_str; int res; unsigned char tsc_str[6]; int ntsc, nuni; @@ -163,17 +155,18 @@ tamil_engine_shape (PangoFont *font, return; } - n_chars = _pango_utf8_len (text, length); + n_chars = g_utf8_strlen (text, length); /* temporarily set the size to 3 times the number of unicode chars */ pango_glyph_string_set_size (glyphs, n_chars * 3); - wc = (GUChar4 *)g_malloc(sizeof(GUChar4)*n_chars); + + wc = (gunichar *)g_malloc(sizeof(gunichar)*n_chars); p = text; for (i=0; i < n_chars; i++) { - _pango_utf8_iterate (p, &next, &wc[i]); - p = next; + wc[i] = g_utf8_get_char (p); + p = g_utf8_next_char (p); } n_glyph = 0; @@ -201,7 +194,7 @@ tamil_engine_shape (PangoFont *font, } j = j + nuni; while (nuni--) - cluster_start = unicode_next_utf8 (cluster_start); + cluster_start = g_utf8_next_char (cluster_start); } pango_glyph_string_set_size (glyphs, n_glyph); @@ -218,7 +211,7 @@ tamil_engine_get_coverage (PangoFont *font, PangoXSubfont tscii_font = find_tscii_font (font); if (tscii_font) { - GUChar4 i; + gunichar i; for (i = 0xb80; i <= 0xbff; i++) pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); diff --git a/modules/thai/thai-x.c b/modules/thai/thai-x.c index 0882f75e..aaa52140 100644 --- a/modules/thai/thai-x.c +++ b/modules/thai/thai-x.c @@ -24,8 +24,6 @@ #include <glib.h> #include "pango.h" #include "pangox.h" -#include "utils.h" -#include <unicode.h> #include <fribidi/fribidi.h> /* We handle the range U+0e01 to U+0e5b exactly @@ -240,7 +238,7 @@ add_glyph (ThaiFontInfo *font_info, * code pointer */ static int -get_glyph (ThaiFontInfo *font_info, unicode_char_t wc) +get_glyph (ThaiFontInfo *font_info, gunichar wc) { switch (font_info->type) { @@ -260,9 +258,9 @@ static void add_cluster (ThaiFontInfo *font_info, PangoGlyphString *glyphs, int cluster_start, - unicode_char_t base, - unicode_char_t group1, - unicode_char_t group2) + gunichar base, + gunichar group1, + gunichar group2) { /* If we are rendering with an XTIS font, we try to find a precomposed * glyph for the cluster. @@ -303,11 +301,11 @@ thai_engine_shape (PangoFont *font, PangoGlyphString *glyphs) { ThaiFontInfo *font_info; - const char *p, *next; + const char *p; - unicode_char_t base = 0; - unicode_char_t group1 = 0; - unicode_char_t group2 = 0; + gunichar base = 0; + gunichar group1 = 0; + gunichar group2 = 0; int cluster_start = 0; pango_glyph_string_set_size (glyphs, 0); @@ -318,9 +316,9 @@ thai_engine_shape (PangoFont *font, while (p < text + length) { int group; - unicode_char_t wc; + gunichar wc; - next = unicode_get_utf8 (p, &wc); + wc = g_utf8_get_char (p); if (wc >= 0xe30 && wc < 0xe50) group = groups[wc - 0xe30]; @@ -347,7 +345,7 @@ thai_engine_shape (PangoFont *font, break; } - p = next; + p = g_utf8_next_char (p); } if (base) @@ -364,7 +362,7 @@ thai_engine_get_coverage (PangoFont *font, if (font_info->type != THAI_FONT_NONE) { - unicode_char_t wc; + gunichar wc; for (wc = 0xe01; wc <= 0xe3a; wc++) pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT); diff --git a/modules/thai/thai.c b/modules/thai/thai.c index 0882f75e..aaa52140 100644 --- a/modules/thai/thai.c +++ b/modules/thai/thai.c @@ -24,8 +24,6 @@ #include <glib.h> #include "pango.h" #include "pangox.h" -#include "utils.h" -#include <unicode.h> #include <fribidi/fribidi.h> /* We handle the range U+0e01 to U+0e5b exactly @@ -240,7 +238,7 @@ add_glyph (ThaiFontInfo *font_info, * code pointer */ static int -get_glyph (ThaiFontInfo *font_info, unicode_char_t wc) +get_glyph (ThaiFontInfo *font_info, gunichar wc) { switch (font_info->type) { @@ -260,9 +258,9 @@ static void add_cluster (ThaiFontInfo *font_info, PangoGlyphString *glyphs, int cluster_start, - unicode_char_t base, - unicode_char_t group1, - unicode_char_t group2) + gunichar base, + gunichar group1, + gunichar group2) { /* If we are rendering with an XTIS font, we try to find a precomposed * glyph for the cluster. @@ -303,11 +301,11 @@ thai_engine_shape (PangoFont *font, PangoGlyphString *glyphs) { ThaiFontInfo *font_info; - const char *p, *next; + const char *p; - unicode_char_t base = 0; - unicode_char_t group1 = 0; - unicode_char_t group2 = 0; + gunichar base = 0; + gunichar group1 = 0; + gunichar group2 = 0; int cluster_start = 0; pango_glyph_string_set_size (glyphs, 0); @@ -318,9 +316,9 @@ thai_engine_shape (PangoFont *font, while (p < text + length) { int group; - unicode_char_t wc; + gunichar wc; - next = unicode_get_utf8 (p, &wc); + wc = g_utf8_get_char (p); if (wc >= 0xe30 && wc < 0xe50) group = groups[wc - 0xe30]; @@ -347,7 +345,7 @@ thai_engine_shape (PangoFont *font, break; } - p = next; + p = g_utf8_next_char (p); } if (base) @@ -364,7 +362,7 @@ thai_engine_get_coverage (PangoFont *font, if (font_info->type != THAI_FONT_NONE) { - unicode_char_t wc; + gunichar wc; for (wc = 0xe01; wc <= 0xe3a; wc++) pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT); |