changeset 90865:6d2559699bd0

[USE_FONT_BACKEND]: Port font backend changes from xfns.c. (x_to_w32_charset, w32_to_x_charset): Expose externally.
author Jason Rumney <jasonr@gnu.org>
date Thu, 31 May 2007 00:48:07 +0000
parents 834a5e8f248c
children 109057569e6e
files src/w32fns.c
diffstat 1 files changed, 75 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32fns.c	Thu May 31 00:42:37 2007 +0000
+++ b/src/w32fns.c	Thu May 31 00:48:07 2007 +0000
@@ -57,6 +57,10 @@
 #include <dlgs.h>
 #define FILE_NAME_TEXT_FIELD edt1
 
+#ifdef USE_FONT_BACKEND
+#include "font.h"
+#endif
+
 void syms_of_w32fns ();
 void globals_of_w32fns ();
 
@@ -4129,6 +4133,38 @@
   return Qnil;
 }
 
+#ifdef USE_FONT_BACKEND
+static void
+x_default_font_parameter (f, parms)
+     struct frame *f;
+     Lisp_Object parms;
+{
+  struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
+  Lisp_Object font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font",
+                                RES_TYPE_STRING);
+
+  if (!STRINGP (font))
+    {
+      int i;
+      static char *names[]
+        = { "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1",
+            "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1",
+            "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1",
+            "Fixedsys",
+            NULL };
+
+      for (i = 0; names[i]; i++)
+        {
+          font = font_open_by_name (f, names[i]);
+          if (! NILP (font))
+            break;
+        }
+      if (NILP (font))
+        error ("No suitable font was found");
+    }
+  x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING);
+}
+#endif
 
 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
        1, 1, 0,
@@ -4261,8 +4297,25 @@
       specbind (Qx_resource_name, name);
     }
 
+#ifdef USE_FONT_BACKEND
+  if (enable_font_backend)
+    {
+      /* Perhaps, we must allow frame parameter, say `font-backend',
+	 to specify which font backends to use.  */
+      register_font_driver (&w32font_driver, f);
+
+      x_default_parameter (f, parameters, Qfont_backend, Qnil,
+			   "fontBackend", "FontBackend", RES_TYPE_STRING);
+    }
+#endif	/* USE_FONT_BACKEND */
+
   /* Extract the window parameters from the supplied values
      that are needed to determine window geometry.  */
+#ifdef USE_FONT_BACKEND
+  if (enable_font_backend)
+    x_default_font_parameter (f, parameters);
+  else
+#endif 
   {
     Lisp_Object font;
 
@@ -4852,7 +4905,7 @@
     return "*";
 }
 
-static LONG
+LONG
 x_to_w32_charset (lpcs)
     char * lpcs;
 {
@@ -4940,7 +4993,7 @@
 }
 
 
-static char *
+char *
 w32_to_x_charset (fncharset, matching)
     int fncharset;
     char *matching;
@@ -7339,8 +7392,25 @@
       specbind (Qx_resource_name, name);
     }
 
+#ifdef USE_FONT_BACKEND
+  if (enable_font_backend)
+    {
+      /* Perhaps, we must allow frame parameter, say `font-backend',
+	 to specify which font backends to use.  */
+      register_font_driver (&w32font_driver, f);
+
+      x_default_parameter (f, parms, Qfont_backend, Qnil,
+			   "fontBackend", "FontBackend", RES_TYPE_STRING);
+    }
+#endif	/* USE_FONT_BACKEND */
+
   /* Extract the window parameters from the supplied values
      that are needed to determine window geometry.  */
+#ifdef USE_FONT_BACKEND
+  if (enable_font_backend)
+    x_default_font_parameter (f, parms);
+  else
+#endif	/* USE_FONT_BACKEND */
   {
     Lisp_Object font;
 
@@ -8655,6 +8725,9 @@
   x_set_fringe_width,
   0, /* x_set_wait_for_wm, */
   x_set_fullscreen,
+#ifdef USE_FONT_BACKEND
+  x_set_font_backend
+#endif
 };
 
 void