From: martin rudalics <rudalics@gmx.at>
To: Dmitry Gutov <dgutov@yandex.ru>, Eli Zaretskii <eliz@gnu.org>
Cc: rpluim@gmail.com, 52493@debbugs.gnu.org
Subject: bug#52493: 29.0.50; Setting Inconsolata up in init.el makes default face rendered wrong
Date: Wed, 28 Dec 2022 11:08:34 +0100 [thread overview]
Message-ID: <66499633-3283-3cb2-2322-77a357a3c1b7@gmx.at> (raw)
In-Reply-To: <266ad500-da74-13a5-2434-81bd3d5b3554@yandex.ru>
[-- Attachment #1: Type: text/plain, Size: 2064 bytes --]
> Here you go, three attachments.
Thank you, they now contain all we need.
> As you previously guessed, the effect didn't show up when the scaling was off, or when resize-pixelwise was enabled.
In both cases we don't scale. Scaling introduces a rounding effect
mutter apparently doesn't like. Take, for example, these lines of
foo-with-scaling.txt produced when we set a new font (actually the first
line belongs to the previous request and is here only to show that we
start with a frame of 35 lines):
adjust_frame_size .. old pixels/lines .. 1296 .. 36 .. new pixels/lines .. 1584 .. 35
x_new_font .. line_height .. 37 .. lines .. 35 .. new_text_height .. 1295
xg_wm_set_size_hint .. line_height & scale .. 37 .. 2 .. base_height .. 84 .. height_inc .. 18
menubar_height .. 50 .. toolbar_height .. 82
xg_frame_set_char_size .. old .. 1584 .. arg .. 1295 .. new .. -1
outer .. 713 .. gheight .. 858
xg_frame_resized .. old .. 1584 .. req .. -1 .. con/text .. 1260 .. 1260
adjust_frame_size .. old pixels/lines .. 1584 .. 35 .. new pixels/lines .. 1260 .. 34
The base_height value (84 pixels) we calculate here is the sum of the
line_height value, the menubar_height value and the toolbar_height
values divided by the scale factor:
(/ (+ 37 50 82) 2)
height_inc (18) is the line height divided by the scale factor (/ 37 2).
These size hints have mutter expect us to resize our frame to something
like
(+ base_height (* height_inc N))
for some positive integer N. Now we want to resize the frame to
line_height times lines, that is (* 37 35) yielding 1295 pixels.
But (% (/ 1295 2) 18) is not zero and so mutter declines our request
giving us 1260 pixels text height instead. Apparently, mutter starts
with (/ 1295 2) that is 647, 630 is the next multiple of 18 it finds, so
(* 630 2) is the value it concedes us.
So the height we should ask for with scaling is 1296 instead of 1295.
Please try the attached patch - I can't test it here because I don't
scale. If it doesn't work, please post the contents of *foo* as usual.
Thanks, martin
[-- Attachment #2: x_scale_font.diff --]
[-- Type: text/x-patch, Size: 6009 bytes --]
diff --git a/lisp/window.el b/lisp/window.el
index a11293d372..3d064e12d7 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -10596,6 +10596,17 @@ window-prefix-map
"0" #'delete-windows-on)
(define-key ctl-x-map "w" window-prefix-map)
+(defun foo-it (&rest rest)
+ (with-current-buffer (get-buffer-create "*foo*")
+ (goto-char (point-max))
+ (when rest
+ (insert (format "%s" (car rest)))
+ (setq rest (cdr rest))
+ (while rest
+ (insert (format " .. %s" (car rest)))
+ (setq rest (cdr rest)))
+ (insert "\n"))))
+
(provide 'window)
;;; window.el ends here
diff --git a/src/frame.c b/src/frame.c
index b57b296be5..4501c8dc14 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -906,6 +906,14 @@ adjust_frame_size (struct frame *f, int new_text_width, int new_text_height,
unblock_input ();
+ if (old_native_height != new_native_height
+ || old_text_lines != new_text_lines)
+ call7 (Qfoo_it, intern ("adjust_frame_size"),
+ intern ("old pixels/lines"), make_fixnum (old_native_height),
+ make_fixnum (old_text_lines),
+ intern ("new pixels/lines"), make_fixnum (new_native_height),
+ make_fixnum (new_text_lines));
+
#ifdef HAVE_WINDOW_SYSTEM
{
/* Adjust size of F's child frames. */
diff --git a/src/gtkutil.c b/src/gtkutil.c
index a6bba096a4..681cbcd52c 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1149,6 +1149,13 @@ xg_frame_resized (struct frame *f, int width, int height)
f->new_size_p ? f->new_height : -1);
FRAME_RIF (f)->clear_under_internal_border (f);
+
+ call8 (Qfoo_it, intern ("xg_frame_resized"),
+ intern ("old"), make_fixnum (FRAME_PIXEL_HEIGHT (f)),
+ intern ("req"), make_fixnum (f->new_height),
+ intern ("con/text"), make_fixnum (height),
+ make_fixnum (FRAME_PIXEL_TO_TEXT_HEIGHT (f, height)));
+
change_frame_size (f, width, height, false, true, false);
SET_FRAME_GARBAGED (f);
cancel_mouse_face (f);
@@ -1174,6 +1181,23 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
int outer_width = width + FRAME_TOOLBAR_WIDTH (f);
bool was_visible = false;
bool hide_child_frame;
+ int scale = xg_get_scale (f);
+
+ if (scale != 1 && !frame_resize_pixelwise)
+ {
+ if (FRAME_COLUMN_WIDTH (f) % 2 != 0)
+ {
+ width = FRAME_COLS (f) * (FRAME_COLUMN_WIDTH (f) + 1);
+ outer_width = width + FRAME_TOOLBAR_WIDTH (f);
+ }
+
+ if (FRAME_LINE_HEIGHT (f) % 2 != 0)
+ {
+ height = FRAME_LINES (f) * (FRAME_LINE_HEIGHT (f) + 1);
+ outer_height
+ = height + FRAME_TOOLBAR_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f);
+ }
+ }
#ifndef HAVE_PGTK
gtk_window_get_size (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
@@ -1196,8 +1220,8 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
/* Do this before resize, as we don't know yet if we will be resized. */
FRAME_RIF (f)->clear_under_internal_border (f);
- outer_height /= xg_get_scale (f);
- outer_width /= xg_get_scale (f);
+ outer_height /= scale;
+ outer_width /= scale;
xg_wm_set_size_hint (f, 0, 0);
@@ -1317,6 +1341,14 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
SET_FRAME_GARBAGED (f);
cancel_mouse_face (f);
+ call7 (Qfoo_it, intern ("xg_frame_set_char_size"),
+ intern ("old"), make_fixnum (FRAME_PIXEL_HEIGHT (f)),
+ intern ("arg"), make_fixnum (height),
+ intern ("new"), make_fixnum (f->new_height));
+ call4 (Qfoo_it,
+ intern (" outer"), make_fixnum (outer_height),
+ intern ("gheight"), make_fixnum (gheight));
+
/* We can not call change_frame_size for a mapped frame,
we can not set pixel width/height either. The window manager may
override our resize request, XMonad does this all the time.
@@ -2028,6 +2060,13 @@ xg_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
&f->output_data.xp->size_hints,
sizeof (size_hints)) != 0)
{
+ call8 (Qfoo_it, intern ("xg_wm_set_size_hint"),
+ intern ("line_height & scale"),
+ make_fixnum (FRAME_LINE_HEIGHT (f)), make_fixnum (scale),
+ intern ("base_height"), make_fixnum (size_hints.base_height),
+ intern ("height_inc"), make_fixnum (size_hints.height_inc));
+ call4 (Qfoo_it, intern (" menubar_height"), make_fixnum (FRAME_MENUBAR_HEIGHT (f)),
+ intern ("toolbar_height"), make_fixnum (FRAME_TOOLBAR_HEIGHT (f)));
block_input ();
gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
NULL, &size_hints, hint_flags);
diff --git a/src/window.c b/src/window.c
index f116b9a9d7..c090f29461 100644
--- a/src/window.c
+++ b/src/window.c
@@ -8394,6 +8394,7 @@ syms_of_window (void)
DEFSYM (Qheader_line_format, "header-line-format");
DEFSYM (Qtab_line_format, "tab-line-format");
DEFSYM (Qno_other_window, "no-other-window");
+ DEFSYM (Qfoo_it, "foo-it");
DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function,
doc: /* Non-nil means call as function to display a help buffer.
diff --git a/src/xterm.c b/src/xterm.c
index 7eaf59d54b..277b53043a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -26197,9 +26197,17 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
because it's done in Fx_show_tip, and it leads to problems because
the tip frame has no widget. */
if (FRAME_X_WINDOW (f) != 0 && !FRAME_TOOLTIP_P (f))
- adjust_frame_size
- (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
- FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, false, Qfont);
+ {
+ call7 (Qfoo_it, intern ("x_new_font"),
+ intern ("line_height"), make_fixnum (FRAME_LINE_HEIGHT (f)),
+ intern ("lines"), make_fixnum (FRAME_LINES (f)),
+ intern ("new_text_height"),
+ make_fixnum (FRAME_LINES (f) * FRAME_LINE_HEIGHT (f)));
+
+ adjust_frame_size
+ (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
+ FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, false, Qfont);
+ }
#ifdef HAVE_X_I18N
if (FRAME_XIC (f)
next prev parent reply other threads:[~2022-12-28 10:08 UTC|newest]
Thread overview: 169+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 23:43 bug#52493: 29.0.50; Setting Inconsolata up in init.el makes default face rendered wrong Dmitry Gutov
2021-12-15 14:57 ` Eli Zaretskii
2021-12-15 22:43 ` Dmitry Gutov
2021-12-16 7:29 ` Eli Zaretskii
2021-12-16 13:01 ` Dmitry Gutov
2021-12-16 13:31 ` Eli Zaretskii
2021-12-16 13:42 ` Dmitry Gutov
2021-12-16 14:08 ` Eli Zaretskii
2021-12-16 14:57 ` Dmitry Gutov
2021-12-16 15:15 ` Eli Zaretskii
2021-12-16 15:34 ` Eli Zaretskii
2021-12-16 15:42 ` Dmitry Gutov
2021-12-16 16:56 ` Eli Zaretskii
2021-12-17 0:49 ` Dmitry Gutov
2021-12-17 7:37 ` Eli Zaretskii
2021-12-17 7:46 ` Lars Ingebrigtsen
2021-12-17 8:38 ` Eli Zaretskii
2022-12-21 1:14 ` Dmitry Gutov
2022-12-21 9:38 ` Gregory Heytings
2022-12-21 12:49 ` Eli Zaretskii
2022-12-21 23:39 ` Gregory Heytings
2022-12-22 7:18 ` Eli Zaretskii
2022-12-25 22:42 ` Gregory Heytings
2022-12-21 13:40 ` Dmitry Gutov
2022-12-21 23:39 ` Gregory Heytings
2022-12-22 7:20 ` Eli Zaretskii
2022-12-25 22:42 ` Gregory Heytings
2022-12-26 12:20 ` Eli Zaretskii
2022-12-26 14:05 ` Gregory Heytings
2022-12-22 20:32 ` Dmitry Gutov
2022-12-25 22:42 ` Gregory Heytings
2022-12-26 0:46 ` Gregory Heytings
2022-12-26 12:25 ` Eli Zaretskii
2022-12-29 22:45 ` Gregory Heytings
2022-12-30 14:47 ` Eli Zaretskii
2022-12-30 15:40 ` Gregory Heytings
2022-12-30 16:14 ` Eli Zaretskii
2022-12-30 16:27 ` Gregory Heytings
2022-12-30 17:01 ` Eli Zaretskii
2022-12-30 17:28 ` Gregory Heytings
2022-12-26 15:48 ` Dmitry Gutov
2022-12-26 16:19 ` Gregory Heytings
2022-12-27 2:04 ` Dmitry Gutov
2022-12-28 15:20 ` Gregory Heytings
2022-12-28 17:01 ` Eli Zaretskii
2022-12-27 1:58 ` Dmitry Gutov
2022-12-28 15:19 ` Gregory Heytings
2022-12-21 12:11 ` Eli Zaretskii
2021-12-17 12:30 ` Dmitry Gutov
2021-12-17 13:01 ` Eli Zaretskii
2021-12-17 13:21 ` Dmitry Gutov
2021-12-17 13:46 ` Eli Zaretskii
2021-12-17 14:06 ` Dmitry Gutov
2021-12-17 14:42 ` Eli Zaretskii
2021-12-17 19:17 ` martin rudalics
2022-12-21 1:08 ` Dmitry Gutov
2022-12-21 9:22 ` martin rudalics
2022-12-21 12:56 ` Dmitry Gutov
2022-12-21 17:05 ` martin rudalics
2022-12-21 23:00 ` Dmitry Gutov
2022-12-22 10:15 ` martin rudalics
2022-12-22 20:39 ` Dmitry Gutov
2022-12-23 9:14 ` martin rudalics
2022-12-23 9:19 ` martin rudalics
2022-12-23 18:48 ` Dmitry Gutov
2022-12-24 9:27 ` martin rudalics
2022-12-24 13:38 ` Dmitry Gutov
2022-12-25 10:21 ` martin rudalics
2022-12-25 13:01 ` Dmitry Gutov
2022-12-25 16:07 ` martin rudalics
2022-12-25 16:52 ` Dmitry Gutov
2022-12-26 9:10 ` martin rudalics
2022-12-27 23:15 ` Dmitry Gutov
2022-12-28 10:08 ` martin rudalics [this message]
2022-12-28 12:31 ` Dmitry Gutov
2022-12-28 17:35 ` martin rudalics
2022-12-28 22:35 ` Dmitry Gutov
2022-12-29 9:05 ` martin rudalics
2022-12-29 22:29 ` Dmitry Gutov
2022-12-30 9:51 ` martin rudalics
2022-12-31 19:01 ` martin rudalics
2023-01-05 1:50 ` Dmitry Gutov
2023-01-05 9:47 ` martin rudalics
2023-01-05 14:14 ` Dmitry Gutov
2023-01-05 16:59 ` martin rudalics
2023-01-05 19:08 ` Dmitry Gutov
2023-01-06 17:47 ` martin rudalics
2023-01-06 18:14 ` Dmitry Gutov
2023-01-06 22:40 ` Gregory Heytings
2023-01-06 23:45 ` Dmitry Gutov
2023-01-06 23:49 ` Gregory Heytings
2023-01-07 0:48 ` Dmitry Gutov
2023-01-07 0:50 ` Gregory Heytings
2023-01-07 9:48 ` martin rudalics
2023-01-08 9:45 ` martin rudalics
2023-01-08 22:38 ` Gregory Heytings
2023-01-08 23:23 ` Gregory Heytings
2023-01-09 10:09 ` martin rudalics
2023-01-09 17:28 ` Eric Abrahamsen
2023-01-07 9:15 ` martin rudalics
2023-01-09 0:12 ` Dmitry Gutov
2023-01-09 10:07 ` martin rudalics
2023-01-09 20:50 ` Dmitry Gutov
2023-01-10 12:05 ` martin rudalics
2023-01-12 0:34 ` Dmitry Gutov
2023-01-12 9:31 ` martin rudalics
2023-01-12 9:46 ` Robert Pluim
2023-01-12 10:23 ` martin rudalics
2023-01-12 23:53 ` Dmitry Gutov
2023-01-13 0:36 ` Dmitry Gutov
2023-01-13 8:38 ` martin rudalics
2023-01-16 1:27 ` bug#60585: 30.0.50; global-text-scale-adjust shrinks window (was not before), was: " Dmitry Gutov
2023-01-16 10:03 ` martin rudalics
2023-01-16 12:44 ` Dmitry Gutov
2023-01-16 16:10 ` martin rudalics
2023-01-17 1:54 ` Dmitry Gutov
2023-01-17 10:04 ` martin rudalics
2023-01-17 17:35 ` Dmitry Gutov
2023-01-18 17:13 ` martin rudalics
2023-01-21 3:12 ` Dmitry Gutov
2023-01-21 10:08 ` martin rudalics
2023-01-22 1:56 ` Dmitry Gutov
2023-01-22 9:54 ` martin rudalics
2023-01-22 22:25 ` Dmitry Gutov
2023-01-24 10:50 ` martin rudalics
2023-01-25 4:20 ` Dmitry Gutov
2023-01-26 15:44 ` martin rudalics
2023-01-27 3:07 ` Dmitry Gutov
2023-01-27 9:35 ` martin rudalics
2023-01-28 0:22 ` Dmitry Gutov
2023-01-28 15:36 ` martin rudalics
2023-01-29 1:25 ` Dmitry Gutov
2023-01-30 9:28 ` martin rudalics
2023-02-09 19:40 ` Dmitry Gutov
2023-02-11 1:36 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-11 8:17 ` Eli Zaretskii
2023-02-11 9:30 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-11 10:39 ` Eli Zaretskii
2023-02-11 10:15 ` Dmitry Gutov
2023-02-11 10:22 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-11 22:08 ` Dmitry Gutov
2023-02-12 1:45 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-12 2:06 ` Dmitry Gutov
2023-02-12 3:26 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-12 12:41 ` Dmitry Gutov
2023-02-13 2:56 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-16 2:09 ` Dmitry Gutov
2023-02-16 3:00 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-16 22:18 ` Dmitry Gutov
2023-02-17 2:43 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-17 11:54 ` Dmitry Gutov
2023-02-12 12:55 ` Dmitry Gutov
2023-02-13 10:09 ` martin rudalics
2023-02-17 2:05 ` Dmitry Gutov
2023-02-20 9:05 ` martin rudalics
2023-02-22 1:42 ` Dmitry Gutov
2023-02-24 17:54 ` martin rudalics
2023-02-27 1:29 ` Dmitry Gutov
2022-12-21 13:43 ` Dmitry Gutov
2022-12-24 1:03 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-24 8:52 ` martin rudalics
2022-12-24 9:39 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-24 10:45 ` martin rudalics
2022-12-24 11:24 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-24 13:02 ` Dmitry Gutov
2022-12-25 22:52 ` Gregory Heytings
2021-12-16 15:36 ` Dmitry Gutov
2021-12-16 16:54 ` Eli Zaretskii
2021-12-17 0:13 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=66499633-3283-3cb2-2322-77a357a3c1b7@gmx.at \
--to=rudalics@gmx.at \
--cc=52493@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=eliz@gnu.org \
--cc=rpluim@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).