summaryrefslogtreecommitdiff
path: root/pango
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 /pango
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.
Diffstat (limited to 'pango')
-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
5 files changed, 73 insertions, 73 deletions
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
}