? showattachment.cgi?attach_id=19334
? pango/a.out
? pango/test.c
Index: pango/fonts.c
===================================================================
RCS file: /cvs/gnome/pango/pango/fonts.c,v
retrieving revision 1.55
diff -u -p -u -r1.55 fonts.c
--- pango/fonts.c	30 Apr 2003 20:55:45 -0000	1.55
+++ pango/fonts.c	6 Sep 2003 20:13:37 -0000
@@ -1361,6 +1361,20 @@ pango_font_family_list_faces (PangoFontF
   PANGO_FONT_FAMILY_GET_CLASS (family)->list_faces (family, faces, n_faces);
 }
 
+/**
+ * pango_font_family_is_monospace:
+ * @family: a #PangoFontFamily
+ * 
+ * Return value: TRUE if the family is monospace.
+ **/
+gboolean 
+pango_font_family_is_monospace (PangoFontFamily  *family)
+{
+  g_return_val_if_fail (PANGO_IS_FONT_FAMILY (family), FALSE);
+
+  return PANGO_FONT_FAMILY_GET_CLASS (family)->is_monospace (family);
+}
+
 /*
  * PangoFontFace
  */
Index: pango/pango-font.h
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-font.h,v
retrieving revision 1.26
diff -u -p -u -r1.26 pango-font.h
--- pango/pango-font.h	10 Dec 2002 23:45:26 -0000	1.26
+++ pango/pango-font.h	6 Sep 2003 20:13:37 -0000
@@ -193,6 +193,7 @@ void                 pango_font_family_l
 						   PangoFontFace  ***faces,
 						   int              *n_faces);
 G_CONST_RETURN char *pango_font_family_get_name   (PangoFontFamily  *family);
+gboolean   pango_font_family_is_monospace         (PangoFontFamily  *family);
 
 #ifdef PANGO_ENABLE_BACKEND
 
@@ -217,11 +218,11 @@ struct _PangoFontFamilyClass
 		            PangoFontFace  ***faces,
 		            int              *n_faces);
   const char * (*get_name) (PangoFontFamily  *family);
+  gboolean (*is_monospace) (PangoFontFamily *family);
 
   /*< private >*/
 
   /* Padding for future expansion */
-  void (*_pango_reserved1) (void);
   void (*_pango_reserved2) (void);
   void (*_pango_reserved3) (void);
   void (*_pango_reserved4) (void);
Index: pango/pangofc-fontmap.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pangofc-fontmap.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 pangofc-fontmap.c
--- pango/pangofc-fontmap.c	22 Aug 2003 22:52:07 -0000	1.10
+++ pango/pangofc-fontmap.c	6 Sep 2003 20:13:37 -0000
@@ -89,6 +89,8 @@ struct _PangoFcFamily
 
   PangoFcFace **faces;
   int n_faces;		/* -1 == uninitialized */
+
+  int spacing;  /* FC_SPACING */
 };
 
 struct _PangoFcPatternSet
@@ -390,11 +392,13 @@ _pango_fc_font_map_remove (PangoFcFontMa
 
 static PangoFcFamily *
 create_family (PangoFcFontMap *fcfontmap,
-	       const char      *family_name)
+	       const char     *family_name,
+               gint            spacing)
 {
   PangoFcFamily *family = g_object_new (PANGO_FC_TYPE_FAMILY, NULL);
   family->fontmap = fcfontmap;
   family->family_name = g_strdup (family_name);
+  family->spacing = spacing;
 
   return family;
 }
@@ -439,7 +443,7 @@ pango_fc_font_map_list_families (PangoFo
 
   if (priv->n_families < 0)
     {
-      FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, NULL);
+      FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_SPACING, NULL);
       FcPattern *pat = FcPatternCreate ();
       
       fontset = FcFontList (NULL, pat, os);
@@ -454,19 +458,25 @@ pango_fc_font_map_list_families (PangoFo
 	{
 	  FcChar8 *s;
 	  FcResult res;
+          gint spacing;
 	  
 	  res = FcPatternGetString (fontset->fonts[i], FC_FAMILY, 0, (FcChar8 **) &s);
 	  g_assert (res == FcResultMatch);
+
+          res = FcPatternGetInteger (fontset->fonts[i], FC_SPACING, 0, &spacing);
+          g_assert (res == FcResultMatch || res == FcResultNoMatch);
+          if (res == FcResultNoMatch)
+            spacing = FC_PROPORTIONAL;
 	  
 	  if (!is_alias_family (s))
-	    priv->families[count++] = create_family (fcfontmap, (gchar *)s);
+	    priv->families[count++] = create_family (fcfontmap, (gchar *)s, spacing);
 	}
 
       FcFontSetDestroy (fontset);
 
-      priv->families[count++] = create_family (fcfontmap, "Sans");
-      priv->families[count++] = create_family (fcfontmap, "Serif");
-      priv->families[count++] = create_family (fcfontmap, "Monospace");
+      priv->families[count++] = create_family (fcfontmap, "Sans", FC_PROPORTIONAL);
+      priv->families[count++] = create_family (fcfontmap, "Serif", FC_PROPORTIONAL);
+      priv->families[count++] = create_family (fcfontmap, "Monospace", FC_PROPORTIONAL);
       
       priv->n_families = count;
     }
@@ -1135,6 +1145,18 @@ pango_fc_face_get_face_name (PangoFontFa
   return fcface->style;
 }
 
+static gboolean
+pango_fc_family_is_monospace (PangoFontFamily *family)
+{
+  PangoFcFamily *fcfamily = PANGO_FC_FAMILY (family);
+
+  return fcfamily->spacing == FC_MONO || 
+#ifdef FC_DUAL
+         fcfamily->spacing == FC_DUAL ||
+#endif
+         fcfamily->spacing == FC_CHARCELL;
+}
+
 static void
 pango_fc_face_class_init (PangoFontFaceClass *class)
 {
@@ -1260,6 +1282,7 @@ pango_fc_family_class_init (PangoFontFam
 {
   class->list_faces = pango_fc_family_list_faces;
   class->get_name = pango_fc_family_get_name;
+  class->is_monospace = pango_fc_family_is_monospace;
 }
 
 static void
Index: pango/pangowin32-fontmap.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pangowin32-fontmap.c,v
retrieving revision 1.37
diff -u -p -u -r1.37 pangowin32-fontmap.c
--- pango/pangowin32-fontmap.c	27 May 2003 16:35:33 -0000	1.37
+++ pango/pangowin32-fontmap.c	6 Sep 2003 20:13:37 -0000
@@ -323,11 +323,19 @@ pango_win32_family_get_name (PangoFontFa
   return win32family->family_name;
 }
 
+static gboolean
+pango_win32_family_is_monospace (PangoFontFamily *family)
+{
+  /* XXX: implement me */
+  return FALSE;
+}
+
 static void
 pango_win32_family_class_init (PangoFontFamilyClass *class)
 {
   class->list_faces = pango_win32_family_list_faces;
   class->get_name = pango_win32_family_get_name;
+  class->is_monospace = pango_win32_family_is_monospace;
 }
 
 GType
Index: pango/pangox-fontmap.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pangox-fontmap.c,v
retrieving revision 1.35
diff -u -p -u -r1.35 pangox-fontmap.c
--- pango/pangox-fontmap.c	22 Aug 2003 22:52:07 -0000	1.35
+++ pango/pangox-fontmap.c	6 Sep 2003 20:13:37 -0000
@@ -1646,11 +1646,19 @@ pango_x_family_get_name (PangoFontFamily
   return xfamily->family_name;
 }
 
+static gboolean
+pango_x_family_is_monospace (PangoFontFamily *family)
+{
+  /* XXX: implement me */
+  return FALSE;
+}
+
 static void
 pango_x_family_class_init (PangoFontFamilyClass *class)
 {
   class->list_faces = pango_x_family_list_faces;
   class->get_name = pango_x_family_get_name;
+  class->is_monospace = pango_x_family_is_monospace;
 }
 
 GType
