Index: gdk/gdkpango.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkpango.c,v
retrieving revision 1.51
diff -u -p -d -r1.51 gdkpango.c
--- gdk/gdkpango.c	28 Apr 2006 07:02:04 -0000	1.51
+++ gdk/gdkpango.c	22 May 2006 00:38:13 -0000
@@ -1416,19 +1416,15 @@ gdk_pango_context_get_for_screen (GdkScr
   PangoFontMap *fontmap;
   PangoContext *context;
   const cairo_font_options_t *options;
-  double dpi;
   
   g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
 
-  fontmap = pango_cairo_font_map_get_default ();
+  fontmap = gdk_screen_get_font_map (screen);
   
   context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
 
   options = gdk_screen_get_font_options (screen);
   pango_cairo_context_set_font_options (context, options);
-
-  dpi = gdk_screen_get_resolution (screen);
-  pango_cairo_context_set_resolution (context, dpi);
 
   return context;
 }
Index: gdk/gdkscreen.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkscreen.c,v
retrieving revision 1.28
diff -u -p -d -r1.28 gdkscreen.c
--- gdk/gdkscreen.c	14 May 2006 03:58:05 -0000	1.28
+++ gdk/gdkscreen.c	22 May 2006 00:38:13 -0000
@@ -164,6 +164,9 @@ gdk_screen_finalize (GObject *object)
   if (screen->font_options)
       cairo_font_options_destroy (screen->font_options);
 
+  if (screen->fontmap)
+      g_object_unref (screen->fontmap);
+
   G_OBJECT_CLASS (gdk_screen_parent_class)->finalize (object);
 }
 
@@ -369,6 +372,43 @@ gdk_screen_height_mm (void)
   return gdk_screen_get_height_mm (gdk_screen_get_default ());
 }
 
+static void
+update_fontmap_resolution (GdkScreen                  *screen)
+{
+  double dpi = screen->resolution;
+
+  if (dpi < 0)
+    dpi = 96.0;
+
+  if (screen->fontmap)
+    pango_cairo_font_map_set_resolution (screen->fontmap, dpi);
+}
+
+/**
+ * gdk_screen_get_font_map:
+ * @screen: a #GdkScreen
+ *
+ * Gets the Pango fontmap for this screen that is used to create
+ * #PangoContext, with the right resolution set on it.
+ *
+ * Return value: the fontmap.
+ *
+ * Since: 2.10
+ **/
+PangoFontMap *
+gdk_screen_get_font_map (GdkScreen                  *screen)
+{
+    g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+    if (G_UNLIKELY (!screen->fontmap))
+      {
+        screen->fontmap = pango_cairo_font_map_new ();
+	update_fontmap_resolution (screen);
+      }
+    
+    return screen->fontmap;
+}
+
 /**
  * gdk_screen_set_font_options:
  * @screen: a #GdkScreen
@@ -447,6 +487,8 @@ gdk_screen_set_resolution (GdkScreen *sc
     if (screen->resolution != dpi)
       {
 	screen->resolution = dpi;
+
+	update_fontmap_resolution (screen);
 
 	g_object_notify (G_OBJECT (screen), "resolution");
       }
Index: gdk/gdkscreen.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkscreen.h,v
retrieving revision 1.19
diff -u -p -d -r1.19 gdkscreen.h
--- gdk/gdkscreen.h	25 Apr 2006 14:27:28 -0000	1.19
+++ gdk/gdkscreen.h	22 May 2006 00:38:13 -0000
@@ -25,6 +25,7 @@
 #define __GDK_SCREEN_H__
 
 #include <cairo.h>
+#include <pango/pango.h>
 #include "gdk/gdktypes.h"
 #include "gdk/gdkdisplay.h"
 
@@ -50,6 +51,7 @@ struct _GdkScreen
 
   cairo_font_options_t *font_options;
   double resolution;		/* pixels/points scale factor for fonts */
+  PangoFontMap *fontmap;
 };
 
 struct _GdkScreenClass
@@ -102,6 +104,8 @@ GdkScreen *gdk_screen_get_default (void)
 gboolean   gdk_screen_get_setting (GdkScreen   *screen,
 				   const gchar *name,
 				   GValue      *value);
+
+PangoFontMap *gdk_screen_get_font_map (GdkScreen *screen);
 
 void                        gdk_screen_set_font_options (GdkScreen                  *screen,
 							 const cairo_font_options_t *options);
