Subject: bug#19972: Font size change doesn't update (window-total-width)

From: Steve Purcell <[email-masked]>
Date: Mon, 2 Mar 2015 17:23:58 +0000

On 2 Mar 2015, at 17:10, martin rudalics <[email-masked]> wrote:
> 
> > - 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.

It’s not the case on OS X with Emacs HEAD from 19th Feb, at least.

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

Interesting: I hadn’t seen that. The above snippet still results in a changed frame size on my system, though.