changeset 106092:6804c4648fee

* xftfont.c (xftfont_fix_match): Older versions of fontconfig does not have FC_LCD_*. #define them if not there.
author Jan Djärv <jan.h.d@swipnet.se>
date Tue, 17 Nov 2009 13:47:29 +0000
parents 0e0a17aff6ec
children 723842a98273
files src/ChangeLog src/xftfont.c src/xsettings.c
diffstat 3 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Nov 17 10:38:44 2009 +0000
+++ b/src/ChangeLog	Tue Nov 17 13:47:29 2009 +0000
@@ -1,7 +1,7 @@
 2009-11-17  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
-	not have FC_LCD_FILTER.  #ifdef it.
+	not have FC_LCD_*.  #define them if not there.
 
 	* xsettings.c (parse_xft_settings, apply_xft_settings): Ditto
 
--- a/src/xftfont.c	Tue Nov 17 10:38:44 2009 +0000
+++ b/src/xftfont.c	Tue Nov 17 13:47:29 2009 +0000
@@ -214,14 +214,15 @@
       FcPatternDel (match, FC_HINT_STYLE);
       FcPatternAddInteger (match, FC_HINT_STYLE, i);
     }
-#ifdef FC_LCD_FILTER
+#ifndef FC_LCD_FILTER
   /* Older fontconfig versions don't have FC_LCD_FILTER. */
+#define FC_LCD_FILTER "lcdfilter"
+#endif
   if (FcResultMatch == FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &i))
     {
       FcPatternDel (match, FC_LCD_FILTER);
       FcPatternAddInteger (match, FC_LCD_FILTER, i);
     }
-#endif
   if (FcResultMatch == FcPatternGetInteger (pat, FC_RGBA, 0, &i))
     {
       FcPatternDel (match, FC_RGBA);
--- a/src/xsettings.c	Tue Nov 17 10:38:44 2009 +0000
+++ b/src/xsettings.c	Tue Nov 17 13:47:29 2009 +0000
@@ -105,6 +105,17 @@
 
 #ifdef HAVE_XFT
 
+/* Older fontconfig versions don't have FC_LCD_*.  */
+#ifndef FC_LCD_NONE
+#define FC_LCD_NONE 0
+#endif
+#ifndef FC_LCD_DEFAULT
+#define FC_LCD_DEFAULT 1
+#endif
+#ifndef FC_LCD_FILTER
+#define FC_LCD_FILTER "lcdfilter"
+#endif
+
 /* Find the window that contains the XSETTINGS property values.  */
 
 static void
@@ -310,8 +321,6 @@
             }
           else if (strcmp (name, "Xft/DPI") == 0)
             settings->dpi = (double)ival/1024.0;
-#ifdef FC_LCD_FILTER
-          /* Older fontconfig versions don't have FC_LCD_FILTER. */
           else if (strcmp (name, "Xft/lcdfilter") == 0)
             {
               if (strcmp (sval, "none") == 0)
@@ -319,7 +328,6 @@
               else if (strcmp (sval, "lcddefault") == 0)
                 settings->lcdfilter = FC_LCD_DEFAULT;
             }
-#endif
         }
     }
 
@@ -379,10 +387,7 @@
   FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa);
   FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting);
   FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &oldsettings.hintstyle);
-#ifdef FC_LCD_FILTER
-  /* Older fontconfig versions don't have FC_LCD_FILTER. */
   FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &oldsettings.lcdfilter);
-#endif
   FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba);
   FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi);
 
@@ -404,7 +409,6 @@
       FcPatternAddInteger (pat, FC_RGBA, settings.rgba);
       ++changed;
     }
-#ifdef FC_LCD_FILTER
   /* Older fontconfig versions don't have FC_LCD_FILTER. */
   if (oldsettings.lcdfilter != settings.lcdfilter)
     {
@@ -412,7 +416,6 @@
       FcPatternAddInteger (pat, FC_LCD_FILTER, settings.lcdfilter);
       ++changed;
     }
-#endif
   if (oldsettings.hintstyle != settings.hintstyle)
     {
       FcPatternDel (pat, FC_HINT_STYLE);