GNU bug report logs - #19972
24.4; Font size change doesn't update (window-total-width)

Previous Next

Package: emacs;

Reported by: Joost Kremers <joostkremers <at> fastmail.fm>

Date: Sun, 1 Mar 2015 02:32:02 UTC

Severity: normal

Found in version 24.4

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


Message #80 received at 19972 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Steve Purcell <steve <at> sanityinc.com>, 19972 <at> debbugs.gnu.org
Subject: Re: bug#19972: Font size change doesn't update (window-total-width)
Date: Mon, 02 Mar 2015 18:10:35 +0100
> - Consider the case of full-screen frames, which never change in pixel
>   size. The window-width should change when the font size changes in
>   this case too.

This is the case (hopefully) with Emacs 25 but not with Emacs 24.5.
Although some window managers may refuse to change the frame size even
with Emacs 24.5 as we've learned here.

> - set-frame-font is a built-in function with a KEEP-SIZE param which
>   tells it to try to preserve the pixel-size of the frame after the
>   font has changed: my code is copied from there.

If you look at the implementation of this you will see that it first
resizes the frame (via x_new_font) and then tries to size it back to the
original size.  This will fail miserably when the frame was maximized
before (because maximization is a state and not just a specific size)
and will fail when the frame size was not an integral multiple of its
default character size (because `set-frame-font' does some strange
rounding).  So never ever use `set-frame-font' with KEEP-SIZE non-nil.
With Emacs 25 you can do, for example,

(let ((frame-inhibit-implied-resize t))
  (custom-push-theme 'theme-face 'default 'user 'set '((t (:height 128))))
  (face-spec-recalc 'default (selected-frame)))

unless you have set `frame-inhibit-implied-resize' to non-nil already.
Which currently causes `window-total-width' to return a wrong value ;-)

> So there really shouldn’t be any assumption that the frame size will
> necessarily change when the font changes.

Emacas <= 24.5 at least _always_ tries to change it.

martin





This bug report was last modified 7 years and 236 days ago.

Previous Next


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