]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't use font names from GConf if font backend can't handle it (bug#6478).
authorJan Djärv <jan.h.d@swipnet.se>
Tue, 22 Jun 2010 07:55:08 +0000 (09:55 +0200)
committerJan Djärv <jan.h.d@swipnet.se>
Tue, 22 Jun 2010 07:55:08 +0000 (09:55 +0200)
* xfns.c (x_default_font_parameter): Try to open font from system
before using it (bug#6478).  Rename got_from_gconf to got_from_system.

src/ChangeLog
src/xfns.c

index 121d06577b0270668dd4c11283f0746bd576e592..3d8e962e070761e719636b7e1fed5eb485feaaed 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-22  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xfns.c (x_default_font_parameter): Try to open font from system
+       before using it (bug#6478).  Rename got_from_gconf to got_from_system.
+
 2010-06-22  Keith Packard <keithp@keithp.com> (tiny change)
 
        * font.c (font_parse_fcname): Allow . for sizes like 7.5 (bug#6437).
index d19914e8dec94d977f7cac8035d331a0c474cdaf..4f9afeef6cc30cb7727a6567e94d49567efc70b5 100644 (file)
@@ -3064,8 +3064,8 @@ x_default_font_parameter (f, parms)
   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
   Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL,
                                       RES_TYPE_STRING);
-  Lisp_Object font;
-  int got_from_gconf = 0;
+  Lisp_Object font = Qnil;
+  int got_from_system = 0;
   if (EQ (font_param, Qunbound))
     font_param = Qnil;
 
@@ -3075,14 +3075,20 @@ x_default_font_parameter (f, parms)
          regardless of font-use-system-font because .emacs may not have been
          read yet.  */
       const char *system_font = xsettings_get_system_font ();
-      if (system_font) font_param = make_string (system_font,
-                                                 strlen (system_font));
+      if (system_font)
+        {
+          char *name = xstrdup (system_font);
+          font = font_open_by_name (f, name);
+          got_from_system = ! NILP (font);
+          free (name);
+        }
     }
-  
-  font = !NILP (font_param) ? font_param
-    : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);
 
-  if (! STRINGP (font))
+  if (NILP (font))
+      font = !NILP (font_param) ? font_param
+      : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);
+
+  if (! FONTP (font) && ! STRINGP (font))
     {
       char *names[]
        = {
@@ -3120,8 +3126,8 @@ x_default_font_parameter (f, parms)
     }
 
   x_default_parameter (f, parms, Qfont, font,
-                       got_from_gconf ? NULL : "font",
-                       got_from_gconf ? NULL : "Font",
+                       got_from_system ? NULL : "font",
+                       got_from_system ? NULL : "Font",
                        RES_TYPE_STRING);
 }