Function: enriched-face-ans

enriched-face-ans is a byte-compiled function defined in enriched.el.gz.

Signature

(enriched-face-ans FACE)

Documentation

Return annotations specifying FACE.

FACE may be a list of faces instead of a single face; it can also be anything allowed as an element of a list which can be the value of the face text property.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/enriched.el.gz
(defun enriched-face-ans (face)
  "Return annotations specifying FACE.
FACE may be a list of faces instead of a single face;
it can also be anything allowed as an element of a list
which can be the value of the `face' text property."
  (cond ((and (consp face) (eq (car face) 'foreground-color))
	 (list (list "x-color" (cdr face))))
	((and (consp face) (eq (car face) 'background-color))
	 (list (list "x-bg-color" (cdr face))))
	((and (listp face) (eq (car face) :foreground))
	 (list (list "x-color" (cadr face))))
	((and (listp face) (eq (car face) :background))
	 (list (list "x-bg-color" (cadr face))))
	((listp face)
	 (apply #'append (mapcar #'enriched-face-ans face)))
	((let* ((fg (face-attribute face :foreground))
		(bg (face-attribute face :background))
                (weight (face-attribute face :weight))
                (slant (face-attribute face :slant))
		(props (face-font face t))
		(ans (cdr (format-annotate-single-property-change
			   'face nil props enriched-translations))))
	   (unless (eq fg 'unspecified)
	     (setq ans (cons (list "x-color" fg) ans)))
	   (unless (eq bg 'unspecified)
	     (setq ans (cons (list "x-bg-color" bg) ans)))
           (if (eq weight 'bold)
               (setq ans (cons (list "bold") ans)))
           (if (eq slant 'italic)
               (setq ans (cons (list "italic") ans)))
	   ans))))