diff options
| author | Juanma Barranquero | 2009-11-18 11:26:47 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2009-11-18 11:26:47 +0000 |
| commit | e0620570f063b501dc65cda433c483e5471e4a44 (patch) | |
| tree | 52ff2d69fbb441ccd0edd9208f6b76c8948120c0 | |
| parent | 0fe0a1cab0b299045879a5471ecc912373be7b57 (diff) | |
| download | emacs-e0620570f063b501dc65cda433c483e5471e4a44.tar.gz emacs-e0620570f063b501dc65cda433c483e5471e4a44.zip | |
* font-setting.el (font-use-system-font): Declare for byte-compiler.
(font-setting-change-default-font): Fix typo in docstring.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/font-setting.el | 16 |
2 files changed, 14 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a46550edb33..d8b01c73c03 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2009-11-18 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * font-setting.el (font-use-system-font): Declare for byte-compiler. | ||
| 4 | (font-setting-change-default-font): Fix typo in docstring. | ||
| 5 | |||
| 1 | 2009-11-18 Alan Mackenzie <acm@muc.de> | 6 | 2009-11-18 Alan Mackenzie <acm@muc.de> |
| 2 | 7 | ||
| 3 | * progmodes/cc-defs.el (c-version): Bump to 5.31.8. | 8 | * progmodes/cc-defs.el (c-version): Bump to 5.31.8. |
diff --git a/lisp/font-setting.el b/lisp/font-setting.el index 51cf1375d8f..3bd5a43da08 100644 --- a/lisp/font-setting.el +++ b/lisp/font-setting.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; xsettings.el --- Support dynamic font changes | 1 | ;;; font-setting.el --- Support dynamic font changes |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2009 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2009 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -33,14 +33,16 @@ | |||
| 33 | 33 | ||
| 34 | (declare-function font-get-system-font "xsettings.c" ()) | 34 | (declare-function font-get-system-font "xsettings.c" ()) |
| 35 | 35 | ||
| 36 | (defvar font-use-system-font) | ||
| 37 | |||
| 36 | (defun font-setting-change-default-font (display-or-frame set-font) | 38 | (defun font-setting-change-default-font (display-or-frame set-font) |
| 37 | "Change font and/or font settings for frames on display DISPLAY-OR-FRAME. | 39 | "Change font and/or font settings for frames on display DISPLAY-OR-FRAME. |
| 38 | If DISPLAY-OR-FRAME is a frame, the display is the one for that frame. | 40 | If DISPLAY-OR-FRAME is a frame, the display is the one for that frame. |
| 39 | 41 | ||
| 40 | If set-font is non-nil, change the font for frames. Otherwise re-apply the | 42 | If SET-FONT is non-nil, change the font for frames. Otherwise re-apply the |
| 41 | current form for the frame (i.e. hinting or somesuch changed)." | 43 | current form for the frame (i.e. hinting or somesuch changed)." |
| 42 | 44 | ||
| 43 | (let ((new-font (and (fboundp 'font-get-system-font) | 45 | (let ((new-font (and (fboundp 'font-get-system-font) |
| 44 | (font-get-system-font)))) | 46 | (font-get-system-font)))) |
| 45 | (when new-font | 47 | (when new-font |
| 46 | ;; Be careful here: when set-face-attribute is called for the | 48 | ;; Be careful here: when set-face-attribute is called for the |
| @@ -53,7 +55,7 @@ current form for the frame (i.e. hinting or somesuch changed)." | |||
| 53 | ;; probably changed it. | 55 | ;; probably changed it. |
| 54 | (dolist (f (frames-on-display-list display-or-frame)) | 56 | (dolist (f (frames-on-display-list display-or-frame)) |
| 55 | (if (display-graphic-p f) | 57 | (if (display-graphic-p f) |
| 56 | (let* ((frame-font | 58 | (let* ((frame-font |
| 57 | (or (font-get (face-attribute 'default :font f | 59 | (or (font-get (face-attribute 'default :font f |
| 58 | 'default) :name) | 60 | 'default) :name) |
| 59 | (frame-parameter f 'font-parameter))) | 61 | (frame-parameter f 'font-parameter))) |
| @@ -65,12 +67,12 @@ current form for the frame (i.e. hinting or somesuch changed)." | |||
| 65 | (progn | 67 | (progn |
| 66 | (message "setting %s" font-to-set) | 68 | (message "setting %s" font-to-set) |
| 67 | (set-frame-parameter f 'font-parameter font-to-set) | 69 | (set-frame-parameter f 'font-parameter font-to-set) |
| 68 | (set-face-attribute 'default f | 70 | (set-face-attribute 'default f |
| 69 | :width 'normal | 71 | :width 'normal |
| 70 | :weight 'normal | 72 | :weight 'normal |
| 71 | :slant 'normal | 73 | :slant 'normal |
| 72 | :font font-to-set)))))) | 74 | :font font-to-set)))))) |
| 73 | 75 | ||
| 74 | ;; Set for future frames. | 76 | ;; Set for future frames. |
| 75 | (set-face-attribute 'default t :font new-font) | 77 | (set-face-attribute 'default t :font new-font) |
| 76 | (let ((spec (list (list t (face-attr-construct 'default))))) | 78 | (let ((spec (list (list t (face-attr-construct 'default))))) |
| @@ -91,7 +93,7 @@ If `font-use-system-font' is nil, the font is not changed." | |||
| 91 | (eq type 'font-name))))) | 93 | (eq type 'font-name))))) |
| 92 | 94 | ||
| 93 | (if (or (featurep 'system-font-setting) (featurep 'font-render-setting)) | 95 | (if (or (featurep 'system-font-setting) (featurep 'font-render-setting)) |
| 94 | (define-key special-event-map [config-changed-event] | 96 | (define-key special-event-map [config-changed-event] |
| 95 | 'font-setting-handle-config-changed-event)) | 97 | 'font-setting-handle-config-changed-event)) |
| 96 | 98 | ||
| 97 | (provide 'font-setting) | 99 | (provide 'font-setting) |