diff options
author | Chong Yidong <cyd@gnu.org> | 2012-08-15 15:58:34 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2012-08-15 15:58:34 +0800 |
commit | f2045622a553a1f3919ccef6d94fc6e1207e38f6 (patch) | |
tree | d938f60c4ace8cd1123d6046f93890022d8f6943 /lisp/frame.el | |
parent | e568d279c5ba2c408703653aee8f8f764b3eb897 (diff) | |
download | emacs-f2045622a553a1f3919ccef6d94fc6e1207e38f6.tar.gz |
Extract better font information from the GTK >= 3.2 font chooser.
* gtkutil.c (xg_get_font): Rename from xg_get_font_name. When
using the new font chooser, use gtk_font_chooser_get_font_desc to
extract the font descriptor instead of just the font name. In
that case, return a font spec instead of a string.
(x_last_font_name): Move to this file from xfns.c.
* xfns.c (Fx_select_font): The return value can also be a font
spec. Move x_last_font_name management to gtkutil.c.
* xfaces.c: Make font weight and style symbols non-static.
* lisp/frame.el (set-frame-font): Accept font objects.
Diffstat (limited to 'lisp/frame.el')
-rw-r--r-- | lisp/frame.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/frame.el b/lisp/frame.el index 778028390e7..e905e66a5f9 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1051,10 +1051,12 @@ If FRAME is omitted, describe the currently selected frame." (define-obsolete-function-alias 'set-default-font 'set-frame-font "23.1") -(defun set-frame-font (font-name &optional keep-size frames) - "Set the default font to FONT-NAME. +(defun set-frame-font (font &optional keep-size frames) + "Set the default font to FONT. When called interactively, prompt for the name of a font, and use -that font on the selected frame. +that font on the selected frame. When called from Lisp, FONT +should be a font name (a string), a font object, font entity, or +font spec. If KEEP-SIZE is nil, keep the number of frame lines and columns fixed. If KEEP-SIZE is non-nil (or with a prefix argument), try @@ -1076,7 +1078,7 @@ this session\", so that the font is applied to future frames." nil nil nil nil (frame-parameter nil 'font)))) (list font current-prefix-arg nil))) - (when (stringp font-name) + (when (or (stringp font) (fontp font)) (let* ((this-frame (selected-frame)) ;; FRAMES nil means affect the selected frame. (frame-list (cond ((null frames) @@ -1097,7 +1099,7 @@ this session\", so that the font is applied to future frames." ;; (:width, :weight, etc.) so reset them too (Bug#2476). (set-face-attribute 'default f :width 'normal :weight 'normal - :slant 'normal :font font-name) + :slant 'normal :font font) (if keep-size (modify-frame-parameters f |