Index: pango/pango-glyph.h
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-glyph.h,v
retrieving revision 1.11
diff -u -p -u -r1.11 pango-glyph.h
--- pango/pango-glyph.h	8 Nov 2002 19:00:52 -0000	1.11
+++ pango/pango-glyph.h	28 Feb 2004 13:39:26 -0000
@@ -77,6 +77,10 @@ struct _PangoGlyphString {
 
   /*< private >*/
   gint space;
+
+  gboolean has_cache;
+  PangoRectangle ink_rect;
+  PangoRectangle logical_rect;
 };
 
 #define PANGO_TYPE_GLYPH_STRING (pango_glyph_string_get_type ())
Index: pango/glyphstring.c
===================================================================
RCS file: /cvs/gnome/pango/pango/glyphstring.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 glyphstring.c
--- pango/glyphstring.c	24 Jul 2003 19:04:47 -0000	1.18
+++ pango/glyphstring.c	28 Feb 2004 13:39:32 -0000
@@ -39,6 +39,7 @@ pango_glyph_string_new (void)
   string->space = 0;
   string->glyphs = NULL;
   string->log_clusters = NULL;
+  string->has_cache = FALSE;
 
   return string;
 }
@@ -55,6 +56,8 @@ pango_glyph_string_set_size (PangoGlyphS
 {
   g_return_if_fail (new_len >= 0);
 
+  string->has_cache = FALSE;
+  
   while (new_len > string->space)
     {
       if (string->space == 0)
@@ -252,8 +255,20 @@ pango_glyph_string_extents (PangoGlyphSt
 			    PangoRectangle   *ink_rect,
 			    PangoRectangle   *logical_rect)
 {
-  pango_glyph_string_extents_range (glyphs, 0, glyphs->num_glyphs,
-                                    font, ink_rect, logical_rect);
+  if (!glyphs->has_cache)
+    {
+      pango_glyph_string_extents_range (glyphs, 0, glyphs->num_glyphs, font,
+					&glyphs->ink_rect,
+					&glyphs->logical_rect);
+
+      glyphs->has_cache = TRUE;
+    }
+
+  if (ink_rect)
+    *ink_rect = glyphs->ink_rect;
+
+  if (logical_rect)
+    *logical_rect = glyphs->logical_rect;
 }
 
 /**
