Index: pango/pango-utils.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-utils.c,v
retrieving revision 1.54.4.1
diff -p -u -r1.54.4.1 pango-utils.c
--- pango/pango-utils.c	14 Jun 2005 22:23:29 -0000	1.54.4.1
+++ pango/pango-utils.c	26 Jul 2005 19:29:01 -0000
@@ -56,9 +56,12 @@ struct PangoAlias
   int n_families;
   char **families;
   gboolean visible; /* Do we want/need this? */
+  gboolean is_virtual; /* Is it a virtual alias? */
 };
 
-GHashTable *pango_aliases_ht = NULL;
+static GHashTable *pango_aliases_ht = NULL;
+static struct PangoAlias *alias_suffix = NULL;
+static const gchar alias_suffix_key[] = "*<";
 
 /**
  * pango_trim_string:
@@ -1443,29 +1446,17 @@ pango_get_mirror_char (gunichar        c
 }
 
 
-static guint
-alias_hash (struct PangoAlias *alias)
-{
-  return g_str_hash (alias->alias);
-}
-
-static gboolean
-alias_equal (struct PangoAlias *alias1,
-	     struct PangoAlias *alias2)
-{
-  return g_str_equal (alias1->alias,
-		      alias2->alias);
-}
-
-
 static void
 alias_free (struct PangoAlias *alias)
 {
   int i;
   g_free (alias->alias);
 
-  for (i = 0; i < alias->n_families; i++)
-    g_free (alias->families[i]);
+  if (!alias->is_virtual)
+    {
+      for (i = 0; i < alias->n_families; i++)
+	g_free (alias->families[i]);
+    }
 
   g_free (alias->families);
   
@@ -1473,6 +1464,18 @@ alias_free (struct PangoAlias *alias)
 }
 
 static void
+alias_append (struct PangoAlias *alias, gchar **new_families, gint n_new, gboolean is_static)
+{
+  gint i;
+
+  alias->families = g_realloc (alias->families,
+			       sizeof (char *) *(n_new + alias->n_families));
+  for (i = 0; i < n_new; i++)
+    alias->families[alias->n_families + i] = is_static ? new_families[i] : g_strdup (new_families[i]);
+  alias->n_families += n_new;
+}
+
+static void
 read_alias_file (const char *filename)
 {
   FILE *file;
@@ -1483,7 +1486,7 @@ read_alias_file (const char *filename)
   char *errstring = NULL;
   const char *pos;
   int line = 0;
-  struct PangoAlias alias_key;
+  char *key;
   struct PangoAlias *alias;
   char **new_families;
   int n_new;
@@ -1507,7 +1510,10 @@ read_alias_file (const char *filename)
       if (!pango_skip_space (&pos))
 	continue;
       
-      if (!pango_scan_word (&pos, tmp_buffer1) ||
+      if (!strncmp (pos, alias_suffix_key, G_N_ELEMENTS (alias_suffix_key) - 1) &&
+	  (pos += 2) && pango_skip_space (&pos))
+	g_string_assign (tmp_buffer1, alias_suffix_key);
+      else if (!pango_scan_word (&pos, tmp_buffer1) ||
 	  !pango_skip_space (&pos))
 	{
 	  errstring = g_strdup ("Line is not of the form KEY=VALUE or KEY+=VALUE");
@@ -1544,21 +1550,21 @@ read_alias_file (const char *filename)
 	    }
 	}
 
-      alias_key.alias = g_ascii_strdown (tmp_buffer1->str, -1);
+      key = g_ascii_strdown (tmp_buffer1->str, -1);
       
       /* Remove any existing values */
-      alias = g_hash_table_lookup (pango_aliases_ht, &alias_key);
+      alias = g_hash_table_lookup (pango_aliases_ht, key);
       
       if (!alias)
 	{
 	  alias = g_new0 (struct PangoAlias, 1);
-	  alias->alias = alias_key.alias;
+	  alias->alias = key;
 	  
 	  g_hash_table_insert (pango_aliases_ht,
-			       alias, alias);
+			       key, alias);
 	}
       else
-	g_free (alias_key.alias);
+	g_free (key);
 	  
       new_families = g_strsplit (tmp_buffer2->str, ",", -1);
       
@@ -1568,12 +1574,8 @@ read_alias_file (const char *filename)
       
       if (alias->families && append)
 	{
-	  alias->families = g_realloc (alias->families,
-				       sizeof (char *) *(n_new + alias->n_families));
-	  for (i = 0; i < n_new; i++)
-	    alias->families[alias->n_families + i] = new_families[i];
+	  alias_append (alias, new_families, n_new, TRUE);
 	  g_free (new_families);
-	  alias->n_families += n_new;
 	}
       else
 	{
@@ -1605,15 +1607,23 @@ read_alias_file (const char *filename)
 }
 
 static void
+aliases_append (gchar *key,
+		struct PangoAlias *alias,
+		struct PangoAlias *suffix)
+{
+  alias_append (alias, suffix->families, suffix->n_families, FALSE);
+}
+
+static void
 pango_load_aliases (void)
 {
   char *filename;
   const char *home;
 
-  pango_aliases_ht = g_hash_table_new_full ((GHashFunc)alias_hash,
-					    (GEqualFunc)alias_equal,
-					    (GDestroyNotify)alias_free,
-					    NULL);
+  pango_aliases_ht = g_hash_table_new_full (g_str_hash,
+					    g_str_equal,
+					    NULL,
+					    (GDestroyNotify)alias_free);
 
 
   filename = g_strconcat (pango_get_sysconf_subdirectory (),
@@ -1631,6 +1641,13 @@ pango_load_aliases (void)
       read_alias_file (filename);
       g_free (filename);
     }
+
+  alias_suffix = g_hash_table_lookup (pango_aliases_ht, alias_suffix_key);
+  if (alias_suffix)
+    {
+      g_hash_table_steal (pango_aliases_ht, alias_suffix_key);
+      g_hash_table_foreach (pango_aliases_ht, aliases_append, alias_suffix);
+    }
 }
 
 
@@ -1652,15 +1669,33 @@ pango_lookup_aliases (const char   *font
 		      char       ***families,
 		      int          *n_families)
 {
-  struct PangoAlias alias_key;
+  gchar *key;
   struct PangoAlias *alias;
   
   if (pango_aliases_ht == NULL)
     pango_load_aliases ();
 
-  alias_key.alias = g_ascii_strdown (fontname, -1);
-  alias = g_hash_table_lookup (pango_aliases_ht, &alias_key);
-  g_free (alias_key.alias);
+  key = g_ascii_strdown (fontname, -1);
+  alias = g_hash_table_lookup (pango_aliases_ht, key);
+  if (!alias && alias_suffix)
+    {
+      gint i;
+
+      alias = g_new (struct PangoAlias, 1);
+      alias->alias = key;
+      alias->is_virtual = TRUE;
+      alias->n_families = alias_suffix->n_families + 1;
+      alias->families = g_new (gchar *, alias->n_families);
+      alias->families[0] = alias->alias;
+
+      for (i = 1; i < alias->n_families; ++i)
+	alias->families[i] = alias_suffix->families[i - 1];
+      
+      g_hash_table_insert (pango_aliases_ht,
+			   key, alias);
+    }
+  else
+    g_free (key);
 
   if (alias)
     {
