Index: pango/shape.c
===================================================================
RCS file: /cvs/gnome/pango/pango/shape.c,v
retrieving revision 1.12
diff -u -p -r1.12 shape.c
--- pango/shape.c	14 Jan 2006 07:00:11 -0000	1.12
+++ pango/shape.c	29 Jan 2006 21:36:10 -0000
@@ -43,21 +43,62 @@ pango_shape (const gchar      *text, 
 {
   int i;
   int last_cluster = -1;
-  
+
   if (analysis->shape_engine)
-    _pango_engine_shape_shape (analysis->shape_engine, analysis->font,
-			       text, length, analysis, glyphs);
+    {
+      _pango_engine_shape_shape (analysis->shape_engine, analysis->font,
+				 text, length, analysis, glyphs);
+
+      if (G_UNLIKELY (glyphs->num_glyphs == 0 && analysis->font))
+        {
+	  /* If a font has been correctly chosen, but no glyphs are output,
+	   * there's probably something wrong with the shaper.  Trying to be
+	   * informative, we print out the font description, but to not 
+	   * flood the terminal with zillions of the message, we set a flag
+	   * on the font to only err once per font.
+	   */
+	  static GQuark warned_quark = 0;
+
+	  if (!warned_quark)
+	    warned_quark = g_quark_from_static_string ("pango-shaper-warned");
+	  
+	  if (!g_object_get_qdata (G_OBJECT (analysis->font), warned_quark))
+	    {
+	      PangoFontDescription *desc;
+	      char *s;
+
+	      desc = pango_font_describe (analysis->font);
+	      s = pango_font_description_to_string (desc);
+	      pango_font_description_free (desc);
+
+	      g_warning ("shape engine failure, expect ugly output. the offending font is `%s'", s);
+
+	      g_free (s);
+
+	      g_object_set_qdata_full (G_OBJECT (analysis->font), warned_quark,
+				       GINT_TO_POINTER (1), NULL);
+	    }
+	}
+    }
   else
+    glyphs->num_glyphs = 0;
+
+  if (!glyphs->num_glyphs)
     {
-      pango_glyph_string_set_size (glyphs, 1);
+      /* If failed to get glyphs, put a whitespace glyph per character
+       */
+      pango_glyph_string_set_size (glyphs, g_utf8_strlen (text, length));
 
-      glyphs->glyphs[0].glyph = 0;
-      
-      glyphs->glyphs[0].geometry.x_offset = 0;
-      glyphs->glyphs[0].geometry.y_offset = 0;
-      glyphs->glyphs[0].geometry.width = 0;
-      
-      glyphs->log_clusters[0] = 0;
+      for (i = 0; i < glyphs->num_glyphs; i++)
+        {
+	  glyphs->glyphs[i].glyph = 0;
+	  
+	  glyphs->glyphs[i].geometry.x_offset = 0;
+	  glyphs->glyphs[i].geometry.y_offset = 0;
+	  glyphs->glyphs[i].geometry.width = 10 * PANGO_SCALE;
+	  
+	  glyphs->log_clusters[i] = i;
+	}
     }
 
   /* Set glyphs[i].attr.is_cluster_start based on log_clusters[]
@@ -72,6 +113,4 @@ pango_shape (const gchar      *text, 
       else
 	glyphs->glyphs[i].attr.is_cluster_start = FALSE;
     }
-	    
-  g_assert (glyphs->num_glyphs > 0);
 }
