bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Dmitry Gutov
Subject: bug#52493: 29.0.50; Setting Inconsolata up in init.el makes default face rendered wrong
Date: Wed, 21 Dec 2022 03:08:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

Hi Martin,

Sorry I only got around to doing this now.

This seems to still be a problem in emacs-29, however.

On 17/12/2021 21:17, martin rudalics wrote:
 > 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

Not sure if it's Mutter these days, but it's definitely GNOME Shell. GNOME 43.1 now (I filed this issue with a much older GNOME).

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

I've tried stepping through the function, and the height does shrink when I evaluate the previously mentioned form. Not sure which of the values are useful to you, which ones I should have printed along the way. But see the debug log at the bottom.

All this with 'emacs -Q'. It might be because of a rounding error, but maybe not. The bug happens with most window heights, but not with all. E.g., it stayed stable at (frame-height) = 36. Set it to a larger value - and it goes on shrinking until 36. Set it to a lower value (35 or less), and it does on to shrink until 10 in small steps.

Here's the debugging log. This is just one iteration.

Thread 1 "emacs" hit Breakpoint 3, x_new_font (f=0x55555628e5e0, font_object=XIL(0x555556287395), fontset=28) at xterm.c:26174
26174     FRAME_COLUMN_WIDTH (f) = font->average_width;
(gdb) p font->text_height
There is no member named text_height.
(gdb) p f->text_height
$7 = 1116
(gdb) xint
$8 = 279
(gdb) n
26175     get_font_ascent_descent (font, &font_ascent, &font_descent);
(gdb) n
26176     FRAME_LINE_HEIGHT (f) = font_ascent + font_descent;
(gdb) n
26179 FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f);
(gdb) c
Continuing.

Thread 1 "emacs" hit Breakpoint 3, x_new_font (f=0x55555628e5e0, font_object=XIL(0x5555562d9865), fontset=28) at xterm.c:26174
26174     FRAME_COLUMN_WIDTH (f) = font->average_width;
(gdb) c
Continuing.

Thread 1 "emacs" hit Breakpoint 3, x_new_font (f=0x55555628e5e0, font_object=XIL(0x555556287395), fontset=28) at xterm.c:26174
26174     FRAME_COLUMN_WIDTH (f) = font->average_width;
(gdb) n
26175     get_font_ascent_descent (font, &font_ascent, &font_descent);
(gdb) n
26176     FRAME_LINE_HEIGHT (f) = font_ascent + font_descent;
(gdb) n
26179 FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f);
(gdb) n
26182 FRAME_TAB_BAR_HEIGHT (f) = FRAME_TAB_BAR_LINES (f) * FRAME_LINE_HEIGHT (f);
(gdb) n
26188     unit = FRAME_COLUMN_WIDTH (f);
(gdb) n
26189     if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
(gdb) n
26190       FRAME_CONFIG_SCROLL_BAR_COLS (f)
(gdb) n
26199     if (FRAME_X_WINDOW (f) != 0 && !FRAME_TOOLTIP_P (f))
(gdb) p f->text_height
$9 = 1044
(gdb) xint
$10 = 261
(gdb) n
26200       adjust_frame_size
(gdb) n
26205     if (FRAME_XIC (f)
(gdb) p f->text_height
$11 = 1008
(gdb) xint
$12 = 252
(gdb) c
Continuing.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]