diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-01-17 23:00:18 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-01-17 23:00:18 +0000 |
commit | 620fb9ffc8ce07446ab341630e37900d7c9c102b (patch) | |
tree | f6924b9416bfc734615e47403069b091b8bde7cf /modules | |
parent | 08be81c00f4fce735979e6a684eeade00c1ce328 (diff) | |
download | pango-620fb9ffc8ce07446ab341630e37900d7c9c102b.tar.gz |
Switch GlyphStrings to have a single array of PangoGlyphInfo instead of
Sat Jan 15 03:17:35 2000 Owen Taylor <otaylor@redhat.com>
* pango/glyphstring.c pango/mapping.c pango/pangox.c
modules/basic.c examples/viewer.c:
Switch GlyphStrings to have a single array of
PangoGlyphInfo instead of multiple arrays. Rename
PangoGlyphIndex to PangoGlyph.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/basic/basic-x.c | 52 | ||||
-rw-r--r-- | modules/basic/basic.c | 52 | ||||
-rw-r--r-- | modules/hangul/hangul-x.c | 43 | ||||
-rw-r--r-- | modules/hangul/hangul.c | 43 | ||||
-rw-r--r-- | modules/tamil/tamil-x.c | 4 | ||||
-rw-r--r-- | modules/tamil/tamil.c | 4 |
6 files changed, 76 insertions, 122 deletions
diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c index f1ac5649..c0aee5a8 100644 --- a/modules/basic/basic-x.c +++ b/modules/basic/basic-x.c @@ -35,7 +35,7 @@ typedef struct _Charset Charset; typedef struct _CharCache CharCache; typedef struct _MaskTable MaskTable; -typedef PangoGlyphIndex (*ConvFunc) (CharCache *cache, +typedef PangoGlyph (*ConvFunc) (CharCache *cache, gchar *id, gchar *input); @@ -68,13 +68,13 @@ struct _CharCache GHashTable *converters; }; -static PangoGlyphIndex conv_8bit (CharCache *cache, +static PangoGlyph conv_8bit (CharCache *cache, gchar *id, char *input); -static PangoGlyphIndex conv_euc (CharCache *cache, +static PangoGlyph conv_euc (CharCache *cache, gchar *id, char *input); -static PangoGlyphIndex conv_ucs4 (CharCache *cache, +static PangoGlyph conv_ucs4 (CharCache *cache, gchar *id, char *input); @@ -205,7 +205,7 @@ char_cache_free (CharCache *cache) g_free (cache); } -PangoGlyphIndex +PangoGlyph find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) { guint mask = find_char_mask (wc); @@ -262,8 +262,8 @@ find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) for (i=0; i < mask_table->n_charsets; i++) { - PangoGlyphIndex index; - PangoGlyphIndex glyph; + PangoGlyph index; + PangoGlyph glyph; index = (*mask_table->charsets[i]->conv_func) (cache, mask_table->charsets[i]->id, input); @@ -277,20 +277,20 @@ find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) } static void -set_glyph (PangoFont *font, PangoGlyphString *glyphs, gint i, PangoGlyphIndex glyph) +set_glyph (PangoFont *font, PangoGlyphString *glyphs, gint i, PangoGlyph glyph) { gint width; glyphs->glyphs[i].glyph = glyph; - glyphs->geometry[i].x_offset = 0; - glyphs->geometry[i].y_offset = 0; + glyphs->glyphs[i].geometry.x_offset = 0; + glyphs->glyphs[i].geometry.y_offset = 0; glyphs->log_clusters[i] = i; pango_x_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, NULL, &width, NULL, NULL, NULL, NULL); - glyphs->geometry[i].width = width * 72; + glyphs->glyphs[i].geometry.width = width * 72; } static iconv_t @@ -306,7 +306,7 @@ find_converter (CharCache *cache, gchar *id) return cd; } -static PangoGlyphIndex +static PangoGlyph conv_8bit (CharCache *cache, gchar *id, char *input) @@ -331,7 +331,7 @@ conv_8bit (CharCache *cache, return (guchar)outbuf; } -static PangoGlyphIndex +static PangoGlyph conv_euc (CharCache *cache, gchar *id, char *input) @@ -359,7 +359,7 @@ conv_euc (CharCache *cache, return ((guchar)outbuf[0] & 0x7f) * 256 + ((guchar)outbuf[1] & 0x7f); } -static PangoGlyphIndex +static PangoGlyph conv_ucs4 (CharCache *cache, gchar *id, char *input) @@ -377,22 +377,12 @@ swap_range (PangoGlyphString *glyphs, int start, int end) for (i = start, j = end - 1; i < j; i++, j--) { - PangoGlyph glyph; - PangoGlyphGeometry geometry; - PangoGlyphVisAttr attr; + PangoGlyphInfo glyph_info; gint log_cluster; - glyph = glyphs->glyphs[i]; + glyph_info = glyphs->glyphs[i]; glyphs->glyphs[i] = glyphs->glyphs[j]; - glyphs->glyphs[j] = glyph; - - geometry = glyphs->geometry[i]; - glyphs->geometry[i] = glyphs->geometry[j]; - glyphs->geometry[j] = geometry; - - attr = glyphs->attrs[i]; - glyphs->attrs[i] = glyphs->attrs[j]; - glyphs->attrs[j] = attr; + glyphs->glyphs[j] = glyph_info; log_cluster = glyphs->log_clusters[i]; glyphs->log_clusters[i] = glyphs->log_clusters[j]; @@ -435,7 +425,7 @@ basic_engine_shape (PangoFont *font, { GUChar4 wc; FriBidiChar mirrored_ch; - PangoGlyphIndex index; + PangoGlyph index; _pango_utf8_iterate (p, &next, &wc); @@ -452,9 +442,9 @@ basic_engine_shape (PangoFont *font, { if (i > 0) { - glyphs->geometry[i].width = MAX (glyphs->geometry[i-1].width, - glyphs->geometry[i].width); - glyphs->geometry[i-1].width = 0; + glyphs->glyphs[i].geometry.width = MAX (glyphs->glyphs[i-1].geometry.width, + glyphs->glyphs[i].geometry.width); + glyphs->glyphs[i-1].geometry.width = 0; glyphs->log_clusters[i] = glyphs->log_clusters[i-1]; } } diff --git a/modules/basic/basic.c b/modules/basic/basic.c index f1ac5649..c0aee5a8 100644 --- a/modules/basic/basic.c +++ b/modules/basic/basic.c @@ -35,7 +35,7 @@ typedef struct _Charset Charset; typedef struct _CharCache CharCache; typedef struct _MaskTable MaskTable; -typedef PangoGlyphIndex (*ConvFunc) (CharCache *cache, +typedef PangoGlyph (*ConvFunc) (CharCache *cache, gchar *id, gchar *input); @@ -68,13 +68,13 @@ struct _CharCache GHashTable *converters; }; -static PangoGlyphIndex conv_8bit (CharCache *cache, +static PangoGlyph conv_8bit (CharCache *cache, gchar *id, char *input); -static PangoGlyphIndex conv_euc (CharCache *cache, +static PangoGlyph conv_euc (CharCache *cache, gchar *id, char *input); -static PangoGlyphIndex conv_ucs4 (CharCache *cache, +static PangoGlyph conv_ucs4 (CharCache *cache, gchar *id, char *input); @@ -205,7 +205,7 @@ char_cache_free (CharCache *cache) g_free (cache); } -PangoGlyphIndex +PangoGlyph find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) { guint mask = find_char_mask (wc); @@ -262,8 +262,8 @@ find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) for (i=0; i < mask_table->n_charsets; i++) { - PangoGlyphIndex index; - PangoGlyphIndex glyph; + PangoGlyph index; + PangoGlyph glyph; index = (*mask_table->charsets[i]->conv_func) (cache, mask_table->charsets[i]->id, input); @@ -277,20 +277,20 @@ find_char (CharCache *cache, PangoFont *font, GUChar4 wc, char *input) } static void -set_glyph (PangoFont *font, PangoGlyphString *glyphs, gint i, PangoGlyphIndex glyph) +set_glyph (PangoFont *font, PangoGlyphString *glyphs, gint i, PangoGlyph glyph) { gint width; glyphs->glyphs[i].glyph = glyph; - glyphs->geometry[i].x_offset = 0; - glyphs->geometry[i].y_offset = 0; + glyphs->glyphs[i].geometry.x_offset = 0; + glyphs->glyphs[i].geometry.y_offset = 0; glyphs->log_clusters[i] = i; pango_x_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, NULL, &width, NULL, NULL, NULL, NULL); - glyphs->geometry[i].width = width * 72; + glyphs->glyphs[i].geometry.width = width * 72; } static iconv_t @@ -306,7 +306,7 @@ find_converter (CharCache *cache, gchar *id) return cd; } -static PangoGlyphIndex +static PangoGlyph conv_8bit (CharCache *cache, gchar *id, char *input) @@ -331,7 +331,7 @@ conv_8bit (CharCache *cache, return (guchar)outbuf; } -static PangoGlyphIndex +static PangoGlyph conv_euc (CharCache *cache, gchar *id, char *input) @@ -359,7 +359,7 @@ conv_euc (CharCache *cache, return ((guchar)outbuf[0] & 0x7f) * 256 + ((guchar)outbuf[1] & 0x7f); } -static PangoGlyphIndex +static PangoGlyph conv_ucs4 (CharCache *cache, gchar *id, char *input) @@ -377,22 +377,12 @@ swap_range (PangoGlyphString *glyphs, int start, int end) for (i = start, j = end - 1; i < j; i++, j--) { - PangoGlyph glyph; - PangoGlyphGeometry geometry; - PangoGlyphVisAttr attr; + PangoGlyphInfo glyph_info; gint log_cluster; - glyph = glyphs->glyphs[i]; + glyph_info = glyphs->glyphs[i]; glyphs->glyphs[i] = glyphs->glyphs[j]; - glyphs->glyphs[j] = glyph; - - geometry = glyphs->geometry[i]; - glyphs->geometry[i] = glyphs->geometry[j]; - glyphs->geometry[j] = geometry; - - attr = glyphs->attrs[i]; - glyphs->attrs[i] = glyphs->attrs[j]; - glyphs->attrs[j] = attr; + glyphs->glyphs[j] = glyph_info; log_cluster = glyphs->log_clusters[i]; glyphs->log_clusters[i] = glyphs->log_clusters[j]; @@ -435,7 +425,7 @@ basic_engine_shape (PangoFont *font, { GUChar4 wc; FriBidiChar mirrored_ch; - PangoGlyphIndex index; + PangoGlyph index; _pango_utf8_iterate (p, &next, &wc); @@ -452,9 +442,9 @@ basic_engine_shape (PangoFont *font, { if (i > 0) { - glyphs->geometry[i].width = MAX (glyphs->geometry[i-1].width, - glyphs->geometry[i].width); - glyphs->geometry[i-1].width = 0; + glyphs->glyphs[i].geometry.width = MAX (glyphs->glyphs[i-1].geometry.width, + glyphs->glyphs[i].geometry.width); + glyphs->glyphs[i-1].geometry.width = 0; glyphs->log_clusters[i] = glyphs->log_clusters[i-1]; } } diff --git a/modules/hangul/hangul-x.c b/modules/hangul/hangul-x.c index b76ed86f..6198972e 100644 --- a/modules/hangul/hangul-x.c +++ b/modules/hangul/hangul-x.c @@ -90,7 +90,7 @@ hangul_engine_lang_new () static void set_glyph (PangoGlyphString *glyphs, gint i, PangoCFont *cfont, - PangoGlyphIndex glyph) + PangoGlyph glyph) { gint width; @@ -146,7 +146,7 @@ typedef void (* RenderSyllableFunc) (PangoCFont *cfont, #define JOHAB_COMMON \ int i; \ - PangoGlyphIndex gindex; \ + PangoGlyph gindex; \ \ /* \ * Check if there are one CHOSEONG, one JUNGSEONG, and no more \ @@ -340,7 +340,7 @@ render_syllable_with_iso10646 (PangoCFont *cfont, PangoGlyphString *glyphs, int *n_glyphs, int n_clusters) { - PangoGlyphIndex gindex; + PangoGlyph gindex; int i; /* @@ -409,7 +409,7 @@ render_syllable_with_ksc5601 (PangoCFont *cfont, int *n_glyphs, int n_clusters) { guint16 sindex; - PangoGlyphIndex gindex; + PangoGlyph gindex; int i; /* @@ -495,19 +495,6 @@ render_syllable_with_ksc5601 (PangoCFont *cfont, } } -/* Compare the tail of a to b */ -static gboolean -match_end (char *a, char *b) -{ - size_t len_a = strlen (a); - size_t len_b = strlen (b); - - if (len_b > len_a) - return FALSE; - else - return (strcmp (a + len_a - len_b, b) == 0); -} - static gboolean ranges_include_korean (int *ranges, int n_ranges) @@ -530,8 +517,8 @@ ranges_include_korean (int *ranges, } static gboolean -find_cfont (PangoFont *font, gchar **charsets, gint n_charsets, - PangoCFont **cfont, RenderSyllableFunc *render_func) +find_charset (PangoFont *font, gchar **charsets, gint n_charsets, + PangoXCharset *charset, RenderSyllableFunc *render_func) { int i; char **xlfds; @@ -587,13 +574,13 @@ find_cfont (PangoFont *font, gchar **charsets, gint n_charsets, } static void -hangul_engine_shape (PangoFont *font, - gchar *text, - gint length, - PangoAnalysis *analysis, - PangoGlyphString *glyphs) +hangul_engine_shape (PangoFont *font, + gchar *text, + gint length, + PangoAnalysis *analysis, + PangoGlyphString *glyphs) { - PangoCFont *cfont; + PangoXCharset *charset_id; RenderSyllableFunc render_func = NULL; char *ptr, *next; @@ -625,9 +612,9 @@ hangul_engine_shape (PangoFont *font, * otherwise use iso-10646 or KSC font depending on the ordering * of the fontlist. */ - if (!find_cfont (font, default_charset, 1, &cfont, &render_func)) - if (!find_cfont (font, secondary_charset, 1, &cfont, &render_func)) - if (!find_cfont (font, fallback_charsets, 2, &cfont, &render_func)) + if (!find_charset (font, default_charset, 1, &cfont, &render_func)) + if (!find_charset (font, secondary_charset, 1, &cfont, &render_func)) + if (!find_charset (font, fallback_charsets, 2, &cfont, &render_func)) { g_warning ("No available Hangul fonts."); return; diff --git a/modules/hangul/hangul.c b/modules/hangul/hangul.c index b76ed86f..6198972e 100644 --- a/modules/hangul/hangul.c +++ b/modules/hangul/hangul.c @@ -90,7 +90,7 @@ hangul_engine_lang_new () static void set_glyph (PangoGlyphString *glyphs, gint i, PangoCFont *cfont, - PangoGlyphIndex glyph) + PangoGlyph glyph) { gint width; @@ -146,7 +146,7 @@ typedef void (* RenderSyllableFunc) (PangoCFont *cfont, #define JOHAB_COMMON \ int i; \ - PangoGlyphIndex gindex; \ + PangoGlyph gindex; \ \ /* \ * Check if there are one CHOSEONG, one JUNGSEONG, and no more \ @@ -340,7 +340,7 @@ render_syllable_with_iso10646 (PangoCFont *cfont, PangoGlyphString *glyphs, int *n_glyphs, int n_clusters) { - PangoGlyphIndex gindex; + PangoGlyph gindex; int i; /* @@ -409,7 +409,7 @@ render_syllable_with_ksc5601 (PangoCFont *cfont, int *n_glyphs, int n_clusters) { guint16 sindex; - PangoGlyphIndex gindex; + PangoGlyph gindex; int i; /* @@ -495,19 +495,6 @@ render_syllable_with_ksc5601 (PangoCFont *cfont, } } -/* Compare the tail of a to b */ -static gboolean -match_end (char *a, char *b) -{ - size_t len_a = strlen (a); - size_t len_b = strlen (b); - - if (len_b > len_a) - return FALSE; - else - return (strcmp (a + len_a - len_b, b) == 0); -} - static gboolean ranges_include_korean (int *ranges, int n_ranges) @@ -530,8 +517,8 @@ ranges_include_korean (int *ranges, } static gboolean -find_cfont (PangoFont *font, gchar **charsets, gint n_charsets, - PangoCFont **cfont, RenderSyllableFunc *render_func) +find_charset (PangoFont *font, gchar **charsets, gint n_charsets, + PangoXCharset *charset, RenderSyllableFunc *render_func) { int i; char **xlfds; @@ -587,13 +574,13 @@ find_cfont (PangoFont *font, gchar **charsets, gint n_charsets, } static void -hangul_engine_shape (PangoFont *font, - gchar *text, - gint length, - PangoAnalysis *analysis, - PangoGlyphString *glyphs) +hangul_engine_shape (PangoFont *font, + gchar *text, + gint length, + PangoAnalysis *analysis, + PangoGlyphString *glyphs) { - PangoCFont *cfont; + PangoXCharset *charset_id; RenderSyllableFunc render_func = NULL; char *ptr, *next; @@ -625,9 +612,9 @@ hangul_engine_shape (PangoFont *font, * otherwise use iso-10646 or KSC font depending on the ordering * of the fontlist. */ - if (!find_cfont (font, default_charset, 1, &cfont, &render_func)) - if (!find_cfont (font, secondary_charset, 1, &cfont, &render_func)) - if (!find_cfont (font, fallback_charsets, 2, &cfont, &render_func)) + if (!find_charset (font, default_charset, 1, &cfont, &render_func)) + if (!find_charset (font, secondary_charset, 1, &cfont, &render_func)) + if (!find_charset (font, fallback_charsets, 2, &cfont, &render_func)) { g_warning ("No available Hangul fonts."); return; diff --git a/modules/tamil/tamil-x.c b/modules/tamil/tamil-x.c index 934bd216..4d0d5d9a 100644 --- a/modules/tamil/tamil-x.c +++ b/modules/tamil/tamil-x.c @@ -96,7 +96,7 @@ tamil_engine_lang_new () * But we can live with this for time being */ static void -set_glyph (PangoGlyphString *glyphs, gint i, PangoCFont *cfont, PangoGlyphIndex glyph) +set_glyph (PangoGlyphString *glyphs, gint i, PangoCFont *cfont, PangoGlyph glyph) { gint width; @@ -170,7 +170,7 @@ tamil_engine_shape (PangoFont *font, } for (i = 0; i < ntsc; i++) { - set_glyph (glyphs, n_glyph, tscii_font, (PangoGlyphIndex) tsc_str[i]); + set_glyph (glyphs, n_glyph, tscii_font, (PangoGlyph) tsc_str[i]); n_glyph++; } j = j + nuni; diff --git a/modules/tamil/tamil.c b/modules/tamil/tamil.c index 934bd216..4d0d5d9a 100644 --- a/modules/tamil/tamil.c +++ b/modules/tamil/tamil.c @@ -96,7 +96,7 @@ tamil_engine_lang_new () * But we can live with this for time being */ static void -set_glyph (PangoGlyphString *glyphs, gint i, PangoCFont *cfont, PangoGlyphIndex glyph) +set_glyph (PangoGlyphString *glyphs, gint i, PangoCFont *cfont, PangoGlyph glyph) { gint width; @@ -170,7 +170,7 @@ tamil_engine_shape (PangoFont *font, } for (i = 0; i < ntsc; i++) { - set_glyph (glyphs, n_glyph, tscii_font, (PangoGlyphIndex) tsc_str[i]); + set_glyph (glyphs, n_glyph, tscii_font, (PangoGlyph) tsc_str[i]); n_glyph++; } j = j + nuni; |