diff --exclude-from=c:\util\tool\diff.ign -u -r from-cvs/pango/pango/pangowin32.c my-gtk/pango/pango/pangowin32.c
--- from-cvs/pango/pango/pangowin32.c	Sat May 24 15:24:52 2003
+++ my-gtk/pango/pango/pangowin32.c	Sun Jul 20 20:40:08 2003
@@ -839,6 +839,139 @@
   pango_layout_iter_free (iter);  
 }
 
+void
+pango_win32_render_layout_to_bitmap (PangoBitmap *bitmap,
+                                   PangoLayout *layout,
+                                   int          x, 
+                                   int          y)
+{
+  /* render into 8 bit given bitmap */
+  /* maybe something along the line of
+      res = GetGlyphOutlineA (pango_win32_hdc, 
+			      glyph_index,
+			      GGO_METRICS | GGO_GLYPH_INDEX,
+			      &gm, 
+			      0, NULL,
+			      &m);
+   or :
+   */
+  static HPALETTE grayPal = NULL;
+  struct
+  {
+    WORD palVersion;
+    WORD palNumEntries;
+    PALETTEENTRY palPalEntry[256];
+  } logpal;
+
+  static struct
+  {
+    BITMAPINFOHEADER bmiHeader;
+    WORD             bmiColors[256];
+  } bmi;
+
+  HDC hMemDC;
+  HBITMAP hbm8, holdbmp;
+  char *pbits8; 
+  int i;
+
+  if (!grayPal)
+    {
+
+      logpal.palVersion = 0x300;
+      logpal.palNumEntries = 256;
+
+      for (i = 0; i < 256; i++)
+        {
+          logpal.palPalEntry[i].peRed = 
+            logpal.palPalEntry[i].peGreen = 
+            logpal.palPalEntry[i].peBlue = i;
+          logpal.palPalEntry[i].peFlags = 0;
+
+          bmi.bmiColors[i] = i;
+        }
+      grayPal = CreatePalette ((LOGPALETTE *) &logpal);
+      g_return_if_fail (grayPal);
+    }
+
+  hMemDC = CreateCompatibleDC (NULL);
+  g_return_if_fail (hMemDC);
+
+  SelectPalette (hMemDC, grayPal, FALSE);
+  RealizePalette (hMemDC);
+  
+  /* Create a 8 bits depth bitmap and select it into the memory DC */
+  bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
+  bmi.bmiHeader.biWidth = bitmap->pitch;
+  bmi.bmiHeader.biHeight = bitmap->rows;
+  bmi.bmiHeader.biPlanes = 1;
+  bmi.bmiHeader.biBitCount = 8;
+  bmi.bmiHeader.biCompression = BI_RGB;
+  bmi.bmiHeader.biSizeImage = 0;
+  bmi.bmiHeader.biXPelsPerMeter = 0;
+  bmi.bmiHeader.biYPelsPerMeter = 0;
+  bmi.bmiHeader.biClrUsed = 256;
+  bmi.bmiHeader.biClrImportant = 256;
+
+  hbm8 = CreateDIBSection (hMemDC, (BITMAPINFO *)&bmi,
+                           DIB_PAL_COLORS, &pbits8, NULL, 0);
+
+  holdbmp = (HBITMAP) SelectObject (hMemDC, hbm8);
+
+  /* erase background */
+  {
+    HBRUSH hBr; 
+    HRGN   hRgn;
+
+    hRgn = CreateRectRgn (0, 0, bitmap->pitch, bitmap->rows);
+    hBr = CreateSolidBrush ( RGB (0, 0, 0));
+
+    FillRgn (hMemDC, hRgn, hBr);
+
+    DeleteObject (hBr);
+    DeleteObject (hRgn);
+  }
+
+  /* text out prerequisites */
+  SetBkColor (hMemDC, RGB (0,0,0));
+  SetTextColor (hMemDC, RGB (255,255,255));
+
+  SetBkMode (hMemDC, TRANSPARENT);
+  SetTextAlign (hMemDC, TA_LEFT|TA_BASELINE|TA_NOUPDATECP);
+
+  /* do it */
+  pango_win32_render_layout (hMemDC, layout, x, y);
+
+  GdiFlush (); /* make sure pbits8 is valid */
+
+  SelectObject (hMemDC, holdbmp);
+  /* copy data, its inverted */
+  for (i = 0; i < bitmap->rows; i++)
+    memcpy (bitmap->buffer + (i * bitmap->pitch), 
+            pbits8 + (bitmap->rows - i - 1) * bitmap->pitch, 
+            bitmap->pitch);
+
+  /* Test */
+  if (0)
+  {
+    int i;
+    for (i = 0; i < bitmap->rows; i++)
+      if (i < (bitmap->rows / 2))
+        {
+          memset (bitmap->buffer + (i * bitmap->pitch), 255, bitmap->pitch / 2);
+          memset (bitmap->buffer + (i * bitmap->pitch + bitmap->pitch / 2), 0, bitmap->pitch / 2);
+        }
+      else
+        {
+          memset (bitmap->buffer + (i * bitmap->pitch), 0, bitmap->pitch / 2);
+          memset (bitmap->buffer + (i * bitmap->pitch + bitmap->pitch / 2), 255, bitmap->pitch / 2);
+        }
+  }
+
+  /* clean up */
+  DeleteDC (hMemDC);
+  DeleteObject (hbm8);
+}
+
 /* This utility function is duplicated here and in pango-layout.c; should it be
  * public? Trouble is - what is the appropriate set of properties?
  */
diff --exclude-from=c:\util\tool\diff.ign -u -r from-cvs/pango/pango/pangowin32.def my-gtk/pango/pango/pangowin32.def
--- from-cvs/pango/pango/pangowin32.def	Sat Nov 09 20:32:48 2002
+++ my-gtk/pango/pango/pangowin32.def	Sat May 24 21:55:36 2003
@@ -21,4 +21,5 @@
 	pango_win32_render
 	pango_win32_render_layout
 	pango_win32_render_layout_line
+	pango_win32_render_layout_to_bitmap
 	pango_win32_shutdown_display
diff --exclude-from=c:\util\tool\diff.ign -u -r from-cvs/pango/pango/pangowin32.h my-gtk/pango/pango/pangowin32.h
--- from-cvs/pango/pango/pangowin32.h	Sat Nov 09 20:32:48 2002
+++ my-gtk/pango/pango/pangowin32.h	Sat May 24 21:51:10 2003
@@ -34,8 +34,27 @@
 #ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0501	/* To get ClearType-related macros */
 #endif
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #undef STRICT
+
+/* should be in pango-types.h */
+typedef struct _PangoBitmap PangoBitmap;
+
+struct _PangoBitmap
+{
+  int   width;
+  int   rows;
+  int   pitch;
+  int   num_grays;
+  char *buffer;
+};
+
+void
+pango_win32_render_layout_to_bitmap (PangoBitmap *bitmap,
+                                     PangoLayout *layout,
+                                     int          x, 
+                                     int          y);
 
 #define PANGO_RENDER_TYPE_WIN32 "PangoRenderWin32"
 
