Function: ps-extend-face

ps-extend-face is an autoloaded and byte-compiled function defined in ps-print.el.gz.

Signature

(ps-extend-face FACE-EXTENSION &optional MERGE-P ALIST-SYM)

Documentation

Extend face in ALIST-SYM.

If optional MERGE-P is non-nil, extensions in FACE-EXTENSION list are merged with face extensions in ALIST-SYM; otherwise, overrides.

If optional ALIST-SYM is nil, ps-print-face-extension-alist is used; otherwise, it should be an alist symbol.

The elements of FACE-EXTENSION list have the form:

   (FACE-NAME FOREGROUND BACKGROUND EXTENSION...)

FACE-NAME is a face name symbol.

FOREGROUND and BACKGROUND may be nil or a string that denotes the foreground and background colors respectively.

EXTENSION is one of the following symbols:
   bold - use bold font.
   italic - use italic font.
   underline - put a line under text.
   strikeout - like underline, but the line is in middle of text.
   overline - like underline, but the line is over the text.
   shadow - text will have a shadow.
   box - text will be surrounded by a box.
   outline - print characters as hollow outlines.

If EXTENSION is any other symbol, it is ignored.

Source Code

;; Defined in /usr/src/emacs/lisp/ps-print.el.gz
;;;###autoload
(defun ps-extend-face (face-extension &optional merge-p alist-sym)
  "Extend face in ALIST-SYM.

If optional MERGE-P is non-nil, extensions in FACE-EXTENSION list are merged
with face extensions in ALIST-SYM; otherwise, overrides.

If optional ALIST-SYM is nil, `ps-print-face-extension-alist' is used;
otherwise, it should be an alist symbol.

The elements of FACE-EXTENSION list have the form:

   (FACE-NAME FOREGROUND BACKGROUND EXTENSION...)

FACE-NAME is a face name symbol.

FOREGROUND and BACKGROUND may be nil or a string that denotes the
foreground and background colors respectively.

EXTENSION is one of the following symbols:
   bold      - use bold font.
   italic    - use italic font.
   underline - put a line under text.
   strikeout - like underline, but the line is in middle of text.
   overline  - like underline, but the line is over the text.
   shadow    - text will have a shadow.
   box       - text will be surrounded by a box.
   outline   - print characters as hollow outlines.

If EXTENSION is any other symbol, it is ignored."
  (or alist-sym
      (setq alist-sym 'ps-print-face-extension-alist))
  (let* ((background  (nth 2 face-extension))
	 (foreground  (nth 1 face-extension))
	 (face-name   (nth 0 face-extension))
	 (ps-face     (cdr (assq face-name (symbol-value alist-sym))))
	 (face-vector (or ps-face (vector 0 nil nil)))
	 (face-bit    (ps-extension-bit face-extension)))
    ;; extend face
    (aset face-vector 0 (if merge-p
			    (logior (aref face-vector 0) face-bit)
			  face-bit))
    (and (or (not merge-p) (and foreground (stringp foreground)))
	 (aset face-vector 1 foreground))
    (and (or (not merge-p) (and background (stringp background)))
	 (aset face-vector 2 background))
    ;; if face does not exist, insert it
    (or ps-face
	(set alist-sym (cons (cons face-name face-vector)
			     (symbol-value alist-sym))))))