Index: pango/pangofc-fontmap.cI
===================================================================
RCS file: /cvs/gnome/pango/pango/pangofc-fontmap.cI,v
retrieving revision 1.6
diff -u -p -u -r1.6 pangofc-fontmap.cI
--- pango/pangofc-fontmap.cI	17 Dec 2002 02:07:36 -0000	1.6
+++ pango/pangofc-fontmap.cI	8 Feb 2003 15:18:03 -0000
@@ -664,12 +664,22 @@ pango_fc_font_map_load_fontset (PangoFon
 				 const PangoFontDescription   *desc,
 				 PangoLanguage                *language)
 {
+  PangoFcFontMap *fcfontmap = (PangoFcFontMap *)fontmap;
   PangoFontsetSimple *simple;
   int i;
   PangoFcPatternSet *patterns = pango_fc_font_map_get_patterns (fontmap, context, desc, language);
   if (!patterns)
     return NULL;
-	  
+
+  if (fcfontmap->cached_fontset &&
+      fcfontmap->cached_fontset_patterns == patterns)
+    {
+      g_print ("hit\n");
+      return g_object_ref (fcfontmap->cached_fontset);
+    }
+  else
+    g_print ("miss\n");
+
   simple = pango_fontset_simple_new (language);
 
   for (i = 0; i < patterns->n_patterns; i++)
@@ -678,7 +688,13 @@ pango_fc_font_map_load_fontset (PangoFon
       if (font)
 	pango_fontset_simple_append (simple, font);
     }
-  
+
+  if (fcfontmap->cached_fontset)
+    g_object_unref (G_OBJECT (fcfontmap->cached_fontset));
+
+  fcfontmap->cached_fontset = g_object_ref (simple);
+  fcfontmap->cached_fontset_patterns = patterns;
+    
   return PANGO_FONTSET (simple);
 }
 
Index: pango/pangoft2-fontmap.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pangoft2-fontmap.c,v
retrieving revision 1.44
diff -u -p -u -r1.44 pangoft2-fontmap.c
--- pango/pangoft2-fontmap.c	3 Dec 2002 06:43:10 -0000	1.44
+++ pango/pangoft2-fontmap.c	8 Feb 2003 15:18:03 -0000
@@ -60,6 +60,8 @@ struct _PangoFT2FontMap
    */
   GHashTable *pattern_hash; 
   GHashTable *coverage_hash; /* Maps font file name -> PangoCoverage */
+  PangoFontset *cached_fontset;
+  void *cached_fontset_patterns;
 
   GHashTable *fonts; /* Maps XftPattern -> PangoFT2Font */
   GQueue *freed_fonts; /* Fonts in fonts that has been freed */
Index: pango/pangoxft-fontmap.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pangoxft-fontmap.c,v
retrieving revision 1.38
diff -u -p -u -r1.38 pangoxft-fontmap.c
--- pango/pangoxft-fontmap.c	7 Dec 2002 06:08:39 -0000	1.38
+++ pango/pangoxft-fontmap.c	8 Feb 2003 15:18:05 -0000
@@ -50,6 +50,8 @@ struct _PangoXftFontMap
    */
   GHashTable *pattern_hash; 
   GHashTable *coverage_hash; /* Maps font file name/id -> PangoCoverage */
+  PangoFontset *cached_fontset;
+  void *cached_fontset_patterns;
 
   GHashTable *fonts; /* Maps XftPattern -> PangoXftFont */
   GQueue *freed_fonts; /* Fonts in fonts that has been freed */
