emacs-diffs
[Top][All Lists]
Advanced

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

master 52d4c98cec: Fix detection of DPI changes in builds without Xft


From: Eli Zaretskii
Subject: master 52d4c98cec: Fix detection of DPI changes in builds without Xft
Date: Fri, 28 Oct 2022 03:29:49 -0400 (EDT)

branch: master
commit 52d4c98cec0901ef5cc1c55d5b3b33ac9d9c519f
Author: Vincent Bernat <bernat@luffy.cx>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix detection of DPI changes in builds without Xft
    
    * src/xsettings.c (apply_xft_settings) [!HAVE_XFT]: Support
    XSETTINGS changes in non-XFT builds.  (Bug#43128)
    
    Copyright-paperwork-exempt: yes
---
 src/xsettings.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/xsettings.c b/src/xsettings.c
index e4a9865d68..14098e21f5 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -804,16 +804,28 @@ static void
 apply_xft_settings (Display_Info *dpyinfo,
                     struct xsettings *settings)
 {
-#ifdef HAVE_XFT
+#if defined USE_CAIRO || defined HAVE_XFT
   FcPattern *pat;
   struct xsettings oldsettings;
   bool changed = false;
+#ifndef HAVE_XFT
+  cairo_font_options_t *options;
+#endif
+
 
   memset (&oldsettings, 0, sizeof (oldsettings));
   pat = FcPatternCreate ();
+#ifdef HAVE_XFT
   XftDefaultSubstitute (dpyinfo->display,
                         XScreenNumberOfScreen (dpyinfo->screen),
                         pat);
+#else
+  FcConfigSubstitute (NULL, pat, FcMatchPattern);
+  options = cairo_font_options_create ();
+  cairo_ft_font_options_substitute (options, pat);
+  cairo_font_options_destroy (options);
+  FcDefaultSubstitute (pat);
+#endif
   FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa);
   FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting);
 #ifdef FC_HINT_STYLE
@@ -912,8 +924,11 @@ apply_xft_settings (Display_Info *dpyinfo,
                     - sizeof "%f")
       };
       char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth];
-
+#ifdef HAVE_XFT
       XftDefaultSet (dpyinfo->display, pat);
+#else
+      FcPatternDestroy (pat);
+#endif
       store_config_changed_event (Qfont_render,
                                  XCAR (dpyinfo->name_list_element));
       Vxft_settings



reply via email to

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