;; Frame's font parameter demonstration. ;; The trouble reside in a frame's font parameter when a font is ;; specified in the default-frame-alist using wildcards. For the first ;; frame created by emacs, the font parameter is the same as the ;; specifications (ie wildcarded), while for subsequent frames the ;; parameter is the real XLFD of the used font. This behavior diverges ;; from emacs 20 and is unexpected. ;; Test it using "emacs -q -no-site-file -l font-parameter-demo.el" ;; Following is the output I got: ;; (emacs-version) ;; ==> "GNU Emacs 21.3.1 (i386-unknown-freebsd4.5, X toolkit) ;; of 2004-02-25 on memo.frmug.org" ;; (assoc (quote font) default-frame-alist) ;; ==> (font . "-b&h-luxi mono-medium-r-normal-*-*-130-*-*-m-*-iso8859-1") ;; (frame-parameter (selected-frame) (quote font)) ;; ==> "-b&h-luxi mono-medium-r-normal-*-*-130-*-*-m-*-iso8859-1" ;; (face-attribute (quote default) :font) ;; ==> "-b&h-luxi mono-medium-r-normal--14-130-75-75-m-80-iso8859-1" ;; *** Again on a new frame ;; (frame-parameter (selected-frame) (quote font)) ;; ==> "-b&h-luxi mono-medium-r-normal--14-130-75-75-m-80-iso8859-1" ;; (face-attribute (quote default) :font) ;; ==> "-b&h-luxi mono-medium-r-normal--14-130-75-75-m-80-iso8859-1" (setq default-frame-alist '((font . "-b&h-luxi mono-medium-r-normal-*-*-130-*-*-m-*-iso8859-1"))) (setq initial-frame-alist default-frame-alist) (setq the-first-frame (selected-frame)) (defmacro eval-print (expr) `(progn (prin1 (quote ,expr)) (terpri) (princ "==> ") (prin1 ,expr) (terpri))) (defun bug-case () (interactive) (setq standard-output (get-buffer-create "*test-output*")) (switch-to-buffer standard-output) (if (eq (selected-frame) the-first-frame) (progn (eval-print (emacs-version)) (eval-print (assoc 'font default-frame-alist)))) (eval-print (frame-parameter (selected-frame) 'font)) (eval-print (face-attribute 'default :font)) (if (eq (selected-frame) the-first-frame) (progn (princ "*** Again on a new frame") (terpri) (select-frame (make-frame '((background-color . "bisque")))) (bug-case)))) (add-hook 'window-setup-hook 'bug-case t) ;; EOF