changeset 106558:3d091f151696

xftfont.c: Parse symbolic names for constants also. (QClcdfilter): New variable. (xftfont_open): Parse constant names for RGBA, HINT_STYLE and LCDFILTER. (syms_of_xftfont): Initialize QClcdfilter.
author Jan Djärv <jan.h.d@swipnet.se>
date Sun, 13 Dec 2009 13:16:17 +0000
parents e60ede6c3be3
children bac7488df503
files src/ChangeLog src/xftfont.c
diffstat 2 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Dec 13 01:55:09 2009 +0000
+++ b/src/ChangeLog	Sun Dec 13 13:16:17 2009 +0000
@@ -1,3 +1,9 @@
+2009-12-13  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xftfont.c (QClcdfilter): New variable.
+	(xftfont_open): Parse constant names for RGBA, HINT_STYLE and LCDFILTER.
+	(syms_of_xftfont): Initialize QClcdfilter.
+
 2009-12-12  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xsettings.c (struct xsettings): Add member seen.
--- a/src/xftfont.c	Sun Dec 13 01:55:09 2009 +0000
+++ b/src/xftfont.c	Sun Dec 13 13:16:17 2009 +0000
@@ -39,7 +39,8 @@
 /* Xft font driver.  */
 
 static Lisp_Object Qxft;
-static Lisp_Object QChinting , QCautohint, QChintstyle, QCrgba, QCembolden;
+static Lisp_Object QChinting, QCautohint, QChintstyle, QCrgba, QCembolden,
+  QClcdfilter;
 
 /* The actual structure for Xft font that can be casted to struct
    font.  */
@@ -252,7 +253,7 @@
   XftFont *xftfont = NULL;
   int spacing;
   char name[256];
-  int len, i;
+  int len, i, ival;
   XGlyphInfo extents;
   FT_Face ft_face;
   FcMatrix *matrix;
@@ -311,11 +312,25 @@
 	{
 	  if (INTEGERP (val))
 	    FcPatternAddInteger (pat, FC_HINT_STYLE, XINT (val));
+          else if (SYMBOLP (val)
+                   && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
+	    FcPatternAddInteger (pat, FC_HINT_STYLE, ival);
 	}
       else if (EQ (key, QCrgba))
 	{
 	  if (INTEGERP (val))
 	    FcPatternAddInteger (pat, FC_RGBA, XINT (val));
+          else if (SYMBOLP (val)
+                   && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
+	    FcPatternAddInteger (pat, FC_RGBA, ival);
+	}
+      else if (EQ (key, QClcdfilter))
+	{
+	  if (INTEGERP (val))
+	    FcPatternAddInteger (pat, FC_LCD_FILTER, ival = XINT (val));
+          else if (SYMBOLP (val)
+                   && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival))
+	    FcPatternAddInteger (pat, FC_LCD_FILTER, ival);
 	}
 #ifdef FC_EMBOLDEN
       else if (EQ (key, QCembolden))
@@ -343,7 +358,7 @@
   XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat);
   match = XftFontMatch (display, FRAME_X_SCREEN_NUMBER (f), pat, &result);
   xftfont_fix_match (pat, match);
-  
+
   FcPatternDestroy (pat);
   xftfont = XftFontOpenPattern (display, match);
   if (!xftfont)
@@ -706,6 +721,7 @@
   DEFSYM (QChintstyle, ":hintstyle");
   DEFSYM (QCrgba, ":rgba");
   DEFSYM (QCembolden, ":embolden");
+  DEFSYM (QClcdfilter, ":lcdfilter");
 
   xftfont_driver = ftfont_driver;
   xftfont_driver.type = Qxft;