changeset 28229:5a0af67169a7

(Fx_create_frame): Don't cal fs_register_fontset. (x_create_tip_frame): Likewise. (Fx_close_connection): Free full_name of font_info.
author Kenichi Handa <handa@m17n.org>
date Tue, 21 Mar 2000 00:42:32 +0000
parents 84be12f331b8
children 8e330f701881
files src/xfns.c
diffstat 1 files changed, 34 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Tue Mar 21 00:41:41 2000 +0000
+++ b/src/xfns.c	Tue Mar 21 00:42:32 2000 +0000
@@ -3093,22 +3093,39 @@
 	base_fontname = "-*-*-*-r-normal--14-*-*-*-*-*-*-*";
       else
 	{
-	  struct fontset_info *fontsetp;
-	  int len = 0;
+	  /* Determine the base fontname from the ASCII font name of
+	     FONTSET.  */
+	  char *ascii_font = (char *) XSTRING (fontset_ascii (fontset))->data;
+	  char *p = ascii_font;
 	  int i;
-	  
-	  fontsetp = FRAME_FONTSET_DATA (f)->fontset_table[fontset];
-	  for (i = 0; i <= MAX_CHARSET; i++)
-	    if (fontsetp->fontname[i])
-	      len += strlen (fontsetp->fontname[i]) + 1;
-	  base_fontname = alloca (len);
-	  strcpy (base_fontname, fontsetp->fontname[CHARSET_ASCII]);
-	  for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++)
-	    if (fontsetp->fontname[i])
-	      {
-		strcat (base_fontname, ",");
-		strcat (base_fontname, fontsetp->fontname[i]);
-	      }
+
+	  for (i = 0; *p; p++)
+	    if (*p == '-') i++;
+	  if (i != 14)
+	    /* As the font name doesn't conform to XLFD, we can't
+	       modify it to get a suitable base fontname for the
+	       frame.  */
+	    base_fontname = "-*-*-*-r-normal--14-*-*-*-*-*-*-*";
+	  else
+	    {
+	      int len = strlen (ascii_font) + 1;
+	      char *p1;
+
+	      for (i = 0, p = ascii_font; i < 8; p++)
+		{
+		  if (*p == '-')
+		    {
+		      i++;
+		      if (i == 3)
+			p1 = p + 1;
+		    }
+		}
+	      base_fontname = (char *) alloca (len);
+	      bzero (base_fontname, len);
+	      strcpy (base_fontname, "-*-*-");
+	      bcopy (p1, base_fontname + 5, p - p1);
+	      strcat (base_fontname, "*-*-*-*-*-*-*");
+	    }
 	}
       xfs = xic_create_xfontset (f, base_fontname);
 
@@ -3880,10 +3897,6 @@
       specbind (Qx_resource_name, name);
     }
 
-  /* Create fontsets from `global_fontset_alist' before handling fonts.  */
-  for (tem = Vglobal_fontset_alist; CONSP (tem); tem = XCDR (tem))
-    fs_register_fontset (f, XCAR (tem));
-
   /* Extract the window parameters from the supplied values
      that are needed to determine window geometry.  */
   {
@@ -4739,9 +4752,9 @@
   for (i = 0; i < dpyinfo->n_fonts; i++)
     if (dpyinfo->font_table[i].name)
       {
+	if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name)
+	  xfree (dpyinfo->font_table[i].full_name);
 	xfree (dpyinfo->font_table[i].name);
-	/* Don't free the full_name string;
-	   it is always shared with something else.  */
 	XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font);
       }
 
@@ -9435,10 +9448,6 @@
       specbind (Qx_resource_name, name);
     }
 
-  /* Create fontsets from `global_fontset_alist' before handling fonts.  */
-  for (tem = Vglobal_fontset_alist; CONSP (tem); tem = XCDR (tem))
-    fs_register_fontset (f, XCAR (tem));
-
   /* Extract the window parameters from the supplied values
      that are needed to determine window geometry.  */
   {