diff options
author | Jan Djärv <jan.h.d@swipnet.se> | 2009-11-17 08:21:23 +0000 |
---|---|---|
committer | Jan Djärv <jan.h.d@swipnet.se> | 2009-11-17 08:21:23 +0000 |
commit | 637fa9880877f485842b7aca18146a1f12c05b96 (patch) | |
tree | f4994cdadaad980b7b28827eba6cd50421a7f892 /src/xfns.c | |
parent | 77fd3e0c13b345cd4ff5c9ef5c89bd6b29054bc3 (diff) | |
download | emacs-637fa9880877f485842b7aca18146a1f12c05b96.tar.gz |
Handle system default font and changing font parameters.
* xterm.h (struct x_display_info): Add atoms and Window for xsettings.
* xterm.c (handle_one_xevent): Call xft_settings_event for
ClientMessage, PropertyNotify and DestroyNotify.
(x_term_init): If we have XFT, get DPI from Xft.dpi.
Call xsettings_initialize.
* xftfont.c (xftfont_fix_match): New function.
(xftfont_open): Call XftDefaultSubstitute before XftFontMatch.
Call xftfont_fix_match after XftFontMatch.
* xfont.c (xfont_driver): Initialize all members.
* xfns.c (x_default_font_parameter): Try font from Ffont_get_system_font.
Do not get font from x_default_parameter if we got one from
Ffont_get_system_font.
(Fx_select_font): Get the defaut font name from :name of FRAME_FONT (f).
* w32font.c (w32font_driver): Initialize all members.
* termhooks.h (enum event_kind): CONFIG_CHANGED_EVENT is new.
* lisp.h: Declare syms_of_xsettings.
* keyboard.c (kbd_buffer_get_event, make_lispy_event): Handle
CONFIG_CHANGED_EVENT.
* ftfont.c (ftfont_filter_properties): New function.
* frame.c (x_set_font): Remove unused variable lval.
* font.h (struct font_driver): filter_properties is new.
* font.c (font_put_extra): Don't return if val is nil, it means
boolean option is off.
(font_parse_fcname): Collect all extra properties in extra_props
and call filter_properties for all drivers with extra_props and
font as parameter.
(font_open_entity): Do not use cache, it does not pick up new fontconfig
settings like hinting.
(font_load_for_lface): If spec had a name in it, store it in entity.
* emacs.c (main): Call syms_of_xsettings
* config.in: HAVE_GCONF is new.
* Makefile.in (GCONF_CFLAGS, GCONF_LIBS): New variables for HAVE_GCONF.
xsettings.o is new.
* menu-bar.el: Put "Use system font" in Option-menu.
* loadup.el: If feature system-font-setting or font-render-setting is
there, load font-setting.
* Makefile.in (ELCFILES): font-settings.el is new.
* font-setting.el: New file.
* NEWS: Mention dynamic font changes (font-use-system-font).
* configure.in: New option: --with(out)-gconf.
Set HAVE_GCONF if we find gconf.
Diffstat (limited to 'src/xfns.c')
-rw-r--r-- | src/xfns.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/src/xfns.c b/src/xfns.c index 0a041a7dc9d..3d5a2a127d6 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -98,6 +98,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <Xm/FileSB.h> #endif +#include "xsettings.h" + #if !defined(NO_EDITRES) #define HACK_EDITRES extern void _XEditResCheckMessages (); @@ -3025,13 +3027,19 @@ 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); + RES_TYPE_STRING); Lisp_Object font; + int got_from_gconf = 0; if (EQ (font_param, Qunbound)) - font_param = Qnil; + { + font_param = Qnil; + font_param = Ffont_get_system_font(); + got_from_gconf = !NILP (font_param); + } + font = !NILP (font_param) ? font_param : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); - + if (! STRINGP (font)) { char *names[] @@ -3068,7 +3076,11 @@ x_default_font_parameter (f, parms) we've applied the `default' face settings. */ x_set_frame_parameters (f, Fcons (Fcons (Qfont_param, font_param), Qnil)); } - x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); + + x_default_parameter (f, parms, Qfont, font, + got_from_gconf ? NULL : "font", + got_from_gconf ? NULL : "Font", + RES_TYPE_STRING); } @@ -5569,10 +5581,10 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) { FRAME_PTR f = check_x_frame (frame); char *name; - Lisp_Object default_font, font = Qnil; + Lisp_Object font; Lisp_Object font_param; char *default_name = NULL; - struct gcpro gcpro1; + struct gcpro gcpro1, gcpro2; int count = SPECPDL_INDEX (); check_x (); @@ -5586,21 +5598,22 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) BLOCK_INPUT; - GCPRO1(font_param); - font_param = Fframe_parameter (frame, Qfont_param); + GCPRO2(font_param, font); - if (x_last_font_name != NULL) - default_name = x_last_font_name; - else if (STRINGP (font_param)) + XSETFONT (font, FRAME_FONT (f)); + font_param = Ffont_get (font, intern_c_string (":name")); + if (STRINGP (font_param)) default_name = SDATA (font_param); - else if (FONTP (default_font)) + else { - XSETFONT (default_font, FRAME_FONT (f)); - default_name = alloca (256); - if (font_unparse_gtkname (default_font, f, default_name, 256) < 0) - default_name = NULL; + font_param = Fframe_parameter (frame, Qfont_param); + if (STRINGP (font_param)) + default_name = SDATA (font_param); } + if (default_name == NULL && x_last_font_name != NULL) + default_name = x_last_font_name; + name = xg_get_font_name (f, default_name); if (name) |