comparison lisp/cus-face.el @ 31192:4cea72ab1bae

(custom-face-attributes): Add support for :inherit attribute. Add support for relative face heights. (custom-face-attributes-get): Treat `nil' as being a default value for :inherit (as well as `unspecified').
author Miles Bader <miles@gnu.org>
date Sat, 26 Aug 2000 11:47:02 +0000
parents b332ebdca302
children 1ae73b01ef27
comparison
equal deleted inserted replaced
31191:5275607ad5d0 31192:4cea72ab1bae
107 107
108 (:height 108 (:height
109 (choice :tag "Height" 109 (choice :tag "Height"
110 :help-echo "Face's font height." 110 :help-echo "Face's font height."
111 (const :tag "*" nil) 111 (const :tag "*" nil)
112 (integer :tag "Height in 1/10 pt")) 112 (integer :tag "Height in 1/10 pt")
113 (number :tag "Scale" 1.0))
113 (lambda (face value &optional frame) 114 (lambda (face value &optional frame)
114 (set-face-attribute face frame :height (or value 'unspecified))) 115 (set-face-attribute face frame :height (or value 'unspecified)))
115 (lambda (face &optional frame) 116 (lambda (face &optional frame)
116 (let ((height (face-attribute face :height frame))) 117 (let ((height (face-attribute face :height frame)))
117 (if (eq height 'unspecified) nil height)))) 118 (if (eq height 'unspecified) nil height))))
118 119
119 (:weight 120 (:weight
120 (choice :tag "Weight" 121 (choice :tag "Weight"
121 :help-echo "Font weight." 122 :help-echo "Font weight."
122 (const :tag "*" nil) 123 (const :tag "*" nil)
123 (const :tag "black" ultra_bold) 124 (const :tag "black" ultra_bold)
276 (file :tag "File" :must-match t)) 277 (file :tag "File" :must-match t))
277 (lambda (face value &optional frame) 278 (lambda (face value &optional frame)
278 (set-face-attribute face frame :stipple (or value 'unspecified))) 279 (set-face-attribute face frame :stipple (or value 'unspecified)))
279 (lambda (face &optional frame) 280 (lambda (face &optional frame)
280 (let ((value (face-attribute face :stipple frame))) 281 (let ((value (face-attribute face :stipple frame)))
281 (if (eq value 'unspecified) nil value))))) 282 (if (eq value 'unspecified) nil value))))
283
284 (:inherit
285 (repeat :tag "Inherit"
286 :help-echo "List of faces to inherit attributes from."
287 (face :Tag "Face" default))
288 (lambda (face value &optional frame)
289 (message "Setting to: <%s>" value)
290 (set-face-attribute face frame :inherit
291 (if (and (consp value) (null (cdr value)))
292 (car value)
293 value)))
294 (lambda (face &optional frame)
295 (let ((value (face-attribute face :inherit frame)))
296 (cond ((or (null value) (eq value 'unspecified))
297 nil)
298 ((symbolp value)
299 (list value))
300 (t
301 value))))))
282 302
283 "Alist of face attributes. 303 "Alist of face attributes.
284 304
285 The elements are of the form (KEY TYPE SET GET), where KEY is the name 305 The elements are of the form (KEY TYPE SET GET), where KEY is the name
286 of the attribute, TYPE is a widget type for editing the attibute, SET 306 of the attribute, TYPE is a widget type for editing the attibute, SET
305 plist) 325 plist)
306 (while attrs 326 (while attrs
307 (let* ((attribute (car (car attrs))) 327 (let* ((attribute (car (car attrs)))
308 (value (face-attribute face attribute frame))) 328 (value (face-attribute face attribute frame)))
309 (setq attrs (cdr attrs)) 329 (setq attrs (cdr attrs))
310 (unless (eq value 'unspecified) 330 (unless (or (eq value 'unspecified)
331 (and (null value) (memq attribute '(:inherit))))
311 (setq plist (cons attribute (cons value plist)))))) 332 (setq plist (cons attribute (cons value plist))))))
312 plist)) 333 plist))
313 334
314 ;;; Initializing. 335 ;;; Initializing.
315 336