diff options
| author | Miles Bader | 2000-08-26 05:36:17 +0000 |
|---|---|---|
| committer | Miles Bader | 2000-08-26 05:36:17 +0000 |
| commit | 2c20458f58d2844dd412e8406d9b1ae401280b93 (patch) | |
| tree | b5526002bcdc06058d36ebd7d3b599362f1e3c58 /src | |
| parent | cd68bbe836ee78e7fa12a798d2086c125edb530e (diff) | |
| download | emacs-2c20458f58d2844dd412e8406d9b1ae401280b93.tar.gz emacs-2c20458f58d2844dd412e8406d9b1ae401280b93.zip | |
(QCinherit):
New variable.
(syms_of_xfaces):
Initialize it.
(LFACE_INHERIT):
New macro.
(Finternal_get_lisp_face_attribute, merge_face_vector_with_property)
(Finternal_set_lisp_face_attribute):
Deal with :inherit attribute.
(check_lface_attrs):
Allow new types of face height. Check inherit attribute.
(CYCLE_CHECK):
New macro.
(merge_face_inheritance):
New function.
(merge_face_vectors):
Merge inherited faces too. Add F and CYCLE_CHECK arguments.
(merge_face_vector_with_property, Finternal_merge_in_global_face)
(lookup_named_face, lookup_derived_face, realize_named_face)
(face_at_string_position, face_at_buffer_position):
Supply new F and CYCLE_CHECK arguments to merge_face_vectors.
(merge_face_heights):
New function.
(merge_face_vectors, merge_face_vector_with_property)
(Finternal_set_lisp_face_attribute):
Call merge_face_heights to handle relative face heights.
(lface_same_font_attributes_p):
Compare heights using EQ.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 256 |
1 files changed, 233 insertions, 23 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index 76e546bd00c..1f7ab1c0ac0 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -65,6 +65,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 65 | font determined by the other attributes (those may be inherited | 65 | font determined by the other attributes (those may be inherited |
| 66 | from the `default' face). | 66 | from the `default' face). |
| 67 | 67 | ||
| 68 | 15. A face name or list of face names from which to inherit attributes. | ||
| 69 | |||
| 68 | Faces are frame-local by nature because Emacs allows to define the | 70 | Faces are frame-local by nature because Emacs allows to define the |
| 69 | same named face (face names are symbols) differently for different | 71 | same named face (face names are symbols) differently for different |
| 70 | frames. Each frame has an alist of face definitions for all named | 72 | frames. Each frame has an alist of face definitions for all named |
| @@ -303,7 +305,7 @@ Lisp_Object QCfamily, QCheight, QCweight, QCslant, QCunderline; | |||
| 303 | Lisp_Object QCinverse_video, QCforeground, QCbackground, QCstipple; | 305 | Lisp_Object QCinverse_video, QCforeground, QCbackground, QCstipple; |
| 304 | Lisp_Object QCwidth, QCfont, QCbold, QCitalic; | 306 | Lisp_Object QCwidth, QCfont, QCbold, QCitalic; |
| 305 | Lisp_Object QCreverse_video; | 307 | Lisp_Object QCreverse_video; |
| 306 | Lisp_Object QCoverline, QCstrike_through, QCbox; | 308 | Lisp_Object QCoverline, QCstrike_through, QCbox, QCinherit; |
| 307 | 309 | ||
| 308 | /* Symbols used for attribute values. */ | 310 | /* Symbols used for attribute values. */ |
| 309 | 311 | ||
| @@ -502,7 +504,9 @@ static int face_numeric_slant P_ ((Lisp_Object)); | |||
| 502 | static int face_numeric_swidth P_ ((Lisp_Object)); | 504 | static int face_numeric_swidth P_ ((Lisp_Object)); |
| 503 | static int face_fontset P_ ((Lisp_Object *)); | 505 | static int face_fontset P_ ((Lisp_Object *)); |
| 504 | static char *choose_face_font P_ ((struct frame *, Lisp_Object *, int, int)); | 506 | static char *choose_face_font P_ ((struct frame *, Lisp_Object *, int, int)); |
| 505 | static void merge_face_vectors P_ ((Lisp_Object *from, Lisp_Object *)); | 507 | static void merge_face_vectors P_ ((struct frame *, Lisp_Object *, Lisp_Object*, Lisp_Object)); |
| 508 | static void merge_face_inheritance P_ ((struct frame *f, Lisp_Object, | ||
| 509 | Lisp_Object *, Lisp_Object)); | ||
| 506 | static void merge_face_vector_with_property P_ ((struct frame *, Lisp_Object *, | 510 | static void merge_face_vector_with_property P_ ((struct frame *, Lisp_Object *, |
| 507 | Lisp_Object)); | 511 | Lisp_Object)); |
| 508 | static int set_lface_from_font_name P_ ((struct frame *, Lisp_Object, | 512 | static int set_lface_from_font_name P_ ((struct frame *, Lisp_Object, |
| @@ -2760,6 +2764,8 @@ the WIDTH times as wide as FACE on FRAME.") | |||
| 2760 | XVECTOR (LFACE)->contents[LFACE_BOX_INDEX] | 2764 | XVECTOR (LFACE)->contents[LFACE_BOX_INDEX] |
| 2761 | #define LFACE_FONT(LFACE) \ | 2765 | #define LFACE_FONT(LFACE) \ |
| 2762 | XVECTOR (LFACE)->contents[LFACE_FONT_INDEX] | 2766 | XVECTOR (LFACE)->contents[LFACE_FONT_INDEX] |
| 2767 | #define LFACE_INHERIT(LFACE) \ | ||
| 2768 | XVECTOR (LFACE)->contents[LFACE_INHERIT_INDEX] | ||
| 2763 | 2769 | ||
| 2764 | /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size | 2770 | /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size |
| 2765 | LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ | 2771 | LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ |
| @@ -2783,7 +2789,9 @@ check_lface_attrs (attrs) | |||
| 2783 | xassert (UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) | 2789 | xassert (UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) |
| 2784 | || SYMBOLP (attrs[LFACE_SWIDTH_INDEX])); | 2790 | || SYMBOLP (attrs[LFACE_SWIDTH_INDEX])); |
| 2785 | xassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX]) | 2791 | xassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX]) |
| 2786 | || INTEGERP (attrs[LFACE_HEIGHT_INDEX])); | 2792 | || INTEGERP (attrs[LFACE_HEIGHT_INDEX]) |
| 2793 | || FLOATP (attrs[LFACE_HEIGHT_INDEX]) | ||
| 2794 | || FUNCTIONP (attrs[LFACE_HEIGHT_INDEX])); | ||
| 2787 | xassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX]) | 2795 | xassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX]) |
| 2788 | || SYMBOLP (attrs[LFACE_WEIGHT_INDEX])); | 2796 | || SYMBOLP (attrs[LFACE_WEIGHT_INDEX])); |
| 2789 | xassert (UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX]) | 2797 | xassert (UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX]) |
| @@ -2808,6 +2816,10 @@ check_lface_attrs (attrs) | |||
| 2808 | || STRINGP (attrs[LFACE_FOREGROUND_INDEX])); | 2816 | || STRINGP (attrs[LFACE_FOREGROUND_INDEX])); |
| 2809 | xassert (UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX]) | 2817 | xassert (UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX]) |
| 2810 | || STRINGP (attrs[LFACE_BACKGROUND_INDEX])); | 2818 | || STRINGP (attrs[LFACE_BACKGROUND_INDEX])); |
| 2819 | xassert (UNSPECIFIEDP (attrs[LFACE_INHERIT_INDEX]) | ||
| 2820 | || NILP (attrs[LFACE_INHERIT_INDEX]) | ||
| 2821 | || SYMBOLP (attrs[LFACE_INHERIT_INDEX]) | ||
| 2822 | || CONSP (attrs[LFACE_INHERIT_INDEX])); | ||
| 2811 | #ifdef HAVE_WINDOW_SYSTEM | 2823 | #ifdef HAVE_WINDOW_SYSTEM |
| 2812 | xassert (UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX]) | 2824 | xassert (UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX]) |
| 2813 | || SYMBOLP (attrs[LFACE_STIPPLE_INDEX]) | 2825 | || SYMBOLP (attrs[LFACE_STIPPLE_INDEX]) |
| @@ -3049,18 +3061,170 @@ set_lface_from_font_name (f, lface, fontname, force_p, may_fail_p) | |||
| 3049 | #endif /* HAVE_WINDOW_SYSTEM */ | 3061 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3050 | 3062 | ||
| 3051 | 3063 | ||
| 3052 | /* Merge two Lisp face attribute vectors FROM and TO and store the | 3064 | /* Merges the face height FROM with the face height TO, and returns the |
| 3053 | resulting attributes in TO. Every non-nil attribute of FROM | 3065 | merged height. If FROM is an invalid height, then INVALID is |
| 3054 | overrides the corresponding attribute of TO. */ | 3066 | returned instead. FROM may be a either an absolute face height or a |
| 3067 | `relative' height, and TO must be an absolute height. The returned | ||
| 3068 | value is always an absolute height. GCPRO is a lisp value that will | ||
| 3069 | be protected from garbage-collection if this function makes a call | ||
| 3070 | into lisp. */ | ||
| 3071 | |||
| 3072 | Lisp_Object | ||
| 3073 | merge_face_heights (from, to, invalid, gcpro) | ||
| 3074 | Lisp_Object from, to, invalid, gcpro; | ||
| 3075 | { | ||
| 3076 | int result = 0; | ||
| 3077 | |||
| 3078 | if (INTEGERP (from)) | ||
| 3079 | result = XINT (from); | ||
| 3080 | else if (NUMBERP (from)) | ||
| 3081 | result = XFLOATINT (from) * XINT (to); | ||
| 3082 | #if 0 /* Probably not so useful. */ | ||
| 3083 | else if (CONSP (from) && CONSP (XCDR (from))) | ||
| 3084 | { | ||
| 3085 | if (EQ (XCAR(from), Qplus) || EQ (XCAR(from), Qminus)) | ||
| 3086 | { | ||
| 3087 | if (INTEGERP (XCAR (XCDR (from)))) | ||
| 3088 | { | ||
| 3089 | int inc = XINT (XCAR (XCDR (from))); | ||
| 3090 | if (EQ (XCAR (from), Qminus)) | ||
| 3091 | inc = -inc; | ||
| 3092 | |||
| 3093 | result = XFASTINT (to); | ||
| 3094 | if (result + inc > 0) | ||
| 3095 | /* Note that `underflows' don't mean FROM is invalid, so | ||
| 3096 | we just pin the result at TO if it would otherwise be | ||
| 3097 | negative or 0. */ | ||
| 3098 | result += inc; | ||
| 3099 | } | ||
| 3100 | } | ||
| 3101 | } | ||
| 3102 | #endif | ||
| 3103 | else if (FUNCTIONP (from)) | ||
| 3104 | { | ||
| 3105 | /* Call function with current height as argument. | ||
| 3106 | From is the new height. */ | ||
| 3107 | Lisp_Object args[2], height; | ||
| 3108 | struct gcpro gcpro1; | ||
| 3109 | |||
| 3110 | GCPRO1 (gcpro); | ||
| 3111 | |||
| 3112 | args[0] = from; | ||
| 3113 | args[1] = to; | ||
| 3114 | height = call_function (2, args); | ||
| 3115 | |||
| 3116 | UNGCPRO; | ||
| 3117 | |||
| 3118 | if (NUMBERP (height)) | ||
| 3119 | result = XFLOATINT (height); | ||
| 3120 | } | ||
| 3121 | |||
| 3122 | if (result > 0) | ||
| 3123 | return make_number (result); | ||
| 3124 | else | ||
| 3125 | return invalid; | ||
| 3126 | } | ||
| 3127 | |||
| 3128 | |||
| 3129 | /* Merge two Lisp face attribute vectors on frame F, FROM and TO, and | ||
| 3130 | store the resulting attributes in TO. Every non-nil attribute of | ||
| 3131 | FROM overrides the corresponding attribute of TO. CYCLE_CHECK is | ||
| 3132 | used internally to detect loops in face inheritance; it should be | ||
| 3133 | Qnil when called from other places. */ | ||
| 3055 | 3134 | ||
| 3056 | static INLINE void | 3135 | static INLINE void |
| 3057 | merge_face_vectors (from, to) | 3136 | merge_face_vectors (f, from, to, cycle_check) |
| 3137 | struct frame *f; | ||
| 3058 | Lisp_Object *from, *to; | 3138 | Lisp_Object *from, *to; |
| 3139 | Lisp_Object cycle_check; | ||
| 3059 | { | 3140 | { |
| 3060 | int i; | 3141 | int i; |
| 3142 | |||
| 3143 | /* If FROM inherits from some other faces, merge their attributes into | ||
| 3144 | TO before merging FROM's direct attributes. Note that an :inherit | ||
| 3145 | attribute of `unspecified' is the same as one of nil; we never | ||
| 3146 | merge :inherit attributes, so nil is more correct, but lots of | ||
| 3147 | other code uses `unspecified' as a generic value for face attributes. */ | ||
| 3148 | if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX]) | ||
| 3149 | && !NILP (from[LFACE_INHERIT_INDEX])) | ||
| 3150 | merge_face_inheritance (f, from[LFACE_INHERIT_INDEX], to, cycle_check); | ||
| 3151 | |||
| 3061 | for (i = 1; i < LFACE_VECTOR_SIZE; ++i) | 3152 | for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
| 3062 | if (!UNSPECIFIEDP (from[i])) | 3153 | if (!UNSPECIFIEDP (from[i])) |
| 3063 | to[i] = from[i]; | 3154 | if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i])) |
| 3155 | to[i] = merge_face_heights (from[i], to[i], to[i], cycle_check); | ||
| 3156 | else | ||
| 3157 | to[i] = from[i]; | ||
| 3158 | |||
| 3159 | /* TO is always an absolute face, which should inherit from nothing. | ||
| 3160 | We blindly copy the :inherit attribute above and fix it up here. */ | ||
| 3161 | to[LFACE_INHERIT_INDEX] = Qnil; | ||
| 3162 | } | ||
| 3163 | |||
| 3164 | /* Checks the `cycle check' variable CHECK to see if it indicates that | ||
| 3165 | EL is part of a cycle; CHECK must be either Qnil or a value returned | ||
| 3166 | by an earlier use of CYCLE_CHECK. SUSPICIOUS is the number of | ||
| 3167 | elements after which a cycle might be suspected; after that many | ||
| 3168 | elements, this macro begins consing in order to keep more precise | ||
| 3169 | track of elements. | ||
| 3170 | |||
| 3171 | Returns NIL if a cycle was detected, otherwise a new value for CHECK | ||
| 3172 | that includes EL. | ||
| 3173 | |||
| 3174 | CHECK is evaluated multiple times, EL and SUSPICIOUS 0 or 1 times, so | ||
| 3175 | the caller should make sure that's ok. */ | ||
| 3176 | #define CYCLE_CHECK(check, el, suspicious) \ | ||
| 3177 | (NILP (check) \ | ||
| 3178 | ? make_number (0) \ | ||
| 3179 | : INTEGERP (check) \ | ||
| 3180 | ? (XFASTINT (check) < (suspicious) \ | ||
| 3181 | ? make_number (XFASTINT (check) + 1) \ | ||
| 3182 | : Fcons (el, Qnil)) \ | ||
| 3183 | : Fmemq ((el), (check)) \ | ||
| 3184 | ? Qnil \ | ||
| 3185 | : Fcons ((el), (check))) | ||
| 3186 | |||
| 3187 | static void | ||
| 3188 | merge_face_inheritance (f, inherit, to, cycle_check) | ||
| 3189 | struct frame *f; | ||
| 3190 | Lisp_Object inherit; | ||
| 3191 | Lisp_Object *to; | ||
| 3192 | Lisp_Object cycle_check; | ||
| 3193 | { | ||
| 3194 | if (SYMBOLP (inherit) && !EQ (inherit, Qunspecified)) | ||
| 3195 | /* Inherit from the named face INHERIT. */ | ||
| 3196 | { | ||
| 3197 | Lisp_Object lface; | ||
| 3198 | |||
| 3199 | /* Make sure we're not in an inheritance loop. */ | ||
| 3200 | cycle_check = CYCLE_CHECK (cycle_check, inherit, 15); | ||
| 3201 | if (NILP (cycle_check)) | ||
| 3202 | /* Cycle detected, ignore any further inheritance. */ | ||
| 3203 | return; | ||
| 3204 | |||
| 3205 | lface = lface_from_face_name (f, inherit, 0); | ||
| 3206 | if (!NILP (lface)) | ||
| 3207 | merge_face_vectors (f, XVECTOR (lface)->contents, to, cycle_check); | ||
| 3208 | } | ||
| 3209 | else if (CONSP (inherit)) | ||
| 3210 | /* Handle a list of inherited faces by calling ourselves recursively | ||
| 3211 | on each element. Note that we only do so for symbol elements, so | ||
| 3212 | it's not possible to infinitely recurse. */ | ||
| 3213 | { | ||
| 3214 | while (CONSP (inherit)) | ||
| 3215 | { | ||
| 3216 | if (SYMBOLP (XCAR (inherit))) | ||
| 3217 | merge_face_inheritance (f, XCAR (inherit), to, cycle_check); | ||
| 3218 | |||
| 3219 | /* Check for a circular inheritance list. */ | ||
| 3220 | cycle_check = CYCLE_CHECK (cycle_check, inherit, 15); | ||
| 3221 | if (NILP (cycle_check)) | ||
| 3222 | /* Cycle detected. */ | ||
| 3223 | break; | ||
| 3224 | |||
| 3225 | inherit = XCDR (inherit); | ||
| 3226 | } | ||
| 3227 | } | ||
| 3064 | } | 3228 | } |
| 3065 | 3229 | ||
| 3066 | 3230 | ||
| @@ -3129,10 +3293,14 @@ merge_face_vector_with_property (f, to, prop) | |||
| 3129 | } | 3293 | } |
| 3130 | else if (EQ (keyword, QCheight)) | 3294 | else if (EQ (keyword, QCheight)) |
| 3131 | { | 3295 | { |
| 3132 | if (INTEGERP (value)) | 3296 | Lisp_Object new_height = |
| 3133 | to[LFACE_HEIGHT_INDEX] = value; | 3297 | merge_face_heights (value, to[LFACE_HEIGHT_INDEX], |
| 3134 | else | 3298 | Qnil, Qnil); |
| 3299 | |||
| 3300 | if (NILP (new_height)) | ||
| 3135 | add_to_log ("Invalid face font height", value, Qnil); | 3301 | add_to_log ("Invalid face font height", value, Qnil); |
| 3302 | else | ||
| 3303 | to[LFACE_HEIGHT_INDEX] = new_height; | ||
| 3136 | } | 3304 | } |
| 3137 | else if (EQ (keyword, QCweight)) | 3305 | else if (EQ (keyword, QCweight)) |
| 3138 | { | 3306 | { |
| @@ -3229,6 +3397,22 @@ merge_face_vector_with_property (f, to, prop) | |||
| 3229 | else | 3397 | else |
| 3230 | add_to_log ("Invalid face width", value, Qnil); | 3398 | add_to_log ("Invalid face width", value, Qnil); |
| 3231 | } | 3399 | } |
| 3400 | else if (EQ (keyword, QCinherit)) | ||
| 3401 | { | ||
| 3402 | if (SYMBOLP (value)) | ||
| 3403 | to[LFACE_INHERIT_INDEX] = value; | ||
| 3404 | else | ||
| 3405 | { | ||
| 3406 | Lisp_Object tail; | ||
| 3407 | for (tail = value; CONSP (tail); tail = XCDR (tail)) | ||
| 3408 | if (!SYMBOLP (XCAR (tail))) | ||
| 3409 | break; | ||
| 3410 | if (NILP (tail)) | ||
| 3411 | to[LFACE_INHERIT_INDEX] = value; | ||
| 3412 | else | ||
| 3413 | add_to_log ("Invalid face inherit", value, Qnil); | ||
| 3414 | } | ||
| 3415 | } | ||
| 3232 | else | 3416 | else |
| 3233 | add_to_log ("Invalid attribute %s in face property", | 3417 | add_to_log ("Invalid attribute %s in face property", |
| 3234 | keyword, Qnil); | 3418 | keyword, Qnil); |
| @@ -3255,7 +3439,7 @@ merge_face_vector_with_property (f, to, prop) | |||
| 3255 | if (NILP (lface)) | 3439 | if (NILP (lface)) |
| 3256 | add_to_log ("Invalid face text property value: %s", prop, Qnil); | 3440 | add_to_log ("Invalid face text property value: %s", prop, Qnil); |
| 3257 | else | 3441 | else |
| 3258 | merge_face_vectors (XVECTOR (lface)->contents, to); | 3442 | merge_face_vectors (f, XVECTOR (lface)->contents, to, Qnil); |
| 3259 | } | 3443 | } |
| 3260 | } | 3444 | } |
| 3261 | 3445 | ||
| @@ -3457,10 +3641,17 @@ frame.") | |||
| 3457 | { | 3641 | { |
| 3458 | if (!UNSPECIFIEDP (value)) | 3642 | if (!UNSPECIFIEDP (value)) |
| 3459 | { | 3643 | { |
| 3460 | CHECK_NUMBER (value, 3); | 3644 | Lisp_Object test = Qnil; |
| 3461 | if (XINT (value) <= 0) | 3645 | |
| 3646 | if (!EQ (face, Qdefault)) | ||
| 3647 | /* The default face must have an absolute size, otherwise, we do | ||
| 3648 | a test merge with a random height to see if VALUE's ok. */ | ||
| 3649 | test = merge_face_heights (value, make_number(10), Qnil, Qnil); | ||
| 3650 | |||
| 3651 | if (!INTEGERP(test) || XINT(test) <= 0) | ||
| 3462 | signal_error ("Invalid face height", value); | 3652 | signal_error ("Invalid face height", value); |
| 3463 | } | 3653 | } |
| 3654 | |||
| 3464 | old_value = LFACE_HEIGHT (lface); | 3655 | old_value = LFACE_HEIGHT (lface); |
| 3465 | LFACE_HEIGHT (lface) = value; | 3656 | LFACE_HEIGHT (lface) = value; |
| 3466 | font_related_attr_p = 1; | 3657 | font_related_attr_p = 1; |
| @@ -3683,6 +3874,20 @@ frame.") | |||
| 3683 | font_attr_p = 1; | 3874 | font_attr_p = 1; |
| 3684 | #endif /* HAVE_WINDOW_SYSTEM */ | 3875 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3685 | } | 3876 | } |
| 3877 | else if (EQ (attr, QCinherit)) | ||
| 3878 | { | ||
| 3879 | Lisp_Object tail; | ||
| 3880 | if (SYMBOLP (value)) | ||
| 3881 | tail = Qnil; | ||
| 3882 | else | ||
| 3883 | for (tail = value; CONSP (tail); tail = XCDR (tail)) | ||
| 3884 | if (!SYMBOLP (XCAR (tail))) | ||
| 3885 | break; | ||
| 3886 | if (NILP (tail)) | ||
| 3887 | LFACE_INHERIT (lface) = value; | ||
| 3888 | else | ||
| 3889 | signal_error ("Invalid font inheritance", value); | ||
| 3890 | } | ||
| 3686 | else if (EQ (attr, QCbold)) | 3891 | else if (EQ (attr, QCbold)) |
| 3687 | { | 3892 | { |
| 3688 | old_value = LFACE_WEIGHT (lface); | 3893 | old_value = LFACE_WEIGHT (lface); |
| @@ -4244,6 +4449,8 @@ frames). If FRAME is omitted or nil, use the selected frame.") | |||
| 4244 | value = LFACE_STIPPLE (lface); | 4449 | value = LFACE_STIPPLE (lface); |
| 4245 | else if (EQ (keyword, QCwidth)) | 4450 | else if (EQ (keyword, QCwidth)) |
| 4246 | value = LFACE_SWIDTH (lface); | 4451 | value = LFACE_SWIDTH (lface); |
| 4452 | else if (EQ (keyword, QCinherit)) | ||
| 4453 | value = LFACE_INHERIT (lface); | ||
| 4247 | else if (EQ (keyword, QCfont)) | 4454 | else if (EQ (keyword, QCfont)) |
| 4248 | value = LFACE_FONT (lface); | 4455 | value = LFACE_FONT (lface); |
| 4249 | else | 4456 | else |
| @@ -4318,8 +4525,10 @@ DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face, | |||
| 4318 | local_lface = lface_from_face_name (XFRAME (frame), face, 0); | 4525 | local_lface = lface_from_face_name (XFRAME (frame), face, 0); |
| 4319 | if (NILP (local_lface)) | 4526 | if (NILP (local_lface)) |
| 4320 | local_lface = Finternal_make_lisp_face (face, frame); | 4527 | local_lface = Finternal_make_lisp_face (face, frame); |
| 4321 | merge_face_vectors (XVECTOR (global_lface)->contents, | 4528 | merge_face_vectors (XFRAME (frame), |
| 4322 | XVECTOR (local_lface)->contents); | 4529 | XVECTOR (global_lface)->contents, |
| 4530 | XVECTOR (local_lface)->contents, | ||
| 4531 | Qnil); | ||
| 4323 | return face; | 4532 | return face; |
| 4324 | } | 4533 | } |
| 4325 | 4534 | ||
| @@ -4530,8 +4739,7 @@ lface_same_font_attributes_p (lface1, lface2) | |||
| 4530 | && lface_fully_specified_p (lface2)); | 4739 | && lface_fully_specified_p (lface2)); |
| 4531 | return (xstricmp (XSTRING (lface1[LFACE_FAMILY_INDEX])->data, | 4740 | return (xstricmp (XSTRING (lface1[LFACE_FAMILY_INDEX])->data, |
| 4532 | XSTRING (lface2[LFACE_FAMILY_INDEX])->data) == 0 | 4741 | XSTRING (lface2[LFACE_FAMILY_INDEX])->data) == 0 |
| 4533 | && (XFASTINT (lface1[LFACE_HEIGHT_INDEX]) | 4742 | && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX]) |
| 4534 | == XFASTINT (lface2[LFACE_HEIGHT_INDEX])) | ||
| 4535 | && EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX]) | 4743 | && EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX]) |
| 4536 | && EQ (lface1[LFACE_WEIGHT_INDEX], lface2[LFACE_WEIGHT_INDEX]) | 4744 | && EQ (lface1[LFACE_WEIGHT_INDEX], lface2[LFACE_WEIGHT_INDEX]) |
| 4537 | && EQ (lface1[LFACE_SLANT_INDEX], lface2[LFACE_SLANT_INDEX]) | 4745 | && EQ (lface1[LFACE_SLANT_INDEX], lface2[LFACE_SLANT_INDEX]) |
| @@ -4989,7 +5197,7 @@ lookup_named_face (f, symbol, c) | |||
| 4989 | 5197 | ||
| 4990 | get_lface_attributes (f, symbol, symbol_attrs, 1); | 5198 | get_lface_attributes (f, symbol, symbol_attrs, 1); |
| 4991 | bcopy (default_face->lface, attrs, sizeof attrs); | 5199 | bcopy (default_face->lface, attrs, sizeof attrs); |
| 4992 | merge_face_vectors (symbol_attrs, attrs); | 5200 | merge_face_vectors (f, symbol_attrs, attrs, Qnil); |
| 4993 | return lookup_face (f, attrs, c, NULL); | 5201 | return lookup_face (f, attrs, c, NULL); |
| 4994 | } | 5202 | } |
| 4995 | 5203 | ||
| @@ -5126,7 +5334,7 @@ lookup_derived_face (f, symbol, c, face_id) | |||
| 5126 | 5334 | ||
| 5127 | get_lface_attributes (f, symbol, symbol_attrs, 1); | 5335 | get_lface_attributes (f, symbol, symbol_attrs, 1); |
| 5128 | bcopy (default_face->lface, attrs, sizeof attrs); | 5336 | bcopy (default_face->lface, attrs, sizeof attrs); |
| 5129 | merge_face_vectors (symbol_attrs, attrs); | 5337 | merge_face_vectors (f, symbol_attrs, attrs, Qnil); |
| 5130 | return lookup_face (f, attrs, c, default_face); | 5338 | return lookup_face (f, attrs, c, default_face); |
| 5131 | } | 5339 | } |
| 5132 | 5340 | ||
| @@ -5816,7 +6024,7 @@ realize_named_face (f, symbol, id) | |||
| 5816 | 6024 | ||
| 5817 | /* Merge SYMBOL's face with the default face. */ | 6025 | /* Merge SYMBOL's face with the default face. */ |
| 5818 | get_lface_attributes (f, symbol, symbol_attrs, 1); | 6026 | get_lface_attributes (f, symbol, symbol_attrs, 1); |
| 5819 | merge_face_vectors (symbol_attrs, attrs); | 6027 | merge_face_vectors (f, symbol_attrs, attrs, Qnil); |
| 5820 | 6028 | ||
| 5821 | /* Realize the face. */ | 6029 | /* Realize the face. */ |
| 5822 | new_face = realize_face (c, attrs, 0, NULL, id); | 6030 | new_face = realize_face (c, attrs, 0, NULL, id); |
| @@ -6413,7 +6621,7 @@ face_at_buffer_position (w, pos, region_beg, region_end, | |||
| 6413 | if (pos >= region_beg && pos < region_end) | 6621 | if (pos >= region_beg && pos < region_end) |
| 6414 | { | 6622 | { |
| 6415 | Lisp_Object region_face = lface_from_face_name (f, Qregion, 0); | 6623 | Lisp_Object region_face = lface_from_face_name (f, Qregion, 0); |
| 6416 | merge_face_vectors (XVECTOR (region_face)->contents, attrs); | 6624 | merge_face_vectors (f, XVECTOR (region_face)->contents, attrs, Qnil); |
| 6417 | 6625 | ||
| 6418 | if (region_end < endpos) | 6626 | if (region_end < endpos) |
| 6419 | endpos = region_end; | 6627 | endpos = region_end; |
| @@ -6513,7 +6721,7 @@ face_at_string_position (w, string, pos, bufpos, region_beg, | |||
| 6513 | && bufpos < region_end) | 6721 | && bufpos < region_end) |
| 6514 | { | 6722 | { |
| 6515 | Lisp_Object region_face = lface_from_face_name (f, Qregion, 0); | 6723 | Lisp_Object region_face = lface_from_face_name (f, Qregion, 0); |
| 6516 | merge_face_vectors (XVECTOR (region_face)->contents, attrs); | 6724 | merge_face_vectors (f, XVECTOR (region_face)->contents, attrs, Qnil); |
| 6517 | } | 6725 | } |
| 6518 | 6726 | ||
| 6519 | /* Look up a realized face with the given face attributes, | 6727 | /* Look up a realized face with the given face attributes, |
| @@ -6658,6 +6866,8 @@ syms_of_xfaces () | |||
| 6658 | staticpro (&QCstrike_through); | 6866 | staticpro (&QCstrike_through); |
| 6659 | QCbox = intern (":box"); | 6867 | QCbox = intern (":box"); |
| 6660 | staticpro (&QCbox); | 6868 | staticpro (&QCbox); |
| 6869 | QCinherit = intern (":inherit"); | ||
| 6870 | staticpro (&QCinherit); | ||
| 6661 | 6871 | ||
| 6662 | /* Symbols used for Lisp face attribute values. */ | 6872 | /* Symbols used for Lisp face attribute values. */ |
| 6663 | QCcolor = intern (":color"); | 6873 | QCcolor = intern (":color"); |