diff src/w32fns.c @ 15205:0f5d6cd72e21

(win_msg_worker): Use post_msg. (win32_wnd_proc): Don't abort if button_state & this, just return. Use post_msg instead of my_post_msg in some places. (win32_to_x_font): Major rewrite. (struct enumfont_t): New element logfont. (enum_font_cb2): Add special code for TRUETYPE_FONTTYPE. (Fx_list_fonts): Call x_to_win32_font.
author Richard M. Stallman <rms@gnu.org>
date Fri, 10 May 1996 20:40:49 +0000
parents 220145cf7546
children 16d0e8c36378
line wrap: on
line diff
--- a/src/w32fns.c	Fri May 10 20:35:50 1996 +0000
+++ b/src/w32fns.c	Fri May 10 20:40:49 1996 +0000
@@ -2844,9 +2844,7 @@
 	    case WM_TIMER:
 	      if (saved_mouse_msg.msg.hwnd)
 		{
-		  Win32Msg wmsg = saved_mouse_msg;
-		  my_post_msg (&wmsg, wmsg.msg.hwnd, wmsg.msg.message,
-			       wmsg.msg.wParam, wmsg.msg.lParam);
+		  post_msg (&saved_mouse_msg);
 		  saved_mouse_msg.msg.hwnd = 0;
 		}
 	      timer_id = 0;
@@ -2992,7 +2990,8 @@
 	int this = (msg == WM_LBUTTONDOWN) ? LMOUSE : RMOUSE;
 	int other = (msg == WM_LBUTTONDOWN) ? RMOUSE : LMOUSE;
 
-	if (button_state & this) abort ();
+	if (button_state & this)
+	  return 0;
 
 	if (button_state == 0)
 	  SetCapture (hwnd);
@@ -3021,9 +3020,7 @@
 	    else
 	      {
 		/* Flush out saved message. */
-		wmsg = saved_mouse_msg;
-		my_post_msg (&wmsg, wmsg.msg.hwnd, wmsg.msg.message,
-			     wmsg.msg.wParam, wmsg.msg.lParam);
+		post_msg (&saved_mouse_msg);
 	      }
 	    wmsg.dwModifiers = win32_get_modifiers ();
 	    my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
@@ -3055,7 +3052,8 @@
 	int this = (msg == WM_LBUTTONUP) ? LMOUSE : RMOUSE;
 	int other = (msg == WM_LBUTTONUP) ? RMOUSE : LMOUSE;
 
-	if ((button_state & this) == 0) abort ();
+	if ((button_state & this) == 0)
+	  return 0;
 
 	button_state &= ~this;
 
@@ -3077,9 +3075,7 @@
 	    /* Flush out saved message if necessary. */
 	    if (saved_mouse_msg.msg.hwnd)
 	      {
-		wmsg = saved_mouse_msg;
-		my_post_msg (&wmsg, wmsg.msg.hwnd, wmsg.msg.message,
-			     wmsg.msg.wParam, wmsg.msg.lParam);
+		post_msg (&saved_mouse_msg);
 	      }
 	  }
 	wmsg.dwModifiers = win32_get_modifiers ();
@@ -3846,27 +3842,43 @@
      char * lpxstr;
      int len;
 {
-  if (!lpxstr) return (FALSE);
-
-  if (lplogfont)
+  char height_pixels[8];
+  char height_dpi[8];
+  char width_pixels[8];
+
+  if (!lpxstr) abort ();
+
+  if (!lplogfont)
+    return FALSE;
+
+  if (lplogfont->lfHeight)
     {
-      _snprintf (lpxstr, len - 1,
-		 "-*-%s-%s-%c-*-*-%d-%d-*-*-%c-%d-*-%s-",
-		 lplogfont->lfFaceName,
-		 win32_to_x_weight (lplogfont->lfWeight),
-		 lplogfont->lfItalic?'i':'r',
-		 abs (lplogfont->lfHeight),
-		 (abs (lplogfont->lfHeight) * 720) / one_win32_display_info.height_in,
-		 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) ? 'p' : 'c',
-		 lplogfont->lfWidth * 10,
-		 win32_to_x_charset (lplogfont->lfCharSet)
-		 );
+      sprintf (height_pixels, "%u", abs (lplogfont->lfHeight));
+      sprintf (height_dpi, "%u",
+	       (abs (lplogfont->lfHeight) * 720) / one_win32_display_info.height_in);
     }
   else
     {
-      strncpy (lpxstr,"-*-*-*-*-*-*-*-*-*-*-*-*-*-*-", len - 1);
+      strcpy (height_pixels, "*");
+      strcpy (height_dpi, "*");
     }
-  
+  if (lplogfont->lfWidth)
+    sprintf (width_pixels, "%u", lplogfont->lfWidth * 10);
+  else
+    strcpy (width_pixels, "*");
+
+  _snprintf (lpxstr, len - 1,
+	     "-*-%s-%s-%c-*-*-%s-%s-*-*-%c-%s-*-%s-",
+	     lplogfont->lfFaceName,
+	     win32_to_x_weight (lplogfont->lfWeight),
+	     lplogfont->lfItalic?'i':'r',
+	     height_pixels,
+	     height_dpi,
+	     ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) ? 'p' : 'c',
+	     width_pixels,
+	     win32_to_x_charset (lplogfont->lfCharSet)
+	     );
+
   lpxstr[len - 1] = 0;		/* just to be sure */
   return (TRUE);
 }
@@ -4047,6 +4059,7 @@
 {
   HDC hdc;
   int numFonts;
+  LOGFONT logfont;
   XFontStruct *size_ref;
   Lisp_Object *pattern;
   Lisp_Object *head;
@@ -4068,6 +4081,12 @@
   {
     char buf[100];
 
+    if (!NILP (*(lpef->pattern)) && FontType == TRUETYPE_FONTTYPE)
+      {
+	lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight;
+	lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth;
+      }
+
     if (!win32_to_x_font (lplf, buf, 100)) return (0);
 
     if (NILP (*(lpef->pattern)) || win32_font_match (buf, XSTRING (*(lpef->pattern))->data))
@@ -4196,6 +4215,7 @@
   ef.pattern = &pattern;
   ef.tail = ef.head = &namelist;
   ef.numFonts = 0;
+  x_to_win32_font (STRINGP (pattern) ? XSTRING (pattern)->data : NULL, &ef.logfont);
 
   {
     ef.hdc = GetDC (FRAME_WIN32_WINDOW (f));