diff src/ftfont.c @ 110989:36726f009542

Fix handling of font properties on Windows (bug#6303). * src/font.c (font_filter_properties): New function, refactored from ftfont_filter_properties. * src/font.h (font_filter_properties): Declare. * src/ftfont.c (ftfont_filter_properties): Use font_filter_properties. * src/w32font.c (w32font_booleans, w32font_non_booleans): New variables. (w32font_filter_properties): New function. (w32font_driver): Add w32font_filter_properties.
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 13 Oct 2010 16:07:28 +0200
parents a18863f338c2
children b8fde5ef9e14 376148b31b5e
line wrap: on
line diff
--- a/src/ftfont.c	Tue Oct 12 20:05:22 2010 -0700
+++ b/src/ftfont.c	Wed Oct 13 16:07:28 2010 +0200
@@ -88,7 +88,7 @@
 					    enum ftfont_cache_for));
 
 static void ftfont_filter_properties P_ ((Lisp_Object font, Lisp_Object alist));
-                                                
+
 Lisp_Object ftfont_font_format P_ ((FcPattern *, Lisp_Object));
 
 #define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM))
@@ -264,7 +264,7 @@
   else
     {
       /* As this font is not scalable, parhaps this is a BDF or PCF
-	 font. */ 
+	 font. */
       FT_Face ft_face;
 
       ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p));
@@ -2113,7 +2113,7 @@
   return to;
 }
 
-static int 
+static int
 ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec,
 		MFLTGlyphString *in, int from, int to)
 {
@@ -2681,42 +2681,7 @@
      Lisp_Object font;
      Lisp_Object alist;
 {
-  Lisp_Object it;
-  int i;
-
-  /* Set boolean values to Qt or Qnil */
-  for (i = 0; ftfont_booleans[i] != NULL; ++i)
-    for (it = alist; ! NILP (it); it = XCDR (it))
-      {
-        Lisp_Object key = XCAR (XCAR (it));
-        Lisp_Object val = XCDR (XCAR (it));
-        char *keystr = SDATA (SYMBOL_NAME (key));
-
-        if (strcmp (ftfont_booleans[i], keystr) == 0)
-          {
-            char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL;
-            if (INTEGERP (val)) str = XINT (val) != 0 ? "true" : "false";
-            if (str == NULL) str = "true";
-
-            val = Qt;
-            if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0
-                || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0
-                || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0
-                || strcmp ("Off", str) == 0)
-              val = Qnil;
-            Ffont_put (font, key, val);
-          }
-      }
-
-  for (i = 0; ftfont_non_booleans[i] != NULL; ++i)
-    for (it = alist; ! NILP (it); it = XCDR (it))
-      {
-        Lisp_Object key = XCAR (XCAR (it));
-        Lisp_Object val = XCDR (XCAR (it));
-        char *keystr = SDATA (SYMBOL_NAME (key));
-        if (strcmp (ftfont_non_booleans[i], keystr) == 0)
-          Ffont_put (font, key, val);
-      }
+  font_filter_properties (font, alist, ftfont_booleans, ftfont_non_booleans);
 }