Subject: RE: [External] : bug#56357: Request for font size adaptation that fits window

From: Drew Adams <[email-masked]>
Date: Mon, 4 Jul 2022 15:54:34 +0000

> > Suppose a user uses a 13 pt font size.  Let there be some space
> > between the longest line in the buffer and the edge of the window.
> > It would be super if the font size could be automatically increased,
> > such that the difference between the longest line and the window 
> > size in minimised.
> 
> I think that sounds like a useful feature, and I'm kinda surprised that
> it doesn't exist yet.  Or does it?  Anybody know?
> 
> To implement this, I guess the obvious thing would be to have a global
> minor mode that'd listen to frame size changes, and then adjust the
> font size up/down to reach the desired number of characters in a frame?
> So we'd have a user option font-size-adjust-target (defaulting to 80)
> and a font-size-adjust-mode?

Not sure, but I have a feeling this feature might be
related to what you're thinking about / looking for.
It doesn't sound like it's exactly what this report
has requested.  But it sounds like it's related and
it might even address the underlying need/problem.

My library `face-remap+.el' introduces option
`text-scale-resize-window', which automatically resizes
the selected window (horizontally, vertically, or both)
when text is resized.  This means that when you resize
text the way the window fits the text remains relatively
constant.  Shrinking the text in one window shrinks that
window, giving more space to adjacent windows.

IOW, it keeps whatever relation currently exists between
the apparent text size and the window size.  That also
means that it lets you take advantage of the space freed
up by resizing (text-scaling) to a smaller font.

I offered this feature to Emacs dev _long_ ago (as soon
as text-scaling was added to Emacs).  It was summarily
rejected, with a no-one-would-ever-want-to-do-that
dismissal.  But personally, I wouldn't use text scaling
without such a feature.

I see, and saw, no reason not to give users the choice,
as opposed to hard-coding the behavior so as to always
waste screen real estate with added blank space when
text is shrunk.

The code is trivial - a tweak to `text-scale-increase'
to respect the new user option.  The code is here:

https://www.emacswiki.org/emacs/download/face-remap%2b.el