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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 20 Dec 2016 19:58:18 +0200

> Date: Tue, 20 Dec 2016 17:56:48 +0100
> From: "Dr. Werner Fink" <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> 
> > The only guess I have is that the correction had now enabled the :user-spec
> > key/attribute.  For a workaround I've change some lines of code in
> > lisp/dynamic-setting.el ... compare with the attached patch.
> > 
> > With this patch both the custom font if enabled in ~/.emacs as well as
> > the system font works here for GNU Emacs with GTK as well as with X11.
> 
> Wrong version of the patch, this one seems to be better one ;)

Thanks.  However, this doesn't look like the right fix, because this:

> +  (let ((system-font (and (fboundp 'font-get-system-font)
> +                       (font-get-system-font)))
> +        (frame-list (frames-on-display-list display-or-frame))
> +	(user-font (face-attribute 'default :font)))
> +    (when (and system-font (display-graphic-p display-or-frame))
>        (clear-font-cache)
>        (if set-font
>  	  ;; Set the font on all current and future frames, as though
>  	  ;; the `default' face had been "set for this session":
> -	  (set-frame-font new-font nil frame-list)
> +	  (if (not user-font)
> +	      (set-frame-font system-font nil frame-list)
> +	     (set-frame-font user-font nil frame-list))

effectively disables the system-font feature, because

   (face-attribute 'default :font)

will always return non-nil.

So if my suggestion of rounding the DPI values before comparing them
fixes this for you, it sounds like a better solution to me.