diff options
| author | Kenichi Handa | 2010-05-28 15:42:43 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-05-28 15:42:43 +0900 |
| commit | 7d56b2ddfe092d1c25b6faf3f5688bb85fb46549 (patch) | |
| tree | 8461f930d8b27de56c8d2fdcdee7c01e3baa21d5 /src | |
| parent | 478ebb73bb3b80bf2a0a55081f9753639d98fd4a (diff) | |
| download | emacs-7d56b2ddfe092d1c25b6faf3f5688bb85fb46549.tar.gz emacs-7d56b2ddfe092d1c25b6faf3f5688bb85fb46549.zip | |
Handle face-ignored-fonts
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/font.c | 37 |
2 files changed, 42 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d7128960af7..2d8948f6a31 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2010-05-28 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * font.c (font_delete_unmatched): Check Vface_ignored_fonts. | ||
| 4 | Don't sheck SPEC if it is nil. | ||
| 5 | (font_list_entities): Call font_delete_unmatched if | ||
| 6 | Vface_ignored_fonts is non-nil. | ||
| 7 | |||
| 1 | 2010-05-27 Glenn Morris <rgm@gnu.org> | 8 | 2010-05-27 Glenn Morris <rgm@gnu.org> |
| 2 | 9 | ||
| 3 | * Makefile.in, autodeps.mk, deps.mk, ns.mk: | 10 | * Makefile.in, autodeps.mk, deps.mk, ns.mk: |
diff --git a/src/font.c b/src/font.c index 5ee51a6474c..e07dbc5dd16 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -2821,6 +2821,14 @@ font_clear_cache (f, cache, driver) | |||
| 2821 | 2821 | ||
| 2822 | static Lisp_Object scratch_font_spec, scratch_font_prefer; | 2822 | static Lisp_Object scratch_font_spec, scratch_font_prefer; |
| 2823 | 2823 | ||
| 2824 | /* Check each font-entity in VEC, and return a list of font-entities | ||
| 2825 | that satisfy this condition: | ||
| 2826 | (1) matches with SPEC and SIZE if SPEC is not nil, and | ||
| 2827 | (2) doesn't match with any regexps in Vface_ignored_fonts (if non-nil). | ||
| 2828 | */ | ||
| 2829 | |||
| 2830 | extern Lisp_Object Vface_ignored_fonts; | ||
| 2831 | |||
| 2824 | Lisp_Object | 2832 | Lisp_Object |
| 2825 | font_delete_unmatched (vec, spec, size) | 2833 | font_delete_unmatched (vec, spec, size) |
| 2826 | Lisp_Object vec, spec; | 2834 | Lisp_Object vec, spec; |
| @@ -2833,6 +2841,29 @@ font_delete_unmatched (vec, spec, size) | |||
| 2833 | for (val = Qnil, i = ASIZE (vec) - 1; i >= 0; i--) | 2841 | for (val = Qnil, i = ASIZE (vec) - 1; i >= 0; i--) |
| 2834 | { | 2842 | { |
| 2835 | entity = AREF (vec, i); | 2843 | entity = AREF (vec, i); |
| 2844 | if (! NILP (Vface_ignored_fonts)) | ||
| 2845 | { | ||
| 2846 | char name[256]; | ||
| 2847 | Lisp_Object tail, regexp; | ||
| 2848 | |||
| 2849 | if (font_unparse_xlfd (entity, 0, name, 256) >= 0) | ||
| 2850 | { | ||
| 2851 | for (tail = Vface_ignored_fonts; CONSP (tail); tail = XCDR (tail)) | ||
| 2852 | { | ||
| 2853 | regexp = XCAR (tail); | ||
| 2854 | if (STRINGP (regexp) | ||
| 2855 | && fast_c_string_match_ignore_case (regexp, name) >= 0) | ||
| 2856 | break; | ||
| 2857 | } | ||
| 2858 | if (CONSP (tail)) | ||
| 2859 | continue; | ||
| 2860 | } | ||
| 2861 | } | ||
| 2862 | if (NILP (spec)) | ||
| 2863 | { | ||
| 2864 | val = Fcons (entity, val); | ||
| 2865 | continue; | ||
| 2866 | } | ||
| 2836 | for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++) | 2867 | for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++) |
| 2837 | if (INTEGERP (AREF (spec, prop)) | 2868 | if (INTEGERP (AREF (spec, prop)) |
| 2838 | && ((XINT (AREF (spec, prop)) >> 8) | 2869 | && ((XINT (AREF (spec, prop)) >> 8) |
| @@ -2932,8 +2963,10 @@ font_list_entities (frame, spec) | |||
| 2932 | ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); | 2963 | ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); |
| 2933 | XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); | 2964 | XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); |
| 2934 | } | 2965 | } |
| 2935 | if (ASIZE (val) > 0 && need_filtering) | 2966 | if (ASIZE (val) > 0 |
| 2936 | val = font_delete_unmatched (val, spec, size); | 2967 | && (need_filtering |
| 2968 | || ! NILP (Vface_ignored_fonts))) | ||
| 2969 | val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size); | ||
| 2937 | if (ASIZE (val) > 0) | 2970 | if (ASIZE (val) > 0) |
| 2938 | list = Fcons (val, list); | 2971 | list = Fcons (val, list); |
| 2939 | } | 2972 | } |