all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vincent Bernat <bernat@luffy.cx>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 43128@debbugs.gnu.org, mituharu@math.s.chiba-u.ac.jp
Subject: bug#43128: Acknowledgement (27.1; DPI change not detected after switching to Emacs 27.1)
Date: Tue, 25 Oct 2022 23:02:16 +0200	[thread overview]
Message-ID: <a68aaa73-423e-5ff1-c85b-517535aa3ade@luffy.cx> (raw)
In-Reply-To: <87h7gqh5e4.fsf@luffy.cx>

[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

On 2021-07-19 14:09, Vincent Bernat wrote:
>>>>>> As I mentioned in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36284#8,
>>>>>> a proper fix would be to implement replacements for
>>>>>> XftDefaultSubstitute and XftDefaultSet.
>>>>>
>>>>> How complicate will such a change be?  Will it be simple and safe
>>>>> enough to allow installing such a change on the emacs-27 branch?
>>>>
>>>> Ping!  Could we please try solving this for Emacs 27.2?  Mitsuharu,
>>>> could you please show the fix you had in mind back then?
>>>
>>> Hey! Is there any news around this? The XFT backend seems to have some
>>> issues with TTC fonts that the Cairo backend does not.
>>
>> Sadly, no news yet.  Patches or ideas how to fix this are welcome.
> 
> I'll try to do something, but I have no experience with either Xft or
> Cairo, so if that's something clever to do, I am likely to fail.

I was able to build this patch. I did replace XftDefaultSubstitute() by 
something that looks correct. However, for XftDefaultSet(), it seems 
there is no mechanism to override the defaults for fontconfig or cairo, 
so it seems not needed to find a substitute.

[-- Attachment #2: xsettings.diff --]
[-- Type: text/x-patch, Size: 1432 bytes --]

--- source/src/xsettings.c	1970-01-01 01:00:01.000000000 +0100
+++ source.new/src/xsettings.c	2022-10-25 22:50:26.350635015 +0200
@@ -608,16 +608,28 @@
 apply_xft_settings (struct x_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
@@ -716,8 +728,11 @@
 		     - 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	other threads:[~2022-10-25 21:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31  7:31 bug#43128: 27.1; DPI change not detected after switching to Emacs 27.1 Vincent Bernat
     [not found] ` <handler.43128.B.15988596567523.ack@debbugs.gnu.org>
2020-09-02  7:28   ` bug#43128: Acknowledgement (27.1; DPI change not detected after switching to Emacs 27.1) Vincent Bernat
2020-09-02  7:51     ` Vincent Bernat
2020-09-02  7:58     ` YAMAMOTO Mitsuharu
2020-09-02  8:20       ` Vincent Bernat
2020-09-02 14:16         ` Eli Zaretskii
2020-09-02 18:10           ` Vincent Bernat
2020-09-02 14:18       ` Eli Zaretskii
2020-11-23 17:36         ` Eli Zaretskii
2021-07-18 21:38           ` Vincent Bernat
2021-07-19 12:03             ` Eli Zaretskii
2021-07-19 12:09               ` Vincent Bernat
2022-10-25 21:02                 ` Vincent Bernat [this message]
2022-10-27 16:33                   ` Eli Zaretskii
2022-10-27 16:55                     ` Vincent Bernat
2022-10-28  0:38                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-28  7:30                       ` Eli Zaretskii
2022-10-29 12:30 ` bug#43128: Changed the font selection after 52d4c98cec0901ef5cc1c55d5b3b33ac9d9c519f OGAWA Hirofumi

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a68aaa73-423e-5ff1-c85b-517535aa3ade@luffy.cx \
    --to=bernat@luffy.cx \
    --cc=43128@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=mituharu@math.s.chiba-u.ac.jp \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.