summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-01-17 23:00:18 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-01-17 23:00:18 +0000
commit620fb9ffc8ce07446ab341630e37900d7c9c102b (patch)
treef6924b9416bfc734615e47403069b091b8bde7cf
parent08be81c00f4fce735979e6a684eeade00c1ce328 (diff)
downloadpango-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.
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.pre-1-09
-rw-r--r--ChangeLog.pre-1-109
-rw-r--r--ChangeLog.pre-1-29
-rw-r--r--ChangeLog.pre-1-49
-rw-r--r--ChangeLog.pre-1-69
-rw-r--r--ChangeLog.pre-1-89
-rw-r--r--TODO76
-rw-r--r--examples/viewer.c2
-rw-r--r--modules/basic/basic-x.c52
-rw-r--r--modules/basic/basic.c52
-rw-r--r--modules/hangul/hangul-x.c43
-rw-r--r--modules/hangul/hangul.c43
-rw-r--r--modules/tamil/tamil-x.c4
-rw-r--r--modules/tamil/tamil.c4
-rw-r--r--pango/glyphstring.c8
-rw-r--r--pango/mapping.c30
-rw-r--r--pango/pango.h27
-rw-r--r--pango/pangox.c12
-rw-r--r--pango/pangox.h69
20 files changed, 281 insertions, 204 deletions
diff --git a/ChangeLog b/ChangeLog
index bf398ac7..f7025d72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
Sat Jan 15 01:06:45 2000 Owen Taylor <otaylor@redhat.com>
* libpango/pangox.c libpango/pangox.h libpango/fonts.c
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index bf398ac7..f7025d72 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,12 @@
+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.
+
Sat Jan 15 01:06:45 2000 Owen Taylor <otaylor@redhat.com>
* libpango/pangox.c libpango/pangox.h libpango/fonts.c
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index bf398ac7..f7025d72 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,12 @@
+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.
+
Sat Jan 15 01:06:45 2000 Owen Taylor <otaylor@redhat.com>
* libpango/pangox.c libpango/pangox.h libpango/fonts.c
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index bf398ac7..f7025d72 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,12 @@
+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.
+
Sat Jan 15 01:06:45 2000 Owen Taylor <otaylor@redhat.com>
* libpango/pangox.c libpango/pangox.h libpango/fonts.c
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index bf398ac7..f7025d72 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,12 @@
+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.
+
Sat Jan 15 01:06:45 2000 Owen Taylor <otaylor@redhat.com>
* libpango/pangox.c libpango/pangox.h libpango/fonts.c
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index bf398ac7..f7025d72 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,12 @@
+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.
+
Sat Jan 15 01:06:45 2000 Owen Taylor <otaylor@redhat.com>
* libpango/pangox.c libpango/pangox.h libpango/fonts.c
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index bf398ac7..f7025d72 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,12 @@
+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.
+
Sat Jan 15 01:06:45 2000 Owen Taylor <otaylor@redhat.com>
* libpango/pangox.c libpango/pangox.h libpango/fonts.c
diff --git a/TODO b/TODO
index a1628d3b..9398f277 100644
--- a/TODO
+++ b/TODO
@@ -1,23 +1,53 @@
+General
+=======
+
* Switch engines to be indentified by properties, instead
of hardcoded role/language. (?)
-* Get rid of PangoCFont, switch GlyphString to only have one
- array - an array of PangoGlyphInfo that includes
- index, geometry, visattrs
-
* Add a PangoLayout highlevel driver
* Add attributes data structures, feed attributed strings
into pango_itemize() (? is this necessary)
-* Rethink subsetting algorithms for X - the properties stuff
- is just _slow_. (Are we loading the same fonts too many
- times? Look into performance in general)
-
* Return error codes from all functions. Possible errors include
- Invalid string
- Font does not match
+ I think a good general way of doing this is to always
+ have an error object as a parameter to each function, but
+ allow that error object to be NULL, in which case a
+ global error object is used.
+
+ So, either
+
+
+ err = PANGO_ERROR_INIT;
+ pango_shape (..., &err);
+ if (PANGO_ERROR_CODE (&err) != NO_ERROR)
+ {
+ g_print ("An error %s occurred\n", PANGO_ERROR_STRING (&err));
+ pango_error_free (&err);
+ }
+
+ or:
+
+ pango_shape (..., NULL);
+ if (PANGO_ERROR_CODE (NULL) != NO_ERROR)
+ g_print ("An error %s occurred\n", PANGO_ERROR_STRING (NULL));
+
+ Also, whenever possible, the return value of each Pango function
+ will be a gboolean success code (and also, a pango function that
+ returns a pointer that cannot otherwise be NULL, will return NULL),
+ so we can write instead of the last one:
+
+ if (!pango_shape (..., NULL))
+ g_print ("An error %s occurred\n", PANGO_ERROR_STRING (NULL));
+
+ This always people who write non-threaded code to write conveniently,
+ while those who write threaded code can avoid pollution of return
+ values.
+
+
* Allow UTF8 strings with embedded NULLs.
* Write a small default shaping engine that only
@@ -26,3 +56,33 @@
* Convert over from utils.c to Tom Tromey's libunicode.
+X fonts
+=======
+
+* Currently, for X, a language module must use a fixed priority
+ for the various encodings it can use; it can't distinguish:
+
+ good-unicode-subset-font
+ good-ksc-font
+ bad-unicode-full-fallback
+
+ from:
+
+ good-unicode-subset-font
+ bad-unicode-full-fallback
+ good-ksc-font
+
+ In either case if queried if a particular Unicode code-point, exists
+ in the font, it will return YES, and the bad-unicode-full-fallback
+ will be used.
+
+ void pango_x_list_subfonts (font, charsets, n_charsets, &subfonts_xlfds,
+ &subfont_charsets, &subfont_ids, &n_subfonts);
+
+ Note that this call adds the queried subfonts to an internal list for
+ the font. Subfonts once queried take up a small amount of memory
+ (enough for the name), subfonts, once accessed, will retain the full
+ amount of memory for the X font until the entire font is freed.
+
+ Then for each mask, we assemble a list of subfont-ids ordered.
+
diff --git a/examples/viewer.c b/examples/viewer.c
index 82da2d4a..9a719e5d 100644
--- a/examples/viewer.c
+++ b/examples/viewer.c
@@ -183,7 +183,7 @@ get_logical_widths (char *text, PangoItem *item,
}
if (i < glyphs->num_glyphs)
- width += glyphs->geometry[index].width;
+ width += glyphs->glyphs[i].geometry.width;
}
}
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;
diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index 82d7d440..a7cc9cea 100644
--- a/pango/glyphstring.c
+++ b/pango/glyphstring.c
@@ -37,8 +37,6 @@ pango_glyph_string_new (void)
string->num_glyphs = 0;
string->space = 0;
string->glyphs = NULL;
- string->geometry = NULL;
- string->attrs = NULL;
string->log_clusters = NULL;
return string;
@@ -67,9 +65,7 @@ pango_glyph_string_set_size (PangoGlyphString *string, gint new_len)
string->space = G_MAXINT;
}
- string->glyphs = g_realloc (string->glyphs, string->space * sizeof (PangoGlyph));
- string->geometry = g_realloc (string->geometry, string->space * sizeof (PangoGlyphGeometry));
- string->attrs = g_realloc (string->attrs, string->space * sizeof (PangoGlyphVisAttr));
+ string->glyphs = g_realloc (string->glyphs, string->space * sizeof (PangoGlyphInfo));
string->log_clusters = g_realloc (string->log_clusters, string->space * sizeof (gint));
string->num_glyphs = new_len;
}
@@ -84,8 +80,6 @@ void
pango_glyph_string_free (PangoGlyphString *string)
{
g_free (string->glyphs);
- g_free (string->geometry);
- g_free (string->attrs);
g_free (string->log_clusters);
g_free (string);
}
diff --git a/pango/mapping.c b/pango/mapping.c
index bd0cb3de..470b2085 100644
--- a/pango/mapping.c
+++ b/pango/mapping.c
@@ -48,13 +48,13 @@
*/
void
-pango_cp_to_x (gchar *text,
- gint length,
- PangoAnalysis *analysis,
- PangoGlyphString *glyphs,
- gint char_pos,
- gboolean trailing,
- gint *x_pos)
+pango_cp_to_x (gchar *text,
+ gint length,
+ PangoAnalysis *analysis,
+ PangoGlyphString *glyphs,
+ gint char_pos,
+ gboolean trailing,
+ gint *x_pos)
{
gint i;
gint start_xpos = 0;
@@ -83,7 +83,7 @@ pango_cp_to_x (gchar *text,
if (analysis->level % 2) /* Right to left */
{
for (i = glyphs->num_glyphs - 1; i >= 0; i--)
- width += glyphs->geometry[i].width;
+ width += glyphs->glyphs[i].geometry.width;
for (i = glyphs->num_glyphs - 1; i >= 0; i--)
{
@@ -100,7 +100,7 @@ pango_cp_to_x (gchar *text,
start_xpos = width;
}
- width -= glyphs->geometry[i].width;
+ width -= glyphs->glyphs[i].geometry.width;
}
}
else /* Left to right */
@@ -120,7 +120,7 @@ pango_cp_to_x (gchar *text,
start_xpos = width;
}
- width += glyphs->geometry[i].width;
+ width += glyphs->glyphs[i].geometry.width;
}
}
@@ -190,7 +190,7 @@ pango_x_to_cp (gchar *text,
if (analysis->level % 2) /* Right to left */
{
for (i = glyphs->num_glyphs - 1; i >= 0; i--)
- width += glyphs->geometry[i].width;
+ width += glyphs->glyphs[i].geometry.width;
for (i = glyphs->num_glyphs - 1; i >= 0; i--)
{
@@ -209,9 +209,9 @@ pango_x_to_cp (gchar *text,
}
}
- width -= glyphs->geometry[i].width;
+ width -= glyphs->glyphs[i].geometry.width;
- if (width <= x_pos && x_pos < width + glyphs->geometry[i].width)
+ if (width <= x_pos && x_pos < width + glyphs->glyphs[i].geometry.width)
found = TRUE;
}
}
@@ -234,10 +234,10 @@ pango_x_to_cp (gchar *text,
}
}
- if (width <= x_pos && x_pos < width + glyphs->geometry[i].width)
+ if (width <= x_pos && x_pos < width + glyphs->glyphs[i].geometry.width)
found = TRUE;
- width += glyphs->geometry[i].width;
+ width += glyphs->glyphs[i].geometry.width;
}
}
diff --git a/pango/pango.h b/pango/pango.h
index efc3669e..96697408 100644
--- a/pango/pango.h
+++ b/pango/pango.h
@@ -47,9 +47,9 @@ typedef struct _PangoLogAttr PangoLogAttr;
typedef struct _PangoFont PangoFont;
typedef struct _PangoFontClass PangoFontClass;
-typedef struct _PangoGlyph PangoGlyph;
typedef struct _PangoGlyphGeometry PangoGlyphGeometry;
typedef struct _PangoGlyphVisAttr PangoGlyphVisAttr;
+typedef struct _PangoGlyphInfo PangoGlyphInfo;
typedef struct _PangoGlyphString PangoGlyphString;
typedef struct _PangoEngineInfo PangoEngineInfo;
@@ -161,16 +161,9 @@ void pango_font_set_data (PangoFont *font,
* GLYPH STORAGE
*/
-/* A index of a glyph into a PangoCFont. Rendering system dependent
+/* A index of a glyph into a font. Rendering system dependent
*/
-typedef guint32 PangoGlyphIndex;
-
-/* A single glyph
- */
-struct _PangoGlyph
-{
- PangoGlyphIndex glyph;
-};
+typedef guint32 PangoGlyph;
/* Positioning information about a glyph
*/
@@ -188,14 +181,22 @@ struct _PangoGlyphVisAttr
guint is_cluster_start : 1;
};
+/* A single glyph
+ */
+struct _PangoGlyphInfo
+{
+ PangoGlyph glyph;
+ PangoGlyphGeometry geometry;
+ PangoGlyphVisAttr attr;
+};
+
/* A string of glyphs with positional information and visual attributes -
* ready for drawing
*/
struct _PangoGlyphString {
gint num_glyphs;
- PangoGlyph *glyphs;
- PangoGlyphGeometry *geometry;
- PangoGlyphVisAttr *attrs;
+
+ PangoGlyphInfo *glyphs;
/* This is a memory inefficient way of representing the
* information here - each value gives the character index
diff --git a/pango/pangox.c b/pango/pangox.c
index e49d0465..aa34a361 100644
--- a/pango/pangox.c
+++ b/pango/pangox.c
@@ -164,11 +164,11 @@ pango_x_render (Display *display,
}
XDrawString16 (display, d, gc,
- x + glyphs->geometry[i].x_offset / 72,
- y + glyphs->geometry[i].y_offset / 72,
+ x + glyphs->glyphs[i].geometry.x_offset / 72,
+ y + glyphs->glyphs[i].geometry.y_offset / 72,
&c, 1);
- x += glyphs->geometry[i].width / 72;
+ x += glyphs->glyphs[i].geometry.width / 72;
}
}
}
@@ -190,7 +190,7 @@ pango_x_render (Display *display,
*/
void
pango_x_glyph_extents (PangoFont *font,
- PangoGlyphIndex glyph,
+ PangoGlyph glyph,
gint *lbearing,
gint *rbearing,
gint *width,
@@ -301,7 +301,7 @@ pango_x_extents (PangoFont *font,
guint16 index = PANGO_X_GLYPH_INDEX (glyphs->glyphs[i].glyph);
guint16 charset = PANGO_X_GLYPH_CHARSET (glyphs->glyphs[i].glyph);
- PangoGlyphGeometry *geometry = &glyphs->geometry[i];
+ PangoGlyphGeometry *geometry = &glyphs->glyphs[i].geometry;
PangoXCFont *cfont = pango_x_find_cfont (xfont, charset, index, &cs);
if (cfont)
@@ -499,7 +499,7 @@ pango_x_find_charset (PangoFont *font,
gboolean
pango_x_has_glyph (PangoFont *font,
- PangoGlyphIndex glyph)
+ PangoGlyph glyph)
{
PangoXFont *xfont = (PangoXFont *)font;
diff --git a/pango/pangox.h b/pango/pangox.h
index c3a7d7f2..63930256 100644
--- a/pango/pangox.h
+++ b/pango/pangox.h
@@ -35,46 +35,51 @@ extern "C" {
/* Calls for applications
*/
-PangoFont *pango_x_load_font (Display *display,
- gchar *spec);
-void pango_x_render (Display *display,
- Drawable d,
- GC gc,
- PangoFont *font,
- PangoGlyphString *glyphs,
- gint x,
- gint y);
-void pango_x_extents (PangoFont *font,
- PangoGlyphString *glyphs,
- gint *lbearing,
- gint *rbearing,
- gint *width,
- gint *ascent,
- gint *descent,
- gint *logical_ascent,
- gint *logical_descent);
-void pango_x_glyph_extents (PangoFont *font,
- PangoGlyphIndex glyph,
- gint *lbearing,
- gint *rbearing,
- gint *width,
- gint *ascent,
- gint *descent,
- gint *logical_ascent,
- gint *logical_descent);
+PangoFont * pango_x_load_font (Display *display,
+ char *spec);
+void pango_x_render (Display *display,
+ Drawable d,
+ GC gc,
+ PangoFont *font,
+ PangoGlyphString *glyphs,
+ int x,
+ int y);
+void pango_x_extents (PangoFont *font,
+ PangoGlyphString *glyphs,
+ int *lbearing,
+ int *rbearing,
+ int *width,
+ int *ascent,
+ int *descent,
+ int *logical_ascent,
+ int *logical_descent);
+void pango_x_glyph_extents (PangoFont *font,
+ PangoGlyph glyph,
+ int *lbearing,
+ int *rbearing,
+ int *width,
+ int *ascent,
+ int *descent,
+ int *logical_ascent,
+ int *logical_descent);
/* API for rendering modules
*/
-typedef guint16 PangoXCharset;
+typedef guint16 PangoXSubfontID;
-#define PANGO_X_MAKE_GLYPH(charset,index) (charset<<16 | index)
-#define PANGO_X_GLYPH_CHARSET(glyph) (glyph>>16)
+#define PANGO_X_MAKE_GLYPH(subfont,index) (subfont<<16 | index)
+#define PANGO_X_GLYPH_SUBFONT(glyph) (glyph>>16)
#define PANGO_X_GLYPH_INDEX(glyph) (glyph & 0xffff)
+void pango_x_list_charsets (PangoFont *font,
+ char **charsets,
+ int n_charsets,
+ int charsets);
+
PangoXCharset pango_x_find_charset (PangoFont *font,
- gchar *charset);
+ char *charset);
gboolean pango_x_has_glyph (PangoFont *font,
- PangoGlyphIndex glyph);
+ PangoGlyph glyph);
#ifdef __cplusplus
}