Function: font-setting-change-default-font

font-setting-change-default-font is a byte-compiled function defined in dynamic-setting.el.gz.

Signature

(font-setting-change-default-font DISPLAY-OR-FRAME SET-FONT)

Documentation

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).

Source Code

;; Defined in /usr/src/emacs/lisp/dynamic-setting.el.gz
(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)))
	(frame-list (frames-on-display-list display-or-frame)))
    (when (and new-font (display-graphic-p display-or-frame))
      (clear-font-cache)
      (if set-font
	  ;; Set the font on all current and future frames, as though
	  ;; the `default' face had been "set for this session":
	  (set-frame-font new-font nil frame-list)
	;; Just redraw the existing fonts on all frames:
	(dolist (f frame-list)
	  (let ((frame-font
		 (or (font-get (face-attribute 'default :font f 'default)
			       :user-spec)
		     (frame-parameter f 'font-parameter))))
	    (when frame-font
	      (set-frame-parameter f 'font-parameter frame-font)
	      (set-face-attribute 'default f
				  :width 'normal
				  :weight 'normal
				  :slant 'normal
				  :font frame-font))))))))