diff options
| author | Stefan Monnier | 2010-10-15 17:55:33 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2010-10-15 17:55:33 -0400 |
| commit | 0c747cb143fa227e78f350ac353d703f489209df (patch) | |
| tree | 5b434055c797bd75eaa1e3d9d0773e586d44daee /src/font.c | |
| parent | a01a7932080e8a6e7bc8472c58cefabcc2c37df3 (diff) | |
| parent | aa095b2db98ae149737f8de00ee733b1d257ed33 (diff) | |
| download | emacs-0c747cb143fa227e78f350ac353d703f489209df.tar.gz emacs-0c747cb143fa227e78f350ac353d703f489209df.zip | |
Merge from trunk
Diffstat (limited to 'src/font.c')
| -rw-r--r-- | src/font.c | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/src/font.c b/src/font.c index dee55d1e976..aee6b483353 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | 21 | ||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | #include <stdio.h> | 23 | #include <stdio.h> |
| 24 | #include <stdlib.h> | ||
| 25 | #include <ctype.h> | 24 | #include <ctype.h> |
| 26 | #include <setjmp.h> | 25 | #include <setjmp.h> |
| 27 | 26 | ||
| @@ -3724,6 +3723,58 @@ font_get_frame_data (FRAME_PTR f, struct font_driver *driver) | |||
| 3724 | } | 3723 | } |
| 3725 | 3724 | ||
| 3726 | 3725 | ||
| 3726 | /* Sets attributes on a font. Any properties that appear in ALIST and | ||
| 3727 | BOOLEAN_PROPERTIES or NON_BOOLEAN_PROPERTIES are set on the font. | ||
| 3728 | BOOLEAN_PROPERTIES and NON_BOOLEAN_PROPERTIES are NULL-terminated | ||
| 3729 | arrays of strings. This function is intended for use by the font | ||
| 3730 | drivers to implement their specific font_filter_properties. */ | ||
| 3731 | void | ||
| 3732 | font_filter_properties (Lisp_Object font, | ||
| 3733 | Lisp_Object alist, | ||
| 3734 | const char *boolean_properties[], | ||
| 3735 | const char *non_boolean_properties[]) | ||
| 3736 | { | ||
| 3737 | Lisp_Object it; | ||
| 3738 | int i; | ||
| 3739 | |||
| 3740 | /* Set boolean values to Qt or Qnil */ | ||
| 3741 | for (i = 0; boolean_properties[i] != NULL; ++i) | ||
| 3742 | for (it = alist; ! NILP (it); it = XCDR (it)) | ||
| 3743 | { | ||
| 3744 | Lisp_Object key = XCAR (XCAR (it)); | ||
| 3745 | Lisp_Object val = XCDR (XCAR (it)); | ||
| 3746 | char *keystr = SDATA (SYMBOL_NAME (key)); | ||
| 3747 | |||
| 3748 | if (strcmp (boolean_properties[i], keystr) == 0) | ||
| 3749 | { | ||
| 3750 | const char *str = INTEGERP (val) ? (XINT (val) ? "true" : "false") | ||
| 3751 | : SYMBOLP (val) ? (const char *) SDATA (SYMBOL_NAME (val)) | ||
| 3752 | : "true"; | ||
| 3753 | |||
| 3754 | if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0 | ||
| 3755 | || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0 | ||
| 3756 | || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0 | ||
| 3757 | || strcmp ("Off", str) == 0) | ||
| 3758 | val = Qnil; | ||
| 3759 | else | ||
| 3760 | val = Qt; | ||
| 3761 | |||
| 3762 | Ffont_put (font, key, val); | ||
| 3763 | } | ||
| 3764 | } | ||
| 3765 | |||
| 3766 | for (i = 0; non_boolean_properties[i] != NULL; ++i) | ||
| 3767 | for (it = alist; ! NILP (it); it = XCDR (it)) | ||
| 3768 | { | ||
| 3769 | Lisp_Object key = XCAR (XCAR (it)); | ||
| 3770 | Lisp_Object val = XCDR (XCAR (it)); | ||
| 3771 | char *keystr = SDATA (SYMBOL_NAME (key)); | ||
| 3772 | if (strcmp (non_boolean_properties[i], keystr) == 0) | ||
| 3773 | Ffont_put (font, key, val); | ||
| 3774 | } | ||
| 3775 | } | ||
| 3776 | |||
| 3777 | |||
| 3727 | /* Return the font used to draw character C by FACE at buffer position | 3778 | /* Return the font used to draw character C by FACE at buffer position |
| 3728 | POS in window W. If STRING is non-nil, it is a string containing C | 3779 | POS in window W. If STRING is non-nil, it is a string containing C |
| 3729 | at index POS. If C is negative, get C from the current buffer or | 3780 | at index POS. If C is negative, get C from the current buffer or |
| @@ -4487,7 +4538,7 @@ DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs, | |||
| 4487 | doc: /* Return a list of variation glyphs for CHAR in FONT-OBJECT. | 4538 | doc: /* Return a list of variation glyphs for CHAR in FONT-OBJECT. |
| 4488 | Each element of the value is a cons (VARIATION-SELECTOR . GLYPH-ID), | 4539 | Each element of the value is a cons (VARIATION-SELECTOR . GLYPH-ID), |
| 4489 | where | 4540 | where |
| 4490 | VARIATION-SELECTOR is a chracter code of variation selection | 4541 | VARIATION-SELECTOR is a character code of variation selection |
| 4491 | (#xFE00..#xFE0F or #xE0100..#xE01EF) | 4542 | (#xFE00..#xFE0F or #xE0100..#xE01EF) |
| 4492 | GLYPH-ID is a glyph code of the corresponding variation glyph. */) | 4543 | GLYPH-ID is a glyph code of the corresponding variation glyph. */) |
| 4493 | (Lisp_Object font_object, Lisp_Object character) | 4544 | (Lisp_Object font_object, Lisp_Object character) |