Commit 637fa988 authored by Jan Djärv's avatar Jan Djärv

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.
parent 77fd3e0c
2009-11-17 Jan Djärv <jan.h.d@swipnet.se>
* configure.in: New option: --with(out)-gconf.
Set HAVE_GCONF if we find gconf.
2009-11-17 Glenn Morris <rgm@gnu.org>
* Makefile.in (INFO_FILES): Add semantic.
......
......@@ -716,6 +716,8 @@ GTK_CFLAGS
GTK_LIBS
DBUS_CFLAGS
DBUS_LIBS
GCONF_CFLAGS
GCONF_LIBS
FONTCONFIG_CFLAGS
FONTCONFIG_LIBS
XFT_CFLAGS
......@@ -791,6 +793,7 @@ with_xim
with_ns
with_gpm
with_dbus
with_gconf
with_makeinfo
with_gtk
with_gcc
......@@ -1499,6 +1502,7 @@ Optional Packages:
--without-gpm don't use -lgpm for mouse support on a GNU/Linux
console
--without-dbus don't compile with D-Bus support
--without-gconf don't compile with GConf support
--without-makeinfo don't require makeinfo for building manuals
--with-pkg-config-prog=PATH
......@@ -2240,6 +2244,14 @@ else
fi
# Check whether --with-gconf was given.
if test "${with_gconf+set}" = set; then
withval=$with_gconf;
else
with_gconf=yes
fi
## For the times when you want to build Emacs but don't have
## a suitable makeinfo, and can live without the manuals.
......@@ -12519,6 +12531,111 @@ done
fi
fi
HAVE_GCONF=no
if test "${with_gconf}" = "yes"; then
succeeded=no
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
fi
if test "$PKG_CONFIG" = "no" ; then
HAVE_GCONF=no
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
{ $as_echo "$as_me:$LINENO: checking for gconf-2.0 >= 2.13" >&5
$as_echo_n "checking for gconf-2.0 >= 2.13... " >&6; }
if $PKG_CONFIG --exists "gconf-2.0 >= 2.13" 2>&5; then
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
succeeded=yes
{ $as_echo "$as_me:$LINENO: checking GCONF_CFLAGS" >&5
$as_echo_n "checking GCONF_CFLAGS... " >&6; }
GCONF_CFLAGS=`$PKG_CONFIG --cflags "gconf-2.0 >= 2.13"|sed -e 's,///*,/,g'`
{ $as_echo "$as_me:$LINENO: result: $GCONF_CFLAGS" >&5
$as_echo "$GCONF_CFLAGS" >&6; }
{ $as_echo "$as_me:$LINENO: checking GCONF_LIBS" >&5
$as_echo_n "checking GCONF_LIBS... " >&6; }
GCONF_LIBS=`$PKG_CONFIG --libs "gconf-2.0 >= 2.13"|sed -e 's,///*,/,g'`
{ $as_echo "$as_me:$LINENO: result: $GCONF_LIBS" >&5
$as_echo "$GCONF_LIBS" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
GCONF_CFLAGS=""
GCONF_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
GCONF_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gconf-2.0 >= 2.13"`
fi
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
HAVE_GCONF=yes
else
HAVE_GCONF=no
fi
if test "$HAVE_GCONF" = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GCONF 1
_ACEOF
fi
fi
HAVE_XAW3D=no
if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
if test "$with_xaw3d" != no; then
......@@ -25513,6 +25630,7 @@ echo " Does Emacs use -lpng? ${HAVE_PNG}"
echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}"
echo " Does Emacs use -lgpm? ${HAVE_GPM}"
echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}"
echo " Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}"
......
......@@ -144,6 +144,7 @@ OPTION_DEFAULT_OFF([ns],[use nextstep (Cocoa or GNUstep) windowing system])
OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
OPTION_DEFAULT_ON([gconf],[don't compile with GConf support])
## For the times when you want to build Emacs but don't have
## a suitable makeinfo, and can live without the manuals.
......@@ -1739,6 +1740,16 @@ if test "${with_dbus}" = "yes"; then
fi
fi
dnl GConf has been tested under GNU/Linux only.
dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
HAVE_GCONF=no
if test "${with_gconf}" = "yes"; then
PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.13, HAVE_GCONF=yes, HAVE_GCONF=no)
if test "$HAVE_GCONF" = yes; then
AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.])
fi
fi
dnl Do not put whitespace before the #include statements below.
dnl Older compilers (eg sunos4 cc) choke on it.
HAVE_XAW3D=no
......@@ -2985,6 +2996,7 @@ echo " Does Emacs use -lpng? ${HAVE_PNG}"
echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}"
echo " Does Emacs use -lgpm? ${HAVE_GPM}"
echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}"
echo " Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}"
......
2009-11-17 Jan Djärv <jan.h.d@swipnet.se>
* NEWS: Mention dynamic font changes (font-use-system-font).
2009-11-15 Carsten Dominik <dominik@u016822.science.uva.nl>
* refcards/orgcard.tex: Push version number to 6.33a.
......
......@@ -78,6 +78,18 @@ frame parameter fullscreen makes the Emacs frame maximized.
** The pointer now becomes invisible when typing.
Customize make-pointer-invisible to turn it off.
** Emacs can use the system default monospaced font in Gnome.
The use of the system default font can be turned on or off by customizing
the variable 'font-use-system-font'. It is off by default.
If the system default is changed, Emacs changes also.
This requires that gconf-support is built in. If configure finds the
gconf-libraries, that support is included. Gconf-support can be
turned off with the configure option --without-gconf.
** Emacs now reacts to Xft-changes made by configuration tools on X11.
Changes to antialias, hinting, hintstyle, RGBA, DPI and lcdfilter are
handeled. The XSETTINGS mechanism is used to implement this.
** Killing a buffer with a running process now asks for confirmation.
You can remove this query in two ways: either remove
`process-kill-buffer-query-function' from `kill-buffer-query-functions',
......
2009-11-17 Jan Djärv <jan.h.d@swipnet.se>
* 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.
2009-11-17 Glenn Morris <rgm@gnu.org>
* vc-svn.el (vc-svn-print-log): Fix typo in previous.
......
......@@ -680,6 +680,7 @@ ELCFILES = \
$(lisp)/follow.elc \
$(lisp)/font-core.elc \
$(lisp)/font-lock.elc \
$(lisp)/font-setting.elc \
$(lisp)/format-spec.elc \
$(lisp)/format.elc \
$(lisp)/forms.elc \
......
;;; xsettings.el --- Support dynamic font changes
;; Copyright (C) 2009 Free Software Foundation, Inc.
;; Author: Jan Djärv <jan.h.d@swipnet.se>
;; Maintainer: FSF
;; Keywords: font, system-font
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This file provides the lisp part of the GConf and XSetting code in
;; xsetting.c. But it is nothing that prevents it from being used by
;; other configuration schemes.
;;; Code:
;;; Customizable variables
(defun font-setting-set-system-font (symbol value)
(set-default symbol value)
(if (symbol-value symbol)
(let ((f (selected-frame)))
(if (display-graphic-p f)
(font-setting-change-default-font f t)))))
(defcustom font-use-system-font nil
"If non-nil, use the system monospaced font"
:version "23.2"
:type 'boolean
:group 'font-selection
:set 'font-setting-set-system-font)
(declare-function font-get-system-font "xsettings.c" ())
(defun font-setting-change-default-font (display-or-frame set-font)
"Change font and/or font settings for frames on display DISPLAY-OR-FRAME.
If DISPLAY-OR-FRAME is a frame, the display is the one for that frame.
If set-font is non-nil, change the font for frames. Otherwise re-apply the
current form for the frame (i.e. hinting or somesuch changed)."
(let ((new-font (and (fboundp 'font-get-system-font)
(font-get-system-font))))
(when new-font
;; Be careful here: when set-face-attribute is called for the
;; :font attribute, Emacs tries to guess the best matching font
;; by examining the other face attributes (Bug#2476).
(clear-font-cache)
;; Set for current frames. Only change font for those that have
;; the old font now. If they don't have the old font, the user
;; probably changed it.
(dolist (f (frames-on-display-list display-or-frame))
(if (display-graphic-p f)
(let* ((frame-font
(or (font-get (face-attribute 'default :font f
'default) :name)
(frame-parameter f 'font-parameter)))
(font-to-set
(if set-font new-font
;; else set font again, hinting etc. may have changed.
frame-font)))
(progn
(set-frame-parameter f 'font-parameter font-to-set)
(set-face-attribute 'default f
:width 'normal
:weight 'normal
:slant 'normal
:font font-to-set)))))
;; Set for future frames.
(set-face-attribute 'default t :font new-font)
(let ((spec (list (list t (face-attr-construct 'default)))))
(progn
(put 'default 'customized-face spec)
(custom-push-theme 'theme-face 'default 'user 'set spec)
(put 'default 'face-modified nil))))))
(defun font-setting-handle-config-changed-event (event)
"Handle config-changed-event to change fonts on the display in EVENT.
If `font-use-system-font' is nil, the font is not changed."
(interactive "e")
(let ((type (nth 1 event)) ;; font-name or font-render
(display-name (nth 2 event)))
(if (or (not (eq type 'font-name))
font-use-system-font)
(font-setting-change-default-font display-name
(eq type 'font-name)))))
(if (or (featurep 'system-font-setting) (featurep 'font-render-setting))
(define-key special-event-map [config-changed-event]
'font-setting-handle-config-changed-event))
(provide 'font-setting)
......@@ -198,6 +198,10 @@
(load "international/fontset")
(load "dnd")
(load "tool-bar")))
(if (or (featurep 'system-font-setting) (featurep 'font-render-setting))
(load "font-setting"))
(if (featurep 'x)
(progn
(load "x-dnd")
......
......@@ -660,6 +660,8 @@ by \"Save Options\" in Custom buffers.")
(custom-push-theme 'theme-face 'default 'user 'set spec)
(put 'default 'face-modified nil))))
;;; Assemble all the top-level items of the "Options" menu
(define-key menu-bar-options-menu [customize]
`(menu-item ,(purecopy "Customize Emacs") ,menu-bar-custom-menu))
......@@ -713,6 +715,14 @@ by \"Save Options\" in Custom buffers.")
:visible (display-multi-font-p)
:help ,(purecopy "Select a default font")))
(if (featurep 'system-font-setting)
(define-key menu-bar-options-menu [menu-system-font]
(menu-bar-make-toggle toggle-use-system-font font-use-system-font
"Use system font"
"Use system font: %s"
"Use the monospaced font defined by the system")))
;; The "Show/Hide" submenu of menu "Options"
(defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide"))
......
2009-11-17 Jan Djärv <jan.h.d@swipnet.se>
* 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.
2009-11-17 Kenichi Handa <handa@m17n.org>
* xdisp.c (x_produce_glyphs): Consider face-remapping when falling
......
......@@ -248,6 +248,11 @@ DBUS_LIBS = @DBUS_LIBS@
DBUS_OBJ = dbusbind.o
#endif
#ifdef HAVE_GCONF
GCONF_CFLAGS = @GCONF_CFLAGS@
GCONF_LIBS = @GCONF_LIBS@
#endif
/* DO NOT use -R. There is a special hack described in lastfile.c
which is used instead. Some initialized data areas are modified
at initial startup, then labeled as part of the text area when
......@@ -261,7 +266,7 @@ DBUS_OBJ = dbusbind.o
/* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
since it may have -I options that should override those two. */
ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS}
ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS}
ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@
.SUFFIXES: .m
......@@ -286,7 +291,8 @@ ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@
#ifdef HAVE_X_WINDOWS
XMENU_OBJ = xmenu.o
XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o
XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o \
xsettings.o
#ifdef HAVE_MENUS
......@@ -904,7 +910,7 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \
LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) $(DBUS_LIBS) \
LIBGPM LIBRESOLV LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \
LIBS_DEBUG $(GETLOADAVG_LIBS) \
LIBS_DEBUG $(GETLOADAVG_LIBS) ${GCONF_LIBS} \
@FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \
$(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR)
......@@ -1212,7 +1218,7 @@ xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \
xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
$(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
character.h charset.h coding.h gtkutil.h lisp.h $(config_h) termhooks.h \
fontset.h termchar.h font.h
fontset.h termchar.h font.h xsettings.h
xfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
font.h lisp.h $(config_h)
xftfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
......@@ -1228,13 +1234,13 @@ xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \
xterm.o: xterm.c xterm.h termhooks.h termopts.h termchar.h window.h buffer.h \
dispextern.h frame.h disptab.h blockinput.h atimer.h systime.h syssignal.h \
keyboard.h emacs-icon.h character.h charset.h ccl.h fontset.h composite.h \
coding.h process.h gtkutil.h font.h fontset.h lisp.h $(config_h)
coding.h process.h gtkutil.h font.h fontset.h lisp.h $(config_h) xsettings.h
xselect.o: xselect.c process.h dispextern.h frame.h xterm.h blockinput.h \
buffer.h atimer.h systime.h termhooks.h lisp.h $(config_h)
xrdb.o: xrdb.c lisp.h $(config_h) epaths.h
xsmfns.o: xsmfns.c lisp.h $(config_h) systime.h sysselect.h termhooks.h xterm.h \
lisp.h termopts.h
xsettings.o: xterm.h xsettings.h lisp.h frame.h termhooks.h $(config_h)
/* The files of Lisp proper */
alloc.o: alloc.c process.h frame.h window.h buffer.h puresize.h syssignal.h keyboard.h \
......
......@@ -201,6 +201,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the `gai_strerror' function. */
#undef HAVE_GAI_STRERROR
/* Define to 1 if using GConf. */
#undef HAVE_GCONF
/* Define to 1 if you have the `gdk_display_open' function. */
#undef HAVE_GDK_DISPLAY_OPEN
......
......@@ -1669,6 +1669,7 @@ main (int argc, char **argv)
syms_of_xfns ();
syms_of_xmenu ();
syms_of_fontset ();
syms_of_xsettings ();
#ifdef HAVE_X_SM
syms_of_xsmfns ();
#endif
......@@ -1749,7 +1750,7 @@ main (int argc, char **argv)
#endif
init_window ();
init_font ();
if (!initialized)
{
char *file;
......
......@@ -718,8 +718,6 @@ font_put_extra (font, prop, val)
{
Lisp_Object prev = Qnil;
if (NILP (val))
return val;
while (CONSP (extra)
&& NILP (Fstring_lessp (prop, XCAR (XCAR (extra)))))
prev = extra, extra = XCDR (extra);
......@@ -1431,6 +1429,8 @@ font_parse_fcname (name, font)
if (family_end)
{
Lisp_Object extra_props = Qnil;
/* A fontconfig name with size and/or property data. */
if (family_end > name)
{
......@@ -1504,13 +1504,25 @@ font_parse_fcname (name, font)
if (prop >= FONT_FOUNDRY_INDEX
&& prop < FONT_EXTRA_INDEX)
ASET (font, prop, font_prop_validate (prop, Qnil, val));
else
Ffont_put (font, key, val);
ASET (font, prop, font_prop_validate (prop, Qnil, val));
else
{
extra_props = nconc2 (extra_props,
Fcons (Fcons (key, val), Qnil));
}
}
p = q;
}
}
if (! NILP (extra_props))
{
struct font_driver_list *driver_list = font_driver_list;
for ( ; driver_list; driver_list = driver_list->next)
if (driver_list->driver->filter_properties)
(*driver_list->driver->filter_properties) (font, extra_props);
}
}
else
{
......@@ -2975,11 +2987,15 @@ font_open_entity (f, entity, pixel_size)
else if (CONSP (Vface_font_rescale_alist))
scaled_pixel_size = pixel_size * font_rescale_ratio (entity);
#if 0
/* This doesn't work if you have changed hinting or any other parameter.
We need to make a new object in every case to be sure. */
for (objlist = AREF (entity, FONT_OBJLIST_INDEX); CONSP (objlist);
objlist = XCDR (objlist))
if (! NILP (AREF (XCAR (objlist), FONT_TYPE_INDEX))
&& XFONT_OBJECT (XCAR (objlist))->pixel_size == pixel_size)
return XCAR (objlist);
#endif
val = AREF (entity, FONT_TYPE_INDEX);
for (driver_list = f->font_driver_list;
......@@ -3155,12 +3171,14 @@ font_clear_prop (attrs, prop)
if (! FONTP (font))
return;
#if 0
if (! NILP (Ffont_get (font, QCname)))
{
font = Fcopy_font_spec (font);
font_put_extra (font, QCname, Qnil);
}
#endif
if (NILP (AREF (font, prop))
&& prop != FONT_FAMILY_INDEX
&& prop != FONT_FOUNDRY_INDEX
......@@ -3438,7 +3456,7 @@ font_find_for_lface (f, attrs, spec, c)
val = font_select_entity (frame, entities,
attrs, pixel_size, c);
if (! NILP (val))
return val;
return val;
}
}
}
......@@ -3500,7 +3518,7 @@ font_load_for_lface (f, attrs, spec)
FRAME_PTR f;
Lisp_Object *attrs, spec;
{
Lisp_Object entity;
Lisp_Object entity, name;
entity = font_find_for_lface (f, attrs, spec, -1);
if (NILP (entity))
......@@ -3512,7 +3530,13 @@ font_load_for_lface (f, attrs, spec)
if (NILP (entity))
return Qnil;
}
return font_open_for_lface (f, entity, attrs, spec);
/* Don't loose the original name that was put in initially. We need
it to re-apply the font when font parameters (like hinting or dpi) have
changed. */
entity = font_open_for_lface (f, entity, attrs, spec);
name = Ffont_get (spec, QCname);
if (STRINGP (name)) font_put_extra (entity, QCname, name);
return entity;
}
......
......@@ -687,6 +687,8 @@ struct font_driver
the (N-1)th element of VARIATIONS. */
int (*get_variation_glyphs) P_ ((struct font *font,
int c, unsigned variations[256]));
void (*filter_properties) P_ ((Lisp_Object font, Lisp_Object properties));
};
......
......@@ -3359,7 +3359,7 @@ x_set_font (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
{
Lisp_Object frame, font_object, lval;
Lisp_Object frame, font_object;
int fontset = -1;
/* Set the frame parameter back to the old value because we may
......@@ -3427,7 +3427,6 @@ x_set_font (f, arg, oldval)
i