Subject: Re: bug#1547: face-font-rescale-alist has no effect

From: Chong Yidong <[email-masked]>
Date: Sat, 18 Apr 2009 00:11:20 -0400

> > What I currently don't understand is that the font rescaling doesn't
> > work for the default font in the above case even after
> > (clear-face-cache t).  I'm now investigating the reason.
>
> I think the problem here is that the opened font objects are already
> stored in the LFACE_FONT entry of the default face.  Note that
>
> M-: (set-face-attribute 'default nil :font (font-spec)) RET
>
> successfully refreshes the face with the correct rescaling.

Until a better solution comes along, I propose dealing with this
situation with the following hack in startup.el: check to see if the
init file changed face-font-rescale-alist, and reload the default face
if necessary.

What do you think?

*** trunk/lisp/startup.el.~1.527.~	2009-02-20 10:20:55.000000000 -0500
--- trunk/lisp/startup.el	2009-04-18 00:07:05.000000000 -0400
***************
*** 499,505 ****
  		     (delete (concat "PWD=" pwd)
  			     process-environment)))))
      (setq default-directory (abbreviate-file-name default-directory))
!     (let ((menubar-bindings-done nil))
        (unwind-protect
  	  (command-line)
  	;; Do this again, in case .emacs defined more abbreviations.
--- 499,506 ----
  		     (delete (concat "PWD=" pwd)
  			     process-environment)))))
      (setq default-directory (abbreviate-file-name default-directory))
!     (let ((menubar-bindings-done nil)
! 	  (old-face-font-rescale-alist face-font-rescale-alist))
        (unwind-protect
  	  (command-line)
  	;; Do this again, in case .emacs defined more abbreviations.
***************
*** 540,545 ****
--- 541,551 ----
  		  (not (and initial-window-system
  			    (not noninteractive)
  			    (not (eq initial-window-system 'pc)))))
+ 	  ;; If face-font-rescale-alist has changed, reload the
+ 	  ;; default font.
+ 	  (unless (eq face-font-rescale-alist
+ 		      old-face-font-rescale-alist)
+ 	    (set-face-attribute 'default nil :font (font-spec)))
  	  ;; Modify the initial frame based on what .emacs puts into
  	  ;; ...-frame-alist.
  	  (if (fboundp 'frame-notice-user-settings)

Diff finished.  Sat Apr 18 00:07:09 2009