1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

More fixes to last change

* lisp/dynamic-setting.el (font-setting-change-default-font):
Call `reconsider-frame-fonts'.
* src/frame.c (Freconsider_frame_fonts): New function.
(syms_of_frame): Add new function.
This commit is contained in:
Po Lu 2022-11-15 19:45:28 +08:00
parent 833e60ae1a
commit c6df541783
4 changed files with 37 additions and 12 deletions

View File

@ -51,12 +51,11 @@ the current form for the frame (i.e. hinting or somesuch changed)."
;; Set the font on all current and future frames, as though
;; the `default' face had been "set for this session":
(set-frame-font new-font nil frame-list)
;; Just redraw the existing fonts on all frames, by clearing
;; the font and face caches. This will cause all fonts to be
;; recreated.
(clear-font-cache)
(clear-face-cache t)
(redraw-display)))))
;; Just reconsider the existing fonts on all frames on each
;; display, by clearing the font and face caches. This will
;; cause all fonts to be recreated.
(dolist (frame frame-list)
(reconsider-frame-fonts frame))))))
(defun dynamic-setting-handle-config-changed-event (event)
"Handle config-changed-event on the display in EVENT.

View File

@ -4749,7 +4749,7 @@ gui_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_va
if (FRAME_FONT (f))
{
/* Reconsider default font after backend(s) change (Bug#23386). */
FRAME_RIF(f)->default_font_parameter (f, Qnil);
FRAME_RIF (f)->default_font_parameter (f, Qnil);
face_change = true;
windows_or_buffers_changed = 18;
}
@ -5946,6 +5946,30 @@ This function is for internal use only. */)
return f->was_invisible ? Qt : Qnil;
}
#ifdef HAVE_WINDOW_SYSTEM
DEFUN ("reconsider-frame-fonts", Freconsider_frame_fonts,
Sreconsider_frame_fonts, 1, 1, 0,
doc: /* Recreate FRAME's default font using updated font parameters.
Signal an error if FRAME is not a window system frame. This should be
called after a `config-changed' event is received, signalling that the
parameters (such as pixel density) used by the system to open fonts
have changed. */)
(Lisp_Object frame)
{
struct frame *f;
f = decode_window_system_frame (frame);
if (FRAME_RIF (f)->default_font_parameter)
FRAME_RIF (f)->default_font_parameter (f, Qnil);
return Qnil;
}
#endif
/***********************************************************************
Multimonitor data
@ -6634,6 +6658,6 @@ iconify the top level frame instead. */);
#ifdef HAVE_WINDOW_SYSTEM
defsubr (&Sx_get_resource);
defsubr (&Sx_parse_geometry);
defsubr (&Sreconsider_frame_fonts);
#endif
}

View File

@ -4506,9 +4506,11 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms)
}
if (NILP (font))
font = !NILP (font_param) ? font_param
: gui_display_get_arg (dpyinfo, parms, Qfont, "font", "Font",
RES_TYPE_STRING);
font = (!NILP (font_param)
? font_param
: gui_display_get_arg (dpyinfo, parms,
Qfont, "font", "Font",
RES_TYPE_STRING));
if (! FONTP (font) && ! STRINGP (font))
{

View File

@ -1615,7 +1615,7 @@ extern void x_real_pos_and_offsets (struct frame *f,
int *xptr,
int *yptr,
int *outer_border);
extern void x_default_font_parameter (struct frame* f, Lisp_Object parms);
extern void x_default_font_parameter (struct frame *, Lisp_Object);
/* From xrdb.c. */