changeset 60695:d8c3512bc427

(xic_create_fontsetname): Add a final catch-all font pattern.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 18 Mar 2005 02:25:13 +0000
parents 9e7ee067df09
children 7503b2a24a3c
files src/xfns.c
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Fri Mar 18 00:15:23 2005 +0000
+++ b/src/xfns.c	Fri Mar 18 02:25:13 2005 +0000
@@ -2005,11 +2005,13 @@
       else
 	{
 	  int len;
-	  char *p1 = NULL;
+	  char *p1 = NULL, *p2 = NULL;
 	  char *font_allcs = NULL;
 	  char *font_allfamilies = NULL;
+	  char *font_all = NULL;
 	  char *allcs = "*-*-*-*-*-*-*";
 	  char *allfamilies = "-*-*-";
+	  char *all = "*-*-*-*-";
 	  
 	  for (i = 0, p = base_fontname; i < 8; p++)
 	    {
@@ -2018,6 +2020,8 @@
 		  i++;
 		  if (i == 3)
 		    p1 = p + 1;
+		  else if (i == 7)
+		    p2 = p + 1;
 		}
 	    }
 	  /* Build the font spec that matches all charsets.  */
@@ -2032,12 +2036,21 @@
 	  font_allfamilies = (char *) alloca (len);
 	  bzero (font_allfamilies, len);
 	  strcpy (font_allfamilies, allfamilies);
-	  bcopy (p1, font_allfamilies + (strlen (allfamilies)), p - p1);
+	  bcopy (p1, font_allfamilies + strlen (allfamilies), p - p1);
 	  strcat (font_allfamilies, allcs);
 
+	  /* Build the font spec that matches all.  */
+	  len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1;
+	  font_all = (char *) alloca (len);
+	  bzero (font_all, len);
+	  strcpy (font_all, allfamilies);
+	  strcat (font_all, all);
+	  bcopy (p2, font_all + strlen (all) + strlen (allfamilies), p - p2);
+	  strcat (font_all, allcs);
+
 	  /* Build the actual font set name.  */
 	  len = strlen (base_fontname) + strlen (font_allcs)
-	    + strlen (font_allfamilies) + 4;
+	    + strlen (font_allfamilies) + strlen (font_all) + 5;
 	  fontsetname = xmalloc (len);
 	  bzero (fontsetname, len);
 	  strcpy (fontsetname, base_fontname);
@@ -2045,6 +2058,8 @@
 	  strcat (fontsetname, font_allcs);
 	  strcat (fontsetname, sep);
 	  strcat (fontsetname, font_allfamilies);
+	  strcat (fontsetname, sep);
+	  strcat (fontsetname, font_all);
 	}
     }
   if (motif)