comparison lisp/cus-face.el @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children a307f9a2021d
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
53 (run-hooks 'custom-define-hook)) 53 (run-hooks 'custom-define-hook))
54 face) 54 face)
55 55
56 ;;; Font Attributes. 56 ;;; Font Attributes.
57 57
58 ;; Consider adding the stuff in the XML font model here.
58 (defconst custom-face-attributes 59 (defconst custom-face-attributes
59 '((:foreground (color :tag "Foreground" 60 '((:foreground (color :tag "Foreground"
60 :value "" 61 :value ""
61 :help-echo "Set foreground color.") 62 :help-echo "Set foreground color.")
62 set-face-foreground face-foreground-name) 63 set-face-foreground face-foreground-name)
96 set-face-strikethru-p face-strikethru-p) 97 set-face-strikethru-p face-strikethru-p)
97 (:inverse-video (toggle :format "%[Inverse Video%]: %v\n" 98 (:inverse-video (toggle :format "%[Inverse Video%]: %v\n"
98 :help-echo "\ 99 :help-echo "\
99 Control whether the text should be inverted. Works only on TTY-s") 100 Control whether the text should be inverted. Works only on TTY-s")
100 set-face-reverse-p face-reverse-p)) 101 set-face-reverse-p face-reverse-p))
101 "Alist of face attributes. 102 "Alist of face attributes.
102 103
103 The elements are of the form (KEY TYPE SET GET) where KEY is a symbol 104 The elements are lists of the form (KEY TYPE SET GET) where:
104 identifying the attribute, TYPE is a widget type for editing the 105 KEY is a symbol identifying the attribute.
105 attibute, SET is a function for setting the attribute value, and GET is a function for getiing the attribute value. 106 TYPE is a widget type for editing the attribute.
106 107 SET is a function for setting the attribute value.
107 The SET function should take three arguments, the face to modify, the 108 GET is a function for getting the attribute value.
109
110 The SET function should take three arguments: the face to modify, the
108 value of the attribute, and optionally the frame where the face should 111 value of the attribute, and optionally the frame where the face should
109 be changed. 112 be changed.
110 113
111 The GET function should take two arguments, the face to examine, and 114 The GET function should take two arguments, the face to examine, and
112 optonally the frame where the face should be examined.") 115 optionally the frame where the face should be examined.")
113 116
114 (defun face-custom-attributes-set (face frame tags &rest atts) 117 (defun face-custom-attributes-set (face frame tags &rest atts)
115 "For FACE on FRAME set the attributes [KEYWORD VALUE].... 118 "For FACE on FRAME set the attributes [KEYWORD VALUE]....
116 Each keyword should be listed in `custom-face-attributes'. 119 Each keyword should be listed in `custom-face-attributes'.
117 120
190 (fontobj (font-create-object font))) 193 (fontobj (font-create-object font)))
191 (font-italic-p fontobj))) 194 (font-italic-p fontobj)))
192 195
193 (defun custom-face-background-pixmap (face &rest args) 196 (defun custom-face-background-pixmap (face &rest args)
194 "Return the name of the background pixmap file used for FACE." 197 "Return the name of the background pixmap file used for FACE."
195 (let ((image (apply 'specifier-instance 198 (let ((image (apply 'specifier-instance
196 (face-background-pixmap face) args))) 199 (face-background-pixmap face) args)))
197 (and image 200 (and image
198 (image-instance-file-name image)))) 201 (image-instance-file-name image))))
199 202
200 (defun custom-set-face-font-size (face size &optional locale tags) 203 (defun custom-set-face-font-size (face size &optional locale tags)
201 "Set the font of FACE to SIZE" 204 "Set the font of FACE to SIZE."
202 (let* ((font (apply 'face-font-name face locale)) 205 (let* ((font (apply 'face-font-name face locale))
203 ;; Gag 206 ;; Gag
204 (fontobj (font-create-object font))) 207 (fontobj (font-create-object font)))
205 (set-font-size fontobj size) 208 (set-font-size fontobj size)
206 (apply 'font-set-face-font face fontobj locale tags))) 209 (apply 'font-set-face-font face fontobj locale tags)))
228 (font-family fontobj))) 231 (font-family fontobj)))
229 232
230 ;;;###autoload 233 ;;;###autoload
231 (defun custom-set-face-update-spec (face display plist) 234 (defun custom-set-face-update-spec (face display plist)
232 "Customize the FACE for display types matching DISPLAY, merging 235 "Customize the FACE for display types matching DISPLAY, merging
233 in the new items from PLIST" 236 in the new items from PLIST."
234 (let ((spec (face-spec-update-all-matching (custom-face-get-spec face) 237 (let ((spec (face-spec-update-all-matching (custom-face-get-spec face)
235 display plist))) 238 display plist)))
236 (put face 'customized-face spec) 239 (put face 'customized-face spec)
237 (face-spec-set face spec nil '(custom)))) 240 (face-spec-set face spec nil '(custom))))
238 241
324 ;;;###autoload 327 ;;;###autoload
325 (defun custom-reset-faces (&rest args) 328 (defun custom-reset-faces (&rest args)
326 "Reset the value of the face to values previously defined. 329 "Reset the value of the face to values previously defined.
327 Associate this setting with the 'user' theme. 330 Associate this setting with the 'user' theme.
328 331
329 ARGS is defined as for `custom-theme-reset-faces'" 332 ARGS is defined as for `custom-theme-reset-faces'."
330 (apply #'custom-theme-reset-faces 'user args)) 333 (apply #'custom-theme-reset-faces 'user args))
331 334
332 335
333 ;;; The End. 336 ;;; The End.
334 337