# HG changeset patch # User Jan D. # Date 1277193308 -7200 # Node ID 20747b4a7983ef1853b9e40937dac3d47c1568ec # Parent 3bd67aa6b7e22cf9830d47ba90cc1e32e5c7b72a Don't use font names from GConf if font backend can't handle it (bug#6478). * 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. diff -r 3bd67aa6b7e2 -r 20747b4a7983 src/ChangeLog --- a/src/ChangeLog Tue Jun 22 00:51:46 2010 -0700 +++ b/src/ChangeLog Tue Jun 22 09:55:08 2010 +0200 @@ -1,3 +1,8 @@ +2010-06-22 Jan Djärv + + * 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 (tiny change) * font.c (font_parse_fcname): Allow . for sizes like 7.5 (bug#6437). diff -r 3bd67aa6b7e2 -r 20747b4a7983 src/xfns.c --- a/src/xfns.c Tue Jun 22 00:51:46 2010 -0700 +++ b/src/xfns.c Tue Jun 22 09:55:08 2010 +0200 @@ -3064,8 +3064,8 @@ 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 @@ 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_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); }