GNU bug report logs - #19408
25.0.50; Incorrect handling of face-font-rescale-alist on startup mangles font settings

Previous Next

Package: emacs;

Reported by: Kirill Ignatiev <kirill.ignatiev <at> gmail.com>

Date: Thu, 18 Dec 2014 20:27:02 UTC

Severity: normal

Tags: moreinfo

Found in version 25.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Kirill Ignatiev <kirill.ignatiev <at> gmail.com>
To: 19408 <at> debbugs.gnu.org
Subject: bug#19408: 25.0.50; Incorrect handling of face-font-rescale-alist on startup mangles font settings
Date: Thu, 18 Dec 2014 15:26:19 -0500
[Message part 1 (text/plain, inline)]
Take the following .emacs file:

(custom-set-faces
 '(default ((t (:inherit nil :height 110 :foundry "nil" :family
"Source Code Pro")))))

(add-to-list 'face-font-rescale-alist (cons (font-spec :family
"STIXGeneral") 0.95) t)

Run emacs with no other customizations, using -Q -l <file.el>. The
font in the initial frame in the scratch buffer will be Source Code
Pro, as expected. Open a new frame, the font in that frame will be
some other font (in my case Helvetica), not the default one.

During startup, if face-font-rescale-alist changes, emacs will mangle
the default font setting, causing it to be wrong for all non-initial
frames.

I found the following workaround:

;; Workaround for emacs/lisp/startup.el:670
(defadvice frame-notice-user-settings (before my:rescale-alist)
  ;; (message "Set face-font-rescale-alist")
  (add-to-list 'face-font-rescale-alist
      (cons (font-spec :family "STIXGeneral") 0.95) t))
(ad-activate 'frame-notice-user-settings)

for this particular bit of lisp/startup.el (line ~660)

 ;; FIXME: The user's init file may change
 ;; face-font-rescale-alist.  However, the default face
 ;; already has an assigned font object, which does not take
 ;; face-font-rescale-alist into account.  For such
 ;; situations, we ought to have a way to find all font
 ;; objects and regenerate them; currently we do not.  As a
 ;; workaround, we specifically reset te default face's :font
 ;; attribute here.  See bug#1785.
 (unless (eq face-font-rescale-alist
     old-face-font-rescale-alist)
   (set-face-attribute 'default nil :font (font-spec)))

I am not sure how the default font should be regenerated in case it's
affected by face-font-rescale-alist, but using (font-spec) is wrong
because it resets user's own settings.

I attached the output of report-emacs-bug.
[report-emacs-bug.txt (text/plain, attachment)]

This bug report was last modified 4 years and 231 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.