? foo.diff
Index: modules/basic/basic-fc.c
===================================================================
RCS file: /cvs/gnome/pango/modules/basic/basic-fc.c,v
retrieving revision 1.15
diff -u -r1.15 basic-fc.c
--- modules/basic/basic-fc.c	14 Apr 2003 23:48:23 -0000	1.15
+++ modules/basic/basic-fc.c	20 Jul 2003 03:23:35 -0000
@@ -137,6 +137,7 @@
   int n_chars;
   int i;
   const char *p;
+  gunichar base_char;
 
   g_return_if_fail (font != NULL);
   g_return_if_fail (text != NULL);
@@ -149,6 +150,7 @@
   pango_fc_font_lock_face (fc_font);
 
   p = text;
+  base_char = (gunichar)(-1);
   for (i = 0; i < n_chars; i++)
     {
       gunichar wc;
@@ -180,13 +182,14 @@
 	  else
 	    {
 	      set_glyph (font, glyphs, i, p - text, index);
-	      
+
 	      if (g_unichar_type (wc) == G_UNICODE_NON_SPACING_MARK)
 		{
-		  if (i > 0)
+                  PangoRectangle logical_rect, ink_rect;
+                  pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, &ink_rect, &logical_rect);
+
+		  if (base_char != (gunichar)(-1) && base_char != 0x20)
 		    {
-		      PangoRectangle logical_rect, ink_rect;
-		      
 		      glyphs->glyphs[i].geometry.width = MAX (glyphs->glyphs[i-1].geometry.width,
 							      glyphs->glyphs[i].geometry.width);
 		      glyphs->glyphs[i-1].geometry.width = 0;
@@ -195,11 +198,31 @@
 		      /* Some heuristics to try to guess how overstrike glyphs are
 		       * done and compensate
 		       */
-		      pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, &ink_rect, &logical_rect);
 		      if (logical_rect.width == 0 && ink_rect.x == 0)
 			glyphs->glyphs[i].geometry.x_offset = (glyphs->glyphs[i].geometry.width - ink_rect.width) / 2;
 		    }
+                  else if (i > 0)
+                    {
+                      glyphs->glyphs[i].geometry.width = MAX (glyphs->glyphs[i-1].geometry.width,
+                                                              ink_rect.width);
+                      glyphs->glyphs[i].geometry.x_offset = MAX (glyphs->glyphs[i-1].geometry.x_offset,
+                                                                 -ink_rect.x);
+                      glyphs->glyphs[i-1].geometry.width = 0;
+		      glyphs->log_clusters[i] = glyphs->log_clusters[i-1];
+                    }
+                  else
+                    {
+                      glyphs->glyphs[i].geometry.width = ink_rect.width;
+                      glyphs->glyphs[i].geometry.x_offset = -ink_rect.x;
+                    }
 		}
+              else
+                {
+                  if (g_unichar_type (wc) == G_UNICODE_CONTROL || g_unichar_type (wc) == G_UNICODE_FORMAT)
+                    base_char = (gunichar)(-1);
+                  else
+                    base_char = wc;
+                }
 	    }
 	}
       
