Subject: Re: bug#58912: 29.0.50; set-face-attribute call in init.el has no lasting effect

From: Po Lu <[email-masked]>
Date: Wed, 02 Nov 2022 08:54:53 +0800

Juri Linkov <[email-masked]> writes:

> I have the same problem.
>
> GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
>
> $ xrdb -query
> emacs.font:	DejaVu Sans Mono-12
>
> /tmp/test.el:
> (custom-set-faces
>  '(default ((t (:family "DejaVu Sans Mono" :foundry "PfEd" :slant normal :weight normal :height 120 :width normal)))))
>
> emacs -Q -nbc -l /tmp/test.el
> shows incorrect font
>
> font-use-system-font
> => nil
>
> (face-attribute 'default :font (selected-frame) 'default)
> #<font-object "-PfEd-DejaVu Sans Mono-regular-normal-normal-*-13-*-*-*-m-0-ISO10646-1">
>
> but after applying the following patch I get correct fonts:
>
> (face-attribute 'default :font (selected-frame) 'default)
> #<font-object "-PfEd-DejaVu Sans Mono-regular-normal-normal-*-16-*-*-*-m-0-iso10646-1">
>
> diff --git a/src/xsettings.c b/src/xsettings.c
> index 15e7ff54995..403117f8271 100644
> --- a/src/xsettings.c
> +++ b/src/xsettings.c
> @@ -806,9 +806,7 @@ read_settings (Display_Info *dpyinfo, struct xsettings *settings)
>  apply_xft_settings (Display_Info *dpyinfo,
>                      struct xsettings *settings)
>  {
> -#if defined HAVE_XFT					\
> -  || (defined USE_CAIRO && defined CAIRO_HAS_FC_FONT	\
> -      && defined CAIRO_HAS_FT_FONT)
> +#if defined HAVE_XFT
>    FcPattern *pat;
>    struct xsettings oldsettings;
>    bool changed = false;

That is unrelated: previously xsettings font rendering events were not
sent on Cairo builds, but that led to a bug.