emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/frame.c,v


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/src/frame.c,v
Date: Wed, 14 May 2008 01:35:00 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kenichi Handa <handa>   08/05/14 01:34:59

Index: frame.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/frame.c,v
retrieving revision 1.370
retrieving revision 1.371
diff -u -b -r1.370 -r1.371
--- frame.c     9 Apr 2008 03:25:14 -0000       1.370
+++ frame.c     14 May 2008 01:34:57 -0000      1.371
@@ -38,14 +38,15 @@
 #include "commands.h"
 #include "keyboard.h"
 #include "frame.h"
-#ifdef HAVE_WINDOW_SYSTEM
-#include "fontset.h"
-#endif
 #include "blockinput.h"
 #include "termchar.h"
 #include "termhooks.h"
 #include "dispextern.h"
 #include "window.h"
+#ifdef HAVE_WINDOW_SYSTEM
+#include "font.h"
+#include "fontset.h"
+#endif
 #ifdef MSDOS
 #include "msdos.h"
 #include "dosfns.h"
@@ -54,10 +55,6 @@
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-#ifdef USE_FONT_BACKEND
-#include "font.h"
-#endif /* USE_FONT_BACKEND */
-
 /* The name we're using in resource queries.  Most often "emacs".  */
 
 Lisp_Object Vx_resource_name;
@@ -117,9 +114,7 @@
 Lisp_Object Qtty, Qtty_type;
 
 Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
-#ifdef USE_FONT_BACKEND
 Lisp_Object Qfont_backend;
-#endif /* USE_FONT_BACKEND */
 
 Lisp_Object Qinhibit_face_set_after_frame_default;
 Lisp_Object Qface_set_after_frame_default;
@@ -334,10 +329,8 @@
 #endif
   f->size_hint_flags = 0;
   f->win_gravity = 0;
-#ifdef USE_FONT_BACKEND
   f->font_driver_list = NULL;
   f->font_data_list = NULL;
-#endif /* USE_FONT_BACKEND */
 
   root_window = make_window ();
   if (mini_p)
@@ -1468,10 +1461,8 @@
      memory. */
   free_glyphs (f);
 
-#ifdef USE_FONT_BACKEND
   /* Give chance to each font driver to free a frame specific data.  */
   font_update_drivers (f, Qnil);
-#endif /* USE_FONT_BACKEND */
 
   /* Mark all the windows that used to be on FRAME as deleted, and then
      remove the reference to them.  */
@@ -2835,9 +2826,7 @@
   {"right-fringe",             &Qright_fringe},
   {"wait-for-wm",              &Qwait_for_wm},
   {"fullscreen",                &Qfullscreen},
-#ifdef USE_FONT_BACKEND
   {"font-backend",             &Qfont_backend}
-#endif /* USE_FONT_BACKEND */
 };
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -3347,89 +3336,59 @@
      struct frame *f;
      Lisp_Object arg, oldval;
 {
-  Lisp_Object result;
-  Lisp_Object fontset_name;
   Lisp_Object frame;
-  int old_fontset = FRAME_FONTSET(f);
-
-#ifdef USE_FONT_BACKEND
-  if (enable_font_backend)
-    {
       int fontset = -1;
       Lisp_Object font_object;
 
+  /* Set the frame parameter back to the old value because we mail
+     fail to use ARG as the new parameter value.  */
+  store_frame_param (f, Qfont, oldval);
+
       /* ARG is a fontset name, a font name, or a font object.
         In the last case, this function never fail.  */
       if (STRINGP (arg))
        {
          fontset = fs_query_fontset (arg, 0);
          if (fontset < 0)
+       {
            font_object = font_open_by_name (f, SDATA (arg));
+         if (NILP (font_object))
+           error ("Font `%s' is not defined", SDATA (arg));
+         arg = AREF (font_object, FONT_NAME_INDEX);
+       }
          else if (fontset > 0)
            {
              Lisp_Object ascii_font = fontset_ascii (fontset);
 
              font_object = font_open_by_name (f, SDATA (ascii_font));
-           }
-       }
-      else
-       font_object = arg;
-
-      if (fontset < 0 && ! NILP (font_object))
-       fontset = new_fontset_from_font (font_object);
-
-      if (fontset == 0)
-       /* Refuse the default fontset.  */
-       result = Qt;
-      else if (NILP (font_object))
-       result = Qnil;
-      else
-       result = x_new_fontset2 (f, fontset, font_object);
+         if (NILP (font_object))
+           error ("Font `%s' is not defined", SDATA (arg));
+         arg = fontset_name (fontset);
     }
   else
-    {
-#endif /* USE_FONT_BACKEND */
-  CHECK_STRING (arg);
-
-  fontset_name = Fquery_fontset (arg, Qnil);
-
-  BLOCK_INPUT;
-  result = (STRINGP (fontset_name)
-            ? x_new_fontset (f, fontset_name)
-            : x_new_fontset (f, arg));
-  UNBLOCK_INPUT;
-#ifdef USE_FONT_BACKEND
-    }
-#endif
-
-  if (EQ (result, Qnil))
-    error ("Font `%s' is not defined", SDATA (arg));
-  else if (EQ (result, Qt))
     error ("The default fontset can't be used for a frame font");
-  else if (STRINGP (result))
-    {
-      set_default_ascii_font (result);
-      if (STRINGP (fontset_name))
+    }
+  else if (FONT_OBJECT_P (arg))
        {
-         /* Fontset names are built from ASCII font names, so the
-            names may be equal despite there was a change.  */
-         if (old_fontset == FRAME_FONTSET (f))
-           return;
+      font_object = arg;
+      /* This is store the XLFD font name in the frame parameter for
+        backward compatiblity.  We should store the font-object
+        itself in the future.  */
+      arg = AREF (font_object, FONT_NAME_INDEX);
        }
-      store_frame_param (f, Qfont, result);
+  else
+    signal_error ("Invalid font", arg);
 
-      if (!NILP (Fequal (result, oldval)))
+  if (! NILP (Fequal (font_object, oldval)))
         return;
-
+  x_new_font (f, font_object, fontset);
+  store_frame_param (f, Qfont, arg);
       /* Recalculate toolbar height.  */
       f->n_tool_bar_rows = 0;
       /* Ensure we redraw it.  */
       clear_current_matrices (f);
 
       recompute_basic_faces (f);
-    }
-  else
-    abort ();
 
   do_pending_window_change (0);
 
@@ -3446,7 +3405,6 @@
 }
 
 
-#ifdef USE_FONT_BACKEND
 void
 x_set_font_backend (f, new_value, old_value)
      struct frame *f;
@@ -3476,7 +3434,7 @@
   if (! NILP (old_value) && ! NILP (Fequal (old_value, new_value)))
     return;
 
-  if (FRAME_FONT_OBJECT (f))
+  if (FRAME_FONT (f))
     free_all_realized_faces (Qnil);
 
   new_value = font_update_drivers (f, NILP (new_value) ? Qt : new_value);
@@ -3489,7 +3447,7 @@
     }
   store_frame_param (f, Qfont_backend, new_value);
 
-  if (FRAME_FONT_OBJECT (f))
+  if (FRAME_FONT (f))
     {
       Lisp_Object frame;
 
@@ -3499,7 +3457,6 @@
       ++windows_or_buffers_changed;
     }
 }
-#endif /* USE_FONT_BACKEND */
 
 
 void




reply via email to

[Prev in Thread] Current Thread [Next in Thread]