Subject: Re: [emacs-bug] bug#25228: 25.1; GNU emacs 25.1: custom-set-faces from init file ~/.emacs ignored

From: "Dr. Werner Fink" <[email-masked]>
Date: Wed, 21 Dec 2016 09:47:46 +0100

On Wed, Dec 21, 2016 at 09:11:04AM +0100, Werner Fink wrote:
> On Tue, Dec 20, 2016 at 11:59:52AM +0100, martin rudalics wrote:
> 
> Hmmm ... after verifying this I've tried this patch
> ----------------------------------------------------------------------------
> --- src/xsettings.c
> +++ src/xsettings.c	2016-12-21 07:25:17.605036477 +0000
> @@ -45,6 +45,7 @@ along with GNU Emacs.  If not, see <http
>  #endif
>  
>  #ifdef HAVE_XFT
> +#include <math.h>
>  #include <X11/Xft/Xft.h>
>  #endif
>  
> @@ -620,7 +621,11 @@ apply_xft_settings (struct x_display_inf
>  #endif
>    FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &oldsettings.lcdfilter);
>    FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba);
> -  FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi);
> +
> +  if (FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi) == FcResultMatch)
> +    {
> +      oldsettings.dpi = round(oldsettings.dpi);
> +    }
>  
>    if ((settings->seen & SEEN_AA) != 0 && oldsettings.aa != settings->aa)
>      {
> ----------------------------------------------------------------------------
> 
> and indeed there is a change in the behaviour.  Without the custom font setting
> now GNU Emacs window does not a resize anymore at open.  It simply starts with
> the system font without changing its size at open its window.
> 
> Nevertheless, with the custom font setting and without my change in lisp/dynamic-setting.el
> the resize event of the GNU Emacs window is back and still the system font is
> used regardless what font has been customized in ~/.emacs
> 
> > [backtraces]
> > 
> > It's easy to spot `dynamic-setting-handle-config-changed-event' as the
> > source of this.
> 
> Ack

There seems to be also an other place where rounding does not fit. With system
font set, that is no custom font at all the height of the same font are different,
that is 

  (font-face-attributes (font-get-system-font))

results in

  (:family "Monospace" :height 110)

whereas 

  (font-face-attributes (face-attribute 'default :font))

shows

  (:family "Source Code Pro" :height 113 :weight normal :slant normal :width normal)

which is the same font (even over different channels) but different height. I've
verified this by using

  (custom-set-faces '(default ((t (:family "Source Code Pro" :height 110 :weight normal :slant normal :width normal)))))
  (custom-set-faces '(default ((t (:family "Monospace" :height 110)))))

Would interesting how to compare the uperficial ifferent font face attributes
for the same font in (font-setting-change-default-font).

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr