? asdf
Index: gdk/gdkinternals.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkinternals.h,v
retrieving revision 1.41
diff -u -p -d -r1.41 gdkinternals.h
--- gdk/gdkinternals.h	10 Apr 2006 19:43:08 -0000	1.41
+++ gdk/gdkinternals.h	22 May 2006 03:54:52 -0000
@@ -29,6 +29,7 @@
 #include <gdk/gdktypes.h>
 #include <gdk/gdkwindow.h>
 #include <gdk/gdkprivate.h>
+#include <pango/pango.h>
 
 #ifndef __GDK_INTERNALS_H__
 #define __GDK_INTERNALS_H__
@@ -403,6 +404,10 @@ void _gdk_windowing_gc_get_foreground (G
 /* Queries the current background color of a GdkGC */
 void _gdk_windowing_gc_get_background (GdkGC    *gc,
 				       GdkColor *color);
+
+/* Gets the fontmap for screen */
+PangoFontMap *
+_gdk_screen_get_font_map (GdkScreen *screen);
 
 /************************************
  * Initialization and exit routines *
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 03:54:52 -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 03:54:52 -0000
@@ -25,10 +25,23 @@
 #include "gdk.h"		/* For gdk_rectangle_intersect() */
 #include "gdkcolor.h"
 #include "gdkwindow.h"
+#include "gdkinternals.h"
 #include "gdkscreen.h"
 #include "gdkintl.h"
 #include "gdkalias.h"
 
+
+#define GDK_SCREEN_GET_PRIVATE(o)  \
+    (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDK_TYPE_SCREEN, GdkScreenPrivate))
+
+typedef struct _GdkScreenPrivate GdkScreenPrivate;
+
+struct _GdkScreenPrivate
+{
+  PangoFontMap *fontmap;
+};
+
+
 static void gdk_screen_dispose      (GObject        *object);
 static void gdk_screen_finalize     (GObject        *object);
 static void gdk_screen_set_property (GObject        *object,
@@ -124,6 +137,8 @@ gdk_screen_class_init (GdkScreenClass *k
 		  g_cclosure_marshal_VOID__VOID,
 		  G_TYPE_NONE,
 		  0);
+
+  g_type_class_add_private (klass, sizeof (GdkScreenPrivate));
 }
 
 static void
@@ -160,10 +175,14 @@ static void
 gdk_screen_finalize (GObject *object)
 {
   GdkScreen *screen = GDK_SCREEN (object);
+  GdkScreenPrivate *priv = GDK_SCREEN_GET_PRIVATE (screen);
 
   if (screen->font_options)
       cairo_font_options_destroy (screen->font_options);
 
+  if (priv->fontmap)
+      g_object_unref (priv->fontmap);
+
   G_OBJECT_CLASS (gdk_screen_parent_class)->finalize (object);
 }
 
@@ -369,6 +388,48 @@ gdk_screen_height_mm (void)
   return gdk_screen_get_height_mm (gdk_screen_get_default ());
 }
 
+static void
+update_fontmap_resolution (GdkScreen                  *screen)
+{
+  GdkScreenPrivate *priv = GDK_SCREEN_GET_PRIVATE (screen);
+  double dpi = screen->resolution;
+
+  if (dpi < 0)
+    dpi = 96.;
+
+  if (priv->fontmap)
+    pango_cairo_font_map_set_resolution (priv->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)
+{
+  GdkScreenPrivate *priv;
+  
+  g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+  priv = GDK_SCREEN_GET_PRIVATE (screen);
+
+  if (G_UNLIKELY (!priv->fontmap))
+    {
+      priv->fontmap = pango_cairo_font_map_new ();
+      update_fontmap_resolution (screen);
+    }
+    
+  return priv->fontmap;
+}
+
 /**
  * gdk_screen_set_font_options:
  * @screen: a #GdkScreen
@@ -447,6 +508,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");
       }
