unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19408: 25.0.50; Incorrect handling of face-font-rescale-alist on startup mangles font settings
@ 2014-12-18 20:26 Kirill Ignatiev
  2020-12-03 12:20 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill Ignatiev @ 2014-12-18 20:26 UTC (permalink / raw)
  To: 19408

[-- Attachment #1: Type: text/plain, Size: 1796 bytes --]

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 #2: report-emacs-bug.txt --]
[-- Type: text/plain, Size: 2394 bytes --]


In GNU Emacs 25.0.50.32 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F34))
 of 2014-12-16 on dhcp1-38.red.sandbox
Repository revision: d08f4f8fc5219324ac352c6d89f0db5c6a18ce32
Windowing system distributor `Apple', version 10.3.1265
Configured using:
 `configure --with-ns --without-sound CPPFLAGS=-I/sw/include
 LDFLAGS=-L/sw/lib'

Configured features:
ACL LIBXML2 ZLIB

Important settings:
  value of $LANG: en_IE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Type C-x 1 to delete the help window.
Making completion list...
Mark set
"25.0.50.32"

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils vc-git diff-mode easy-mmode help-mode
easymenu advice help-fns time-date tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
cocoa ns multi-tty emacs)

Memory information:
((conses 16 84880 8004)
 (symbols 48 19497 1)
 (miscs 40 99 214)
 (strings 32 15805 4810)
 (string-bytes 1 387443)
 (vectors 16 10556)
 (vector-slots 8 399657 6002)
 (floats 8 63 93)
 (intervals 56 572 0)
 (buffers 976 15))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#19408: 25.0.50; Incorrect handling of face-font-rescale-alist on startup mangles font settings
  2014-12-18 20:26 bug#19408: 25.0.50; Incorrect handling of face-font-rescale-alist on startup mangles font settings Kirill Ignatiev
@ 2020-12-03 12:20 ` Lars Ingebrigtsen
  2020-12-03 12:53   ` Kirill Ignatiev
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-03 12:20 UTC (permalink / raw)
  To: Kirill Ignatiev; +Cc: 19408

Kirill Ignatiev <kirill.ignatiev@gmail.com> writes:

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

(This bug report unfortunately got no response at the time.)

I'm not sure what font that is, but I tried this in Emacs 28:

# apt install fonts-stix
emacs -Q -l /tmp/stix.el

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

I get

    ftcrhb:-GOOG-Noto Sans CJK KR-normal-normal-normal-*-39-*-*-*-*-0-iso10646-1 (#x2D)

in the initial frame, which I guess just means that I don't have Source
Code Pro.

I then `C-x 5 2', and query the new frame for the font it's using, and
it's the same one.

So I don't seem to be able to reproduce this problem in Emacs 28 -- are
you still seeing it in more recent Emacs versions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#19408: 25.0.50; Incorrect handling of face-font-rescale-alist on startup mangles font settings
  2020-12-03 12:20 ` Lars Ingebrigtsen
@ 2020-12-03 12:53   ` Kirill Ignatiev
  2020-12-03 12:58     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill Ignatiev @ 2020-12-03 12:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 19408

No I don't get that any more, that was six years ago now. Thanks for
looking at it!

On Thu, 3 Dec 2020 at 12:20, Lars Ingebrigtsen <larsi@gnus.org> wrote:
>
> Kirill Ignatiev <kirill.ignatiev@gmail.com> writes:
>
> > 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)
>
> (This bug report unfortunately got no response at the time.)
>
> I'm not sure what font that is, but I tried this in Emacs 28:
>
> # apt install fonts-stix
> emacs -Q -l /tmp/stix.el
>
> > 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.
>
> I get
>
>     ftcrhb:-GOOG-Noto Sans CJK KR-normal-normal-normal-*-39-*-*-*-*-0-iso10646-1 (#x2D)
>
> in the initial frame, which I guess just means that I don't have Source
> Code Pro.
>
> I then `C-x 5 2', and query the new frame for the font it's using, and
> it's the same one.
>
> So I don't seem to be able to reproduce this problem in Emacs 28 -- are
> you still seeing it in more recent Emacs versions?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#19408: 25.0.50; Incorrect handling of face-font-rescale-alist on startup mangles font settings
  2020-12-03 12:53   ` Kirill Ignatiev
@ 2020-12-03 12:58     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-03 12:58 UTC (permalink / raw)
  To: Kirill Ignatiev; +Cc: 19408

Kirill Ignatiev <kirill.ignatiev@gmail.com> writes:

> No I don't get that any more, that was six years ago now. Thanks for
> looking at it!

Thanks for checking; closing the bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-03 12:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-18 20:26 bug#19408: 25.0.50; Incorrect handling of face-font-rescale-alist on startup mangles font settings Kirill Ignatiev
2020-12-03 12:20 ` Lars Ingebrigtsen
2020-12-03 12:53   ` Kirill Ignatiev
2020-12-03 12:58     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).