Index: docs/pango_markup.sgml
===================================================================
RCS file: /cvs/gnome/pango/docs/pango_markup.sgml,v
retrieving revision 1.3
diff -u -r1.3 pango_markup.sgml
--- docs/pango_markup.sgml	11 Dec 2002 19:26:16 -0000	1.3
+++ docs/pango_markup.sgml	19 Apr 2003 15:56:15 -0000
@@ -135,6 +135,14 @@
 </para></listitem>
 </varlistentry>
 
+<varlistentry><term>fallback</term>
+<listitem><para>
+'true' or 'false' whether to fall back on other fonts when the active
+font lacks characters that need to be drawn. Fallback is enabled by
+default. Most applications should not disable fallback.
+</para></listitem>
+</varlistentry>
+
 <varlistentry><term>lang</term>
 <listitem><para>
 A language code, indicating the text language
Index: docs/tmpl/fonts.sgml
===================================================================
RCS file: /cvs/gnome/pango/docs/tmpl/fonts.sgml,v
retrieving revision 1.35
diff -u -r1.35 fonts.sgml
--- docs/tmpl/fonts.sgml	11 Mar 2003 12:30:17 -0000	1.35
+++ docs/tmpl/fonts.sgml	19 Apr 2003 15:56:17 -0000
@@ -785,6 +785,8 @@
 @get_metrics: a function to get overall metric information for the fonts 
    in the fontset; see pango_fontset_get_metrics().
 @get_language: a function to get the language of the fontset.
+@get_base_font: a function to get the fontset's base font; see
+   pango_fontset_get_base_font().
 
 <!-- ##### FUNCTION pango_fontset_get_font ##### -->
 <para>
Index: docs/tmpl/text-attributes.sgml
===================================================================
RCS file: /cvs/gnome/pango/docs/tmpl/text-attributes.sgml,v
retrieving revision 1.25
diff -u -r1.25 text-attributes.sgml
--- docs/tmpl/text-attributes.sgml	20 Dec 2002 17:18:50 -0000	1.25
+++ docs/tmpl/text-attributes.sgml	19 Apr 2003 15:56:20 -0000
@@ -43,6 +43,7 @@
 @PANGO_ATTR_RISE: baseline displacement (#PangoAttrInt)
 @PANGO_ATTR_SHAPE: shape (#PangoAttrShape)
 @PANGO_ATTR_SCALE: font size scale factor (#PangoAttrScale)
+@PANGO_ATTR_FALLBACK: whether fallback is enabled (#PangoAttrInt)
 
 <!-- ##### MACRO PANGO_TYPE_ATTR_TYPE ##### -->
 <para>
Index: pango/pango-attributes.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-attributes.c,v
retrieving revision 1.34
diff -u -r1.34 pango-attributes.c
--- pango/pango-attributes.c	15 Apr 2003 19:52:26 -0000	1.34
+++ pango/pango-attributes.c	19 Apr 2003 15:57:32 -0000
@@ -643,6 +643,28 @@
   return pango_attr_float_new (&klass, scale_factor);
 }
 
+/**
+ * pango_attr_fallback_new:
+ * @enable_fallback: %TRUE if we should fall back on other fonts 
+ *                   for characters the active font is missing.
+ * 
+ * Create a new font fallback attribute.
+ * 
+ * Return value: the new #PangoAttribute.
+ **/
+PangoAttribute *
+pango_attr_fallback_new (gboolean enable_fallback)
+{
+  static const PangoAttrClass klass = {
+    PANGO_ATTR_FALLBACK,
+    pango_attr_int_copy,
+    pango_attr_int_destroy,
+    pango_attr_int_equal,
+  };
+
+  return pango_attr_int_new (&klass, (int)enable_fallback);
+}
+
 static PangoAttribute *
 pango_attr_shape_copy (const PangoAttribute *attr)
 {
Index: pango/pango-attributes.h
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-attributes.h,v
retrieving revision 1.20
diff -u -r1.20 pango-attributes.h
--- pango/pango-attributes.h	10 Dec 2002 23:45:26 -0000	1.20
+++ pango/pango-attributes.h	19 Apr 2003 15:57:32 -0000
@@ -80,7 +80,8 @@
   PANGO_ATTR_STRIKETHROUGH,	/* PangoAttrInt */
   PANGO_ATTR_RISE,		/* PangoAttrInt */
   PANGO_ATTR_SHAPE,		/* PangoAttrShape */
-  PANGO_ATTR_SCALE              /* PangoAttrFloat */
+  PANGO_ATTR_SCALE,             /* PangoAttrFloat */
+  PANGO_ATTR_FALLBACK,          /* PangoAttrInt */
 } PangoAttrType;
 
 typedef enum {
@@ -179,6 +180,7 @@
 PangoAttribute *pango_attr_shape_new         (const PangoRectangle       *ink_rect,
 					      const PangoRectangle       *logical_rect);
 PangoAttribute *pango_attr_scale_new         (double                      scale_factor);
+PangoAttribute *pango_attr_fallback_new      (gboolean                    enable_fallback);
 
 GType              pango_attr_list_get_type      (void) G_GNUC_CONST;
 PangoAttrList *    pango_attr_list_new           (void);
Index: pango/pango-context.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-context.c,v
retrieving revision 1.50
diff -u -r1.50 pango-context.c
--- pango/pango-context.c	12 Feb 2003 22:16:11 -0000	1.50
+++ pango/pango-context.c	19 Apr 2003 15:57:35 -0000
@@ -595,6 +595,7 @@
   PangoFontDescription *current_desc = NULL;
   PangoFontset *current_fonts = NULL;
   PangoAttrIterator *iterator;
+  PangoAttribute *fallback;
   gboolean first_iteration = TRUE;
   gunichar wc;
   int i = 0;
@@ -673,8 +674,14 @@
       pos = g_utf8_next_char (pos);
       
       analysis->lang_engine = (PangoEngineLang *)pango_map_get_engine (lang_map, wc);
-      analysis->font = pango_fontset_get_font (current_fonts, wc);
       analysis->language = language;
+
+      /* fallback->value is a boolean */
+      fallback = pango_attr_iterator_get (iterator, PANGO_ATTR_FALLBACK);
+      if (fallback == NULL || ((PangoAttrInt *)fallback)->value)
+        analysis->font = pango_fontset_get_font (current_fonts, wc);
+      else
+        analysis->font = pango_fontset_get_base_font (current_fonts);
       
       /* FIXME: handle reference counting properly on the shapers */
       if (analysis->font)
Index: pango/pango-fontset.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-fontset.c,v
retrieving revision 1.4
diff -u -r1.4 pango-fontset.c
--- pango/pango-fontset.c	10 Jun 2002 20:24:29 -0000	1.4
+++ pango/pango-fontset.c	19 Apr 2003 15:57:39 -0000
@@ -87,6 +87,23 @@
 }
 
 /**
+ * pango_fontset_get_base_font:
+ * @fontset: a #PangoFontset
+ *
+ * Returns the fontset's base font.
+ *
+ * Returns: a #PangoFont. The caller must call g_object_unref when finished
+ *          with the font.
+ **/
+PangoFont *
+pango_fontset_get_base_font (PangoFontset  *fontset)
+{
+  g_return_val_if_fail (fontset != NULL, NULL);
+
+  return PANGO_FONTSET_GET_CLASS (fontset)->get_base_font (fontset);
+}
+
+/**
  * pango_fontset_get_metrics:
  * @fontset: a #PangoFontset
  * 
@@ -182,6 +199,7 @@
 static PangoLanguage *   pango_fontset_simple_get_language (PangoFontset            *fontset);
 static  PangoFont *      pango_fontset_simple_get_font     (PangoFontset            *fontset,
 							    guint                    wc);
+static PangoFont *       pango_fontset_simple_get_base_font(PangoFontset *fontset);
 
 struct _PangoFontsetSimple
 {
@@ -256,6 +274,7 @@
   
   object_class->finalize = pango_fontset_simple_finalize;
   fontset_class->get_font = pango_fontset_simple_get_font;
+  fontset_class->get_base_font = pango_fontset_simple_get_base_font;
   fontset_class->get_metrics = pango_fontset_simple_get_metrics;
   fontset_class->get_language = pango_fontset_simple_get_language;
 }
@@ -377,5 +396,16 @@
     }
 
   font = g_ptr_array_index(simple->fonts, result);
+  return g_object_ref (font);
+}
+
+/* returns the first font in the list */
+static PangoFont *
+pango_fontset_simple_get_base_font (PangoFontset *fontset)
+{
+  PangoFontsetSimple *simple = PANGO_FONTSET_SIMPLE (fontset);
+  PangoFont *font;
+
+  font = g_ptr_array_index (simple->fonts, 0);
   return g_object_ref (font);
 }
Index: pango/pango-fontset.h
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-fontset.h,v
retrieving revision 1.3
diff -u -r1.3 pango-fontset.h
--- pango/pango-fontset.h	10 Dec 2002 23:45:26 -0000	1.3
+++ pango/pango-fontset.h	19 Apr 2003 15:57:39 -0000
@@ -43,6 +43,7 @@
 
 PangoFont *       pango_fontset_get_font    (PangoFontset  *fontset,
 					     guint          wc);
+PangoFont *       pango_fontset_get_base_font (PangoFontset  *fontset);
 PangoFontMetrics *pango_fontset_get_metrics (PangoFontset  *fontset);
 
 #ifdef PANGO_ENABLE_BACKEND
@@ -70,10 +71,11 @@
   PangoFontMetrics *(*get_metrics)  (PangoFontset  *fontset);
   PangoLanguage *   (*get_language) (PangoFontset  *fontset);
 
+  PangoFont *       (*get_base_font)(PangoFontset  *fontset);
+
   /*< private >*/
 
   /* Padding for future expansion */
-  void (*_pango_reserved1) (void);
   void (*_pango_reserved2) (void);
   void (*_pango_reserved3) (void);
   void (*_pango_reserved4) (void);
Index: pango/pango-markup.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-markup.c,v
retrieving revision 1.16
diff -u -r1.16 pango-markup.c
--- pango/pango-markup.c	2 Jul 2002 17:15:22 -0000	1.16
+++ pango/pango-markup.c	19 Apr 2003 15:57:52 -0000
@@ -854,6 +854,7 @@
   const char *strikethrough = NULL;
   const char *rise = NULL;
   const char *lang = NULL;
+  const char *fallback = NULL;
   
   g_markup_parse_context_get_position (context,
                                        &line_number, &char_number);
@@ -928,6 +929,11 @@
           CHECK_DUPLICATE (lang);
           lang = values[i];
         }
+      else if (strcmp (names[i], "fallback") == 0)
+        {
+          CHECK_DUPLICATE (lang);
+          fallback = values[i];
+        }
       else
         {
           g_set_error (error, G_MARKUP_ERROR,
@@ -1166,6 +1172,25 @@
                          "line %d should have one of the values "
                          "'true' or 'false': '%s' is not valid"),
                        line_number, strikethrough);
+          goto error;
+        }
+    }
+
+  if (fallback)
+    {
+      if (strcmp (fallback, "true") == 0)
+        add_attribute (tag, pango_attr_fallback_new (TRUE));
+      else if (strcmp (fallback, "false") == 0)
+        add_attribute (tag, pango_attr_fallback_new (FALSE));
+      else
+        {
+          g_set_error (error,
+                       G_MARKUP_ERROR,
+                       G_MARKUP_ERROR_INVALID_CONTENT,
+                       _("'fallback' attribute on <span> tag "
+                         "line %d should have one of the values "
+                         "'true' or 'false': '%s' is not valid"),
+                       line_number, fallback);
           goto error;
         }
     }
