comparison lisp/ps-print.el @ 19446:15ecd855fec8

(ps-print-face-extension-alist): Doc fix. (ps-new-faces): Function deleted.
author Richard M. Stallman <rms@gnu.org>
date Wed, 20 Aug 1997 23:15:22 +0000
parents 94a54fbffb3e
children eab8baa19dfa
comparison
equal deleted inserted replaced
19445:94a54fbffb3e 19446:15ecd855fec8
539 ;; overline - like underline, but the line is over the text. 539 ;; overline - like underline, but the line is over the text.
540 ;; shadow - text will have a shadow. 540 ;; shadow - text will have a shadow.
541 ;; box - text will be surrounded by a box. 541 ;; box - text will be surrounded by a box.
542 ;; outline - only the text border font will be printed. 542 ;; outline - only the text border font will be printed.
543 ;; 543 ;;
544 ;; See documentation for `ps-extend-face' and `ps-extend-face-list'. 544 ;; See the documentation for `ps-extend-face' and `ps-extend-face-list'.
545 ;;
546 ;; Besides remapping existing faces it is also possible to create new faces
547 ;; using `ps-new-faces' (see the documentation) for both the screen and
548 ;; printing presentation.
549 ;; 545 ;;
550 ;; Let's, for example, remap font-lock-keyword-face to another foreground color 546 ;; Let's, for example, remap font-lock-keyword-face to another foreground color
551 ;; and bold attribute: 547 ;; and bold attribute:
552 ;; 548 ;;
553 ;; (ps-extend-face '(font-lock-keyword-face "RoyalBlue" nil bold)) 549 ;; (ps-extend-face '(font-lock-keyword-face "RoyalBlue" nil bold))
558 ;; '((font-lock-function-name-face "Blue" nil bold) 554 ;; '((font-lock-function-name-face "Blue" nil bold)
559 ;; (font-lock-variable-name-face "Sienna" nil bold italic) 555 ;; (font-lock-variable-name-face "Sienna" nil bold italic)
560 ;; (font-lock-keyword-face "RoyalBlue" nil underline)) 556 ;; (font-lock-keyword-face "RoyalBlue" nil underline))
561 ;; 'MERGE) 557 ;; 'MERGE)
562 ;; 558 ;;
563 ;; And if we wish to create new faces and extend:
564 ;;
565 ;; (ps-new-faces
566 ;; ;; new faces for screen
567 ;; '((my-obsolete-face "White" "FireBrick" italic underline bold)
568 ;; (my-keyword-face "Blue")
569 ;; (my-comment-face "FireBrick" nil italic)
570 ;; (my-string-face "Grey40" nil italic))
571 ;; ;; face extension for printing
572 ;; '((my-keyword-face nil nil bold)
573 ;; (my-comment-face nil nil bold)
574 ;; (font-lock-function-name-face "Blue" nil bold)
575 ;; (font-lock-variable-name-face "Sienna" nil bold italic)
576 ;; (font-lock-keyword-face "RoyalBlue" nil underline))
577 ;; 'OVERRIDE 'MERGE)
578 ;;
579 ;; Note: the only attributes that have effect on screen are: bold, italic and 559 ;; Note: the only attributes that have effect on screen are: bold, italic and
580 ;; underline. All other screen effect is ignored. 560 ;; underline. All other screen effect is ignored.
561 ;;
562 ;; If you want to use a new face, define it first with `defface',
563 ;; and then call `ps-extend-face' to specify how to print it.
581 ;; 564 ;;
582 ;; 565 ;;
583 ;; How Ps-Print Has A Text And/Or Image On Background 566 ;; How Ps-Print Has A Text And/Or Image On Background
584 ;; -------------------------------------------------- 567 ;; --------------------------------------------------
585 ;; 568 ;;
2235 to a feature (bold, underline, etc) 2218 to a feature (bold, underline, etc)
2236 (see documentation for `ps-print-face-map-alist') 2219 (see documentation for `ps-print-face-map-alist')
2237 FG foreground color (string or nil) 2220 FG foreground color (string or nil)
2238 BG background color (string or nil) 2221 BG background color (string or nil)
2239 2222
2240 This list should not be handled directly, but through `ps-new-faces', 2223 Don't change this list directly; instead, use
2241 `ps-extend-face' and `ps-extend-face-list'. 2224 `ps-extend-face' and `ps-extend-face-list' to change it.
2242 See documentation for `ps-extend-face' for valid extension symbol. 2225 See documentation for `ps-extend-face' for valid extension symbol.
2243 See also `font-lock-face-attributes'.") 2226 See also `font-lock-face-attributes'.")
2244 2227
2245 2228
2246 (defconst ps-print-face-map-alist 2229 (defconst ps-print-face-map-alist
2266 ;; The definition below is necessary because some emacs variant does not 2249 ;; The definition below is necessary because some emacs variant does not
2267 ;; define it on font-lock package. 2250 ;; define it on font-lock package.
2268 2251
2269 (defvar font-lock-face-attributes nil) 2252 (defvar font-lock-face-attributes nil)
2270 2253
2271
2272 ;;;###autoload
2273 (defun ps-new-faces (face-screen &optional face-extension override-p merge-p)
2274 "Create new faces from FACE-SCREEN.
2275
2276 The FACE-SCREEN elements are added to `font-lock-face-attributes'.
2277 If optional OVERRIDE-P is non-nil, faces that already exist in
2278 `font-lock-face-attributes' are overrided.
2279
2280 If optional MERGE-p is non-nil, extensions in FACE-EXTENSION are merged with
2281 face extension in `ps-print-face-extension-alist'; otherwise, overrides.
2282
2283 The arguments FACE-SCREEN and FACE-EXTENSION are lists whose elements are:
2284
2285 (FACE-NAME FOREGROUND BACKGROUND EXTENSION...)
2286
2287 FACE-NAME is a face name.
2288
2289 FOREGROUND and BACKGROUND may be nil or a string that denotes the
2290 foreground and background colors respectively.
2291
2292 EXTENSION is some valid extension symbol (see `ps-extend-face')."
2293 (let ((mapfun (if override-p
2294 '(lambda (face)
2295 (let ((face-attributes (ps-extension-to-screen-face face)))
2296 (font-lock-make-face face-attributes)
2297 (ps-override-list 'font-lock-face-attributes
2298 face-attributes)
2299 (ps-override-list 'ps-print-face-extension-alist
2300 (ps-extension-to-bit-face face))))
2301 '(lambda (face)
2302 (let ((face-attributes (ps-extension-to-screen-face face)))
2303 (font-lock-make-face face-attributes)
2304 (add-to-list 'font-lock-face-attributes
2305 face-attributes)
2306 (add-to-list 'ps-print-face-extension-alist
2307 (ps-extension-to-bit-face face))))
2308 ))
2309 maplist)
2310 (mapcar mapfun face-screen)
2311 (ps-extend-face-list face-extension merge-p)))
2312 2254
2313 2255
2314 (defun ps-override-list (sym-list element) 2256 (defun ps-override-list (sym-list element)
2315 (let ((maplist (assq (car element) (symbol-value sym-list)))) 2257 (let ((maplist (assq (car element) (symbol-value sym-list))))
2316 (if maplist 2258 (if maplist