--- pango/pangofc-fontmap.c.old	2005-10-14 15:49:27.000000000 +0800
+++ pango/pangofc-fontmap.c	2005-10-15 14:31:49.000000000 +0800
@@ -28,6 +28,7 @@
 #include "pangofc-fontmap.h"
 #include "pangofc-private.h"
 #include "modules.h"
+#include "pango-utils.h"
 
 typedef struct _PangoFcCoverageKey  PangoFcCoverageKey;
 typedef struct _PangoFcFace         PangoFcFace;
@@ -621,6 +622,24 @@
   return FALSE;
 }
 
+#if defined (FC_FAMILYLANG) || defined (FC_STYLELANG)
+static FcResult 
+get_pattern_string_for_language (FcPattern *p, const char *language, const char *obj, const char *objlang, FcChar8 **s)
+{
+  int i, idx=0;
+  FcChar8 *lang;
+
+  for (i = 1; FcPatternGetString (p, objlang, i, &lang) == FcResultMatch; ++i)
+    if (strncmp ((const char*) language, (const char*) lang, strlen ((const char*)lang)) == 0)
+      {
+	idx = i;
+	break;
+      }
+
+  return FcPatternGetString (p, obj, idx, s);
+}
+#endif
+
 static void
 pango_fc_font_map_list_families (PangoFontMap      *fontmap,
 				 PangoFontFamily ***families,
@@ -644,8 +663,14 @@
 
   if (priv->n_families < 0)
     {
+#ifdef FC_FAMILYLANG
+      FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_FAMILYLANG, FC_SPACING, NULL);
+      const char *language = pango_language_to_string (pango_get_default_language ());
+#else
       FcObjectSet *os = FcObjectSetBuild (FC_FAMILY, FC_SPACING, NULL);
+#endif
       FcPattern *pat = FcPatternCreate ();
+
       /* use hash table to avoid duplicate listings if different faces in
        * the same family have different spacing values */
       GHashTable *temp_family_hash;
@@ -664,8 +689,12 @@
 	  FcChar8 *s;
 	  FcResult res;
           int spacing;
-	  
+
+#ifdef FC_FAMILYLANG
+	  res = get_pattern_string_for_language (fontset->fonts[i], language, FC_FAMILY, FC_FAMILYLANG, &s);
+#else
 	  res = FcPatternGetString (fontset->fonts[i], FC_FAMILY, 0, (FcChar8 **) &s);
+#endif
 	  g_assert (res == FcResultMatch);
 
           res = FcPatternGetInteger (fontset->fonts[i], FC_SPACING, 0, &spacing);
@@ -1689,7 +1718,7 @@
 				  NULL);
 
   g_assert (match_pattern);
-  
+
   result_pattern = FcFontMatch (NULL, match_pattern, &res);
   if (result_pattern)
     {
@@ -1887,7 +1916,12 @@
 	}
       else
 	{
+#ifdef FC_STYLELANG
+	  FcObjectSet *os = FcObjectSetBuild (FC_STYLE, FC_STYLELANG, NULL);
+	  const char *language = pango_language_to_string (pango_get_default_language ());
+#else
 	  FcObjectSet *os = FcObjectSetBuild (FC_STYLE, NULL);
+#endif
 	  FcPattern *pat = FcPatternBuild (NULL, 
 					   FC_FAMILY, FcTypeString, fcfamily->family_name,
 					   NULL);
@@ -1905,7 +1939,12 @@
 	      FcChar8 *s;
 	      FcResult res;
 
+#ifdef FC_STYLELANG
+	      res = get_pattern_string_for_language (fontset->fonts[i], language, FC_STYLE, FC_STYLELANG, &s);
+#else
 	      res = FcPatternGetString (fontset->fonts[i], FC_STYLE, 0, &s);
+#endif
+
 	      if (res != FcResultMatch)
 		s = "Regular";
 
--- pango/pango-utils.h.old	2005-10-15 14:00:56.000000000 +0800
+++ pango/pango-utils.h	2005-10-15 14:04:13.000000000 +0800
@@ -95,6 +95,9 @@
 
 G_CONST_RETURN char *pango_language_get_sample_string (PangoLanguage *language);
 
+void            pango_set_default_language (PangoLanguage *language);
+PangoLanguage * pango_get_default_language (void);
+
 /* Unicode characters that are zero-width and should not be rendered
  * normally.
  */
--- pango/pango-utils.c.old	2005-10-15 14:01:04.000000000 +0800
+++ pango/pango-utils.c	2005-10-15 14:28:04.000000000 +0800
@@ -24,6 +24,8 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include <locale.h>
+
 #include "config.h"
 
 #include "pango-font.h"
@@ -59,6 +61,8 @@
 };
 
 static GHashTable *pango_aliases_ht = NULL;
+static PangoLanguage *pango_default_language = 0;
+
 
 /**
  * pango_trim_string:
@@ -1224,6 +1228,92 @@
   return our_type;
 }
 
+/* copy from gtk+ */
+static gchar *
+_pango_get_lc_ctype (void)
+{
+#ifdef G_OS_WIN32
+  /* Somebody might try to set the locale for this process using the
+   * LANG or LC_ environment variables. The Microsoft C library
+   * doesn't know anything about them. You set the locale in the
+   * Control Panel. Setting these env vars won't have any affect on
+   * locale-dependent C library functions like ctime(). But just for
+   * kicks, do obey LC_ALL, LC_CTYPE and LANG in GTK. (This also makes
+   * it easier to test GTK and Pango in various default languages, you
+   * don't have to clickety-click in the Control Panel, you can simply
+   * start the program with LC_ALL=something on the command line.)
+   */
+  gchar *p;
+
+  p = getenv ("LC_ALL");
+  if (p != NULL)
+    return g_strdup (p);
+
+  p = getenv ("LC_CTYPE");
+  if (p != NULL)
+    return g_strdup (p);
+
+  p = getenv ("LANG");
+  if (p != NULL)
+    return g_strdup (p);
+
+  return g_win32_getlocale ();
+#else
+  return g_strdup (setlocale (LC_CTYPE, NULL));
+#endif
+}
+
+/**
+ * pango_set_default_language:
+ * @language: a #PangoLanguage, #NULL is allowed to clear the
+ *            default language setting.
+ *
+ * Set the default language, which will be used by pango when
+ * listing font families and faces.
+ **/
+void
+pango_set_default_language (PangoLanguage *language)
+{
+  pango_default_language = language;
+}
+
+/**
+ * pango_get_default_language:
+ * 
+ * Get the default language, which will be used by pango when
+ * listing font families and faces.
+ *
+ * The default language could be set by calling
+ * pango_set_default_language().
+ *
+ * If no default language has been set before, the language
+ * corresponding to the current locale will be returned.
+ *
+ * Return value: an opaque pointer to a #PangoLanguage.
+ **/
+PangoLanguage *
+pango_get_default_language (void)
+{
+  if (!pango_default_language)
+    {
+      gchar *lang;
+      gchar *p;
+
+      lang = _pango_get_lc_ctype ();
+      p = strchr (lang, '.');
+      if (p)
+	*p = '\0';
+      p = strchr (lang, '@');
+      if (p)
+	*p = '\0';
+
+      pango_default_language = pango_language_from_string (lang);
+      g_free (lang);
+    }
+ 
+  return pango_default_language;
+}
+
 /**
  * pango_language_from_string:
  * @language: a string representing a language tag
