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/arabic | |
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/arabic')
-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 |
6 files changed, 60 insertions, 75 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; |