[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vim-dev
Subject:    Patch 6.1b.031 (extra)
From:       Bram Moolenaar <Bram () moolenaar ! net>
Date:       2002-03-21 21:03:17
[Download RAW message or body]


Patch 6.1b.031 (extra)
Problem:    Win32 GUI: ":set guifont=*" doesn't set 'guifont' to the resulting
	    font name. (Vlad Sandrini)
Solution:   Put the code back in gui_mch_init_font() to form the font name out
	    of the logfont.
Files:	    src/gui_w48.c


*** ../vim61b.030/src/gui_w48.c	Tue Mar 19 20:16:24 2002
--- src/gui_w48.c	Thu Mar 21 21:30:56 2002
***************
*** 2524,2529 ****
--- 2524,2569 ----
      GetFontSize(font);
      hl_set_font_name(lf.lfFaceName);
  
+     /* When setting 'guifont' to "*" replace it with the actual font name. */
+     if (STRCMP(font_name, "*") == 0 && STRCMP(p_guifont, "*") == 0)
+     {
+ 	char	    *charset_name;
+ 	char_u	    *p;
+ 
+ 	charset_name = charset_id2name((int)lf.lfCharSet);
+ 	p = alloc((unsigned)(strlen(lf.lfFaceName) + 20
+ 		    + (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
+ 	if (p != NULL)
+ 	{
+ 	    /* make a normal font string out of the lf thing:*/
+ 	    sprintf((char *)p, "%s:h%d", lf.lfFaceName, pixels_to_points(
+ 			 lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE));
+ 	    vim_free(p_guifont);
+ 	    p_guifont = p;
+ 	    while (*p)
+ 	    {
+ 		if (*p == ' ')
+ 		    *p = '_';
+ 		++p;
+ 	    }
+ #ifndef MSWIN16_FASTTEXT
+ 	    if (lf.lfItalic)
+ 		STRCAT(p, ":i");
+ 	    if (lf.lfWeight >= FW_BOLD)
+ 		STRCAT(p, ":b");
+ #endif
+ 	    if (lf.lfUnderline)
+ 		STRCAT(p, ":u");
+ 	    if (lf.lfStrikeOut)
+ 		STRCAT(p, ":s");
+ 	    if (charset_name != NULL)
+ 	    {
+ 		STRCAT(p, ":c");
+ 		STRCAT(p, charset_name);
+ 	    }
+ 	}
+     }
+ 
  #ifndef MSWIN16_FASTTEXT
      if (!lf.lfItalic)
      {
*** ../vim61b.030/src/version.c	Thu Mar 21 20:40:25 2002
--- src/version.c	Thu Mar 21 21:32:33 2002
***************
*** 608,609 ****
--- 608,611 ----
  {   /* Add new patch number below this line */
+ /**/
+     31,
  /**/

-- 
I am always surprised in the Linux world how quickly solutions can be
obtained.  (Imagine sending an email to Bill Gates, asking why Windows
crashed, and how to fix it...  and then getting an answer that fixed the
problem... <0>_<0> !)		              -- Mark Langdon

 ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
\\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic