changeset 106908:7d9b2b9edc21

Store settings in xft-settings for debug purposes. (apply_xft_settings): Save settings in Vxft_settings for debug purpose. (syms_of_xsettings): Declare xft-settings.
author Jan D. <jan.h.d@swipnet.se>
date Tue, 19 Jan 2010 15:54:13 +0100
parents 9d769a0fc9cd
children 00e805a10065
files src/ChangeLog src/xsettings.c
diffstat 2 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Jan 19 11:52:59 2010 +0100
+++ b/src/ChangeLog	Tue Jan 19 15:54:13 2010 +0100
@@ -1,3 +1,9 @@
+2010-01-19  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xsettings.c (apply_xft_settings): Save settings in Vxft_settings
+	for debug purpose.
+	(syms_of_xsettings): Declare xft-settings.
+
 2010-01-18  Chong Yidong  <cyd@stupidchicken.com>
 
 	* editfns.c (Fcurrent_time_string): Doc fix (Bug#5408).
--- a/src/xsettings.c	Tue Jan 19 11:52:59 2010 +0100
+++ b/src/xsettings.c	Tue Jan 19 15:54:13 2010 +0100
@@ -42,6 +42,8 @@
 static struct x_display_info *first_dpyinfo;
 static Lisp_Object Qfont_name, Qfont_render;
 static int use_system_font;
+static Lisp_Object Vxft_settings;
+
 
 #ifdef HAVE_GCONF
 static GConfClient *gconf_client;
@@ -406,12 +408,13 @@
   FcPattern *pat;
   struct xsettings settings, oldsettings;
   int changed = 0;
+  char buf[256];
 
   if (!read_xft_settings (dpyinfo, &settings))
     return;
 
   memset (&oldsettings, 0, sizeof (oldsettings));
-
+  buf[0] = '\0';
   pat = FcPatternCreate ();
   XftDefaultSubstitute (dpyinfo->display,
                         XScreenNumberOfScreen (dpyinfo->screen),
@@ -428,20 +431,30 @@
       FcPatternDel (pat, FC_ANTIALIAS);
       FcPatternAddBool (pat, FC_ANTIALIAS, settings.aa);
       ++changed;
+      oldsettings.aa = settings.aa;
     }
+  sprintf (buf, "Antialias: %d", oldsettings.aa);
+
   if ((settings.seen & SEEN_HINTING) != 0
       && oldsettings.hinting != settings.hinting)
     {
       FcPatternDel (pat, FC_HINTING);
       FcPatternAddBool (pat, FC_HINTING, settings.hinting);
       ++changed;
+      oldsettings.hinting = settings.hinting;
     }
+  if (strlen (buf) > 0) strcat (buf, ", ");
+  sprintf (buf+strlen (buf), "Hinting: %d", oldsettings.hinting);
   if ((settings.seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings.rgba)
     {
       FcPatternDel (pat, FC_RGBA);
       FcPatternAddInteger (pat, FC_RGBA, settings.rgba);
+      oldsettings.rgba = settings.rgba;
       ++changed;
     }
+  if (strlen (buf) > 0) strcat (buf, ", ");
+  sprintf (buf+strlen (buf), "RGBA: %d", oldsettings.rgba);
+
   /* Older fontconfig versions don't have FC_LCD_FILTER. */
   if ((settings.seen & SEEN_LCDFILTER) != 0
       && oldsettings.lcdfilter != settings.lcdfilter)
@@ -449,14 +462,22 @@
       FcPatternDel (pat, FC_LCD_FILTER);
       FcPatternAddInteger (pat, FC_LCD_FILTER, settings.lcdfilter);
       ++changed;
+      oldsettings.lcdfilter = settings.lcdfilter;
     }
+  if (strlen (buf) > 0) strcat (buf, ", ");
+  sprintf (buf+strlen (buf), "LCDFilter: %d", oldsettings.lcdfilter);
+
   if ((settings.seen & SEEN_HINTSTYLE) != 0
       && oldsettings.hintstyle != settings.hintstyle)
     {
       FcPatternDel (pat, FC_HINT_STYLE);
       FcPatternAddInteger (pat, FC_HINT_STYLE, settings.hintstyle);
       ++changed;
+      oldsettings.hintstyle = settings.hintstyle;
     }
+  if (strlen (buf) > 0) strcat (buf, ", ");
+  sprintf (buf+strlen (buf), "Hintstyle: %d", oldsettings.hintstyle);
+
   if ((settings.seen & SEEN_DPI) != 0 && oldsettings.dpi != settings.dpi
       && settings.dpi > 0)
     {
@@ -465,7 +486,8 @@
       FcPatternDel (pat, FC_DPI);
       FcPatternAddDouble (pat, FC_DPI, settings.dpi);
       ++changed;
-
+      oldsettings.dpi = settings.dpi;
+      
       /* Change the DPI on this display and all frames on the display.  */
       dpyinfo->resy = dpyinfo->resx = settings.dpi;
       FOR_EACH_FRAME (tail, frame)
@@ -474,12 +496,16 @@
           XFRAME (frame)->resy = XFRAME (frame)->resx = settings.dpi;
     }
 
+  if (strlen (buf) > 0) strcat (buf, ", ");
+  sprintf (buf+strlen (buf), "DPI: %lf", oldsettings.dpi);
+
   if (changed)
     {
       XftDefaultSet (dpyinfo->display, pat);
       if (send_event_p)
         store_font_changed_event (Qfont_render,
                                   XCAR (dpyinfo->name_list_element));
+      Vxft_settings = make_string (buf, strlen (buf));
     }
   else
     FcPatternDestroy (pat);
@@ -638,6 +664,10 @@
     doc: /* *Non-nil means to use the system defined font.  */);
   use_system_font = 0;
 
+  DEFVAR_LISP ("xft-settings", &Vxft_settings,
+               doc: /* Font settings applied to Xft.  */);
+  Vxft_settings = make_string ("", 0);
+
 #ifdef HAVE_XFT
   Fprovide (intern_c_string ("font-render-setting"), Qnil);
 #ifdef HAVE_GCONF