Subject: bug#52493: 29.0.50; Setting Inconsolata up in init.el makes default face rendered wrong

From: Po Lu <[email-masked]>
Date: Sat, 24 Dec 2022 09:03:23 +0800

martin rudalics <[email-masked]> writes:

>> When I evaluate
>>
>>    (set-face-attribute 'default nil :height 110 :family "InconsolataLGC")
>>
>> (this variation of the font doesn't have the original problem), the height of the window shrinks, unless the window is maximized.
>
> When a frame is maximized, no implied resizing is done.  With
>
> (push 'font frame-inhibit-implied-resize)
>
> a non-maximized frame should also keep its size in your case.
>
>> If I evaluate it multiple times, the height shrinks every time I do
>> that
>
> This might be a rounding error or some misunderstanding wrt what the WM
> (mutter in your case?) thinks our frame size is and what Emacs thinks.
> In x_new_font (in xterm.c) we do
>
>   FRAME_COLUMN_WIDTH (f) = font->average_width;
>   ...
>   FRAME_LINE_HEIGHT (f) = font_ascent + font_descent;
>   ...
>       adjust_frame_size
>       (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
>        FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, false, Qfont);
>
> which should have the effect that (frame-height) and (frame-width)
> remain unaltered when changing the default font.  Apparently, this fails
> in your case.
>
>> (stopping at height 5, when even the minibuffer becomes
>> inaccessible
>
> This is a separate issue I fixed here some time ago.  But I don't
> remember whether I pushed it and/or whether it requires additional
> customizations to make it DTRT (it might depend on the ability to drop
> window decorations one by one when a frame is shrunk).
>
>> ).
>
>> If I evaluate
>>
>>    (set-face-attribute 'default nil :height 110 :family "Inconsolata_dz")
>>
>> (with your fix applied), it only shrinks twice (from 33 to 29 to 27, as reported by (window-height)). And then stops shrinking on subsequent attempts.
>>
>> Doing the same with InconsolataLGC on the latter build still makes it shrink indefinitely.
>
> Here as above, stepping with GDB through the x_new_font code sketched
> above might help tracking down this issue.
>
> martin

Would someone explain what the problem is, and what has already been
fixed?  I cannot gather that information from reading the bug report.

Thanks.