From b18d4dbe0d64bd1277731f9a7faedbb4dd3cd197 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 19 Nov 2022 13:59:53 +0800 Subject: Fix automatic DPI adjustment and add workarounds for some systems * lisp/faces.el (x-create-frame-with-faces): New field `delayed-font'. Set the `font-parameter' property to `font' in the given parameter list after face-set-after-frame-default is called. * src/fontset.c (Fset_fontset_font): Avoid changing `font-parameter' with the call to Fmodify_frame_parameters. * src/frame.c (gui_set_frame_parameters_1): New function. Factor out gui_set_frame_parameters here, and add an argument DEFAULT_PARAMETER. If the `font' parameter is set, and `default_parameter' is not, then set the `font-parameter' frame parameter to the `font' parameter as well, to keep track of which user-specified `font' frame parameter set the default face's font on the frame. (gui_set_frame_parameters): Call gui_set_frame_parameters_1 with new arg set to false. (gui_set_font): Remove broken implementation of `font-parameter'. (gui_default_parameter): If the default value was used, then call gui_set_frame_parameters_1 with the new argument set to false. This is because no font was specified as a frame parameter by the user, so Freconsider_frame_fonts is free to do anything it wants. (Freconsider_frame_fonts): If `font-parameter' is set, then use it. (syms_of_frame): New defsym Qfont_parameter. * src/frame.h: Update prototypes. * src/haikuterm.c (haiku_default_font_parameter): * src/pgtkfns.c (pgtk_default_font_parameter): * src/w32fns.c (w32_default_font_parameter): Stop setting `font-parameter' here. This code resulted in decades of automatic font rescaling not working correctly. * src/xfaces.c (set_font_frame_param): Clear the `font-parameter' frame parameter. (Finternal_merge_in_global_face): * src/xfns.c (x_default_font_parameter): Avoid changing `font-parameter' in response to changes to face attributes. * src/xsettings.c (apply_xft_settings): Add workaround for Cairo. (bug#59371, bug#59347, bug#59283, bug#59271, bug#59285, bug#59306.) --- src/pgtkfns.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/pgtkfns.c') diff --git a/src/pgtkfns.c b/src/pgtkfns.c index f370f039780..a32067af818 100644 --- a/src/pgtkfns.c +++ b/src/pgtkfns.c @@ -1121,13 +1121,6 @@ pgtk_default_font_parameter (struct frame *f, Lisp_Object parms) if (NILP (font)) error ("No suitable font was found"); } - else if (!NILP (font_param)) - { - /* Remember the explicit font parameter, so we can re-apply it after - we've applied the `default' face settings. */ - AUTO_FRAME_ARG (arg, Qfont_parameter, font_param); - gui_set_frame_parameters (f, arg); - } /* This call will make X resources override any system font setting. */ gui_default_parameter (f, parms, Qfont, font, "font", "Font", -- cgit v1.2.1