Mercurial > emacs
comparison src/font.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 | cda2045a5ee8 |
children | b8fde5ef9e14 0c4c440f303c |
comparison
equal
deleted
inserted
replaced
110988:3c6608402b1e | 110989:36726f009542 |
---|---|
3860 return NULL; | 3860 return NULL; |
3861 return list->data; | 3861 return list->data; |
3862 } | 3862 } |
3863 | 3863 |
3864 | 3864 |
3865 /* Sets attributes on a font. Any properties that appear in ALIST and | |
3866 BOOLEAN_PROPERTIES or NON_BOOLEAN_PROPERTIES are set on the font. | |
3867 BOOLEAN_PROPERTIES and NON_BOOLEAN_PROPERTIES are NULL-terminated | |
3868 arrays of strings. This function is intended for use by the font | |
3869 drivers to implement their specific font_filter_properties. */ | |
3870 void | |
3871 font_filter_properties (font, alist, boolean_properties, non_boolean_properties) | |
3872 Lisp_Object font; | |
3873 Lisp_Object alist; | |
3874 const char *boolean_properties[]; | |
3875 const char *non_boolean_properties[]; | |
3876 { | |
3877 Lisp_Object it; | |
3878 int i; | |
3879 | |
3880 /* Set boolean values to Qt or Qnil */ | |
3881 for (i = 0; boolean_properties[i] != NULL; ++i) | |
3882 for (it = alist; ! NILP (it); it = XCDR (it)) | |
3883 { | |
3884 Lisp_Object key = XCAR (XCAR (it)); | |
3885 Lisp_Object val = XCDR (XCAR (it)); | |
3886 char *keystr = SDATA (SYMBOL_NAME (key)); | |
3887 | |
3888 if (strcmp (boolean_properties[i], keystr) == 0) | |
3889 { | |
3890 const char *str = INTEGERP (val) ? (XINT (val) ? "true" : "false") | |
3891 : SYMBOLP (val) ? (const char *) SDATA (SYMBOL_NAME (val)) | |
3892 : "true"; | |
3893 | |
3894 if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0 | |
3895 || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0 | |
3896 || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0 | |
3897 || strcmp ("Off", str) == 0) | |
3898 val = Qnil; | |
3899 else | |
3900 val = Qt; | |
3901 | |
3902 Ffont_put (font, key, val); | |
3903 } | |
3904 } | |
3905 | |
3906 for (i = 0; non_boolean_properties[i] != NULL; ++i) | |
3907 for (it = alist; ! NILP (it); it = XCDR (it)) | |
3908 { | |
3909 Lisp_Object key = XCAR (XCAR (it)); | |
3910 Lisp_Object val = XCDR (XCAR (it)); | |
3911 char *keystr = SDATA (SYMBOL_NAME (key)); | |
3912 if (strcmp (non_boolean_properties[i], keystr) == 0) | |
3913 Ffont_put (font, key, val); | |
3914 } | |
3915 } | |
3916 | |
3917 | |
3865 /* Return the font used to draw character C by FACE at buffer position | 3918 /* Return the font used to draw character C by FACE at buffer position |
3866 POS in window W. If STRING is non-nil, it is a string containing C | 3919 POS in window W. If STRING is non-nil, it is a string containing C |
3867 at index POS. If C is negative, get C from the current buffer or | 3920 at index POS. If C is negative, get C from the current buffer or |
3868 STRING. */ | 3921 STRING. */ |
3869 | 3922 |