bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19408: 25.0.50; Incorrect handling of face-font-rescale-alist on sta


From: Kirill Ignatiev
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

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.

Attachment: report-emacs-bug.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]