bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#25228: 25.1; GNU emacs 25.1: custom-set-faces from init file ~/.emac


From: Dr. Werner Fink
Subject: bug#25228: 25.1; GNU emacs 25.1: custom-set-faces from init file ~/.emacs ignored
Date: Wed, 21 Dec 2016 09:11:04 +0100
User-agent: Mutt/1.6.2 (2016-07-01)

On Tue, Dec 20, 2016 at 11:59:52AM +0100, martin rudalics wrote:
>  '(default ((t (:inherit nil :stipple nil :background "grey92" :foreground 
> "black" :inverse-video nil :box nil :strike-through nil :overline nil 
> :underline nil :slant normal :weight normal :height 98 :width normal :foundry 
> "unknown" :family "Droid Sans Mono")))))
> 
> The ":height 98" entry in this form before the offending change did set
> the "height of the default face in 1/10 pt" to 98.  After the offending
> change it is set to 113.  I have no idea what a "pt" is (and I have no
> idea what an "inch" is).  But from experience I know that the value of
> `window-font-height' for the root window of the initial frame is 15 for
> a default face height of 98 and 18 for a default face height of 113.


AFAIK pt are points aka 1/72 of 1 inch or in metric units 0.35278 mm
(and AFAIK the ANSI is member of the ISO but this is na other story:)

> 
> As a consequence of the offending change, the frame character height of
> my initial frame is now 18 instead of the desired 15.  In the following
> I will try to explain how this happened here.
> 
> [Werner - if you read this, please try to repeat it, maybe you get a
> completely different behavior.  I gdb one of my current versions of a
> GTK build of master, so the line numbers may be off wrt what you have
> (unfortunately, debugging the release version freezes GNU/Linux
> completely here and I have to turn off the power in order to restart
> it).]
> 
> I first visit the file xsettings.c in the .src directory and start the
> debugger via M-x gdb completing it to
> 
> gdb -i=mi /home/martin/emacs-git/quick/obj-gtk/src/emacs
> 
> which includes the path of my GTK executable.  Next in xsettings.c I
> move to line 611 which reads as
> 
>   memset (&oldsettings, 0, sizeof (oldsettings));
> 
> and set a breakpoint there.  Then I run the executable via
> 
> run -Q --load /home/martin/temp/default-face.el
> 
> and wait till the breakpoint is hit.  In the function where I set the
> breakpoint (apply_xft_settings) I now want to trigger the setting of the
> variable
> 
>       changed = true;
> 
> I do this by stepping via "n" and find that it happens on line 675
> because of oldsettings.dpi != settings->dpi: The old value was
> 96.281588447653434 while the new value is 96.  As a consequence, on line
> 701 a
> 
>       store_config_changed_event (Qfont_render,
>                                 XCAR (dpyinfo->name_list_element));

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

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

Attachment: signature.asc
Description: PGP signature


reply via email to

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