comparison lisp/cus-face.el @ 373:6240c7796c7a r21-2b2

Import from CVS: tag r21-2b2
author cvs
date Mon, 13 Aug 2007 11:04:06 +0200
parents cc15677e0335
children d883f39b8495
comparison
equal deleted inserted replaced
372:49e1ed2d7ed8 373:6240c7796c7a
65 set-face-background face-background-name) 65 set-face-background face-background-name)
66 (:size (editable-field :format "Size: %v" 66 (:size (editable-field :format "Size: %v"
67 :help-echo "\ 67 :help-echo "\
68 Text size (e.g. 9pt or 2mm).") 68 Text size (e.g. 9pt or 2mm).")
69 custom-set-face-font-size custom-face-font-size) 69 custom-set-face-font-size custom-face-font-size)
70 (:stipple (editable-field :format "Stipple: %v"
71 :help-echo "Name of background bitmap file.")
72 set-face-stipple custom-face-stipple)
73 (:family (editable-field :format "Font Family: %v" 70 (:family (editable-field :format "Font Family: %v"
74 :help-echo "\ 71 :help-echo "\
75 Name of font family to use (e.g. times).") 72 Name of font family to use (e.g. times).")
76 custom-set-face-font-family custom-face-font-family) 73 custom-set-face-font-family custom-face-font-family)
74 (:background-pixmap (editable-field :format "Background pixmap: %v"
75 :help-echo "\
76 Name of background pixmap file.")
77 set-face-background-pixmap custom-face-background-pixmap)
78 (:dim (toggle :format "%[Dim%]: %v\n"
79 :help-echo "Control whether the text should be dimmed.")
80 set-face-dim-p face-dim-p)
77 (:bold (toggle :format "%[Bold%]: %v\n" 81 (:bold (toggle :format "%[Bold%]: %v\n"
78 :help-echo "Control whether a bold font should be used.") 82 :help-echo "Control whether a bold font should be used.")
79 custom-set-face-bold custom-face-bold) 83 custom-set-face-bold custom-face-bold)
80 (:italic (toggle :format "%[Italic%]: %v\n" 84 (:italic (toggle :format "%[Italic%]: %v\n"
81 :help-echo "\ 85 :help-echo "\
83 custom-set-face-italic custom-face-italic) 87 custom-set-face-italic custom-face-italic)
84 (:underline (toggle :format "%[Underline%]: %v\n" 88 (:underline (toggle :format "%[Underline%]: %v\n"
85 :help-echo "\ 89 :help-echo "\
86 Control whether the text should be underlined.") 90 Control whether the text should be underlined.")
87 set-face-underline-p face-underline-p) 91 set-face-underline-p face-underline-p)
88 ;; #### Should make it work on X
89 (:strikethru (toggle :format "%[Strikethru%]: %v\n" 92 (:strikethru (toggle :format "%[Strikethru%]: %v\n"
90 :help-echo "\ 93 :help-echo "\
91 Control whether the text should be strikethru.") 94 Control whether the text should be strikethru.")
92 set-face-strikethru-p face-strikethru-p) 95 set-face-strikethru-p face-strikethru-p)
93 (:inverse-video (toggle :format "%[Inverse Video%]: %v\n" 96 (:inverse-video (toggle :format "%[Inverse Video%]: %v\n"
144 (when (widget-apply (nth 1 att) :match answer) 147 (when (widget-apply (nth 1 att) :match answer)
145 (setq result (cons (nth 0 att) (cons answer result))))))) 148 (setq result (cons (nth 0 att) (cons answer result)))))))
146 (error nil))) 149 (error nil)))
147 result)) 150 result))
148 151
152 (defsubst custom-face-get-spec (symbol)
153 (or (get symbol 'customized-face)
154 (get symbol 'saved-face)
155 (get symbol 'face-defface-spec)
156 ;; Attempt to construct it.
157 (list (list t (face-custom-attributes-get
158 symbol (selected-frame))))))
159
149 (defun custom-set-face-bold (face value &optional frame) 160 (defun custom-set-face-bold (face value &optional frame)
150 "Set the bold property of FACE to VALUE." 161 "Set the bold property of FACE to VALUE."
151 (if value 162 (if value
152 (make-face-bold face frame) 163 (make-face-bold face frame)
153 (make-face-unbold face frame))) 164 (make-face-unbold face frame)))
176 (let* ((font (apply 'face-font-name face args)) 187 (let* ((font (apply 'face-font-name face args))
177 ;; Gag 188 ;; Gag
178 (fontobj (font-create-object font))) 189 (fontobj (font-create-object font)))
179 (font-italic-p fontobj))) 190 (font-italic-p fontobj)))
180 191
181 (defun custom-face-stipple (face &rest args) 192 (defun custom-face-background-pixmap (face &rest args)
182 "Return the name of the stipple file used for FACE." 193 "Return the name of the background pixmap file used for FACE."
183 (let ((image (apply 'specifier-instance 194 (let ((image (apply 'specifier-instance
184 (face-background-pixmap face) args))) 195 (face-background-pixmap face) args)))
185 (and image 196 (and image
186 (image-instance-file-name image)))) 197 (image-instance-file-name image))))
187 198
212 "Return the name of the font family of FACE." 223 "Return the name of the font family of FACE."
213 (let* ((font (apply 'face-font-name face args)) 224 (let* ((font (apply 'face-font-name face args))
214 ;; Gag 225 ;; Gag
215 (fontobj (font-create-object font))) 226 (fontobj (font-create-object font)))
216 (font-family fontobj))) 227 (font-family fontobj)))
228
229 (defun custom-set-face-update-spec (face display plist)
230 "Customize the FACE for display types matching DISPLAY, merging
231 in the new items from PLIST"
232 (let ((spec (face-spec-update-all-matching (custom-face-get-spec face)
233 display plist)))
234 (put face 'customized-face spec)
235 (face-spec-set face spec)))
217 236
218 ;;; Initializing. 237 ;;; Initializing.
219 238
220 ;;;###autoload 239 ;;;###autoload
221 (defun custom-set-faces (&rest args) 240 (defun custom-set-faces (&rest args)