# HG changeset patch # User Miles Bader # Date 1023760215 0 # Node ID 75e9d527da2b68f97415d13401468f4f9b3a47f2 # Parent 9f2bfbcfdb414e58100875c20a1caead9626b86d display-supports-face-attributes-p diff -r 9f2bfbcfdb41 -r 75e9d527da2b etc/NEWS --- a/etc/NEWS Mon Jun 10 09:04:34 2002 +0000 +++ b/etc/NEWS Tue Jun 11 01:50:15 2002 +0000 @@ -1000,6 +1000,13 @@ ** New function insert-buffer-substring-no-properties. +** New function display-supports-face-attributes-p may be used to test +whether a given set of face attributes is actually displayable. + +A new predicate `supports' has also been added to the `defface' face +specification language, which can be used to do this test for faces +defined with defface. + ** Enhanced networking support. *** There is a new `make-network-process' function which supports diff -r 9f2bfbcfdb41 -r 75e9d527da2b lispref/frames.texi --- a/lispref/frames.texi Mon Jun 10 09:04:34 2002 +0000 +++ b/lispref/frames.texi Tue Jun 11 01:50:15 2002 +0000 @@ -1,6 +1,6 @@ @c -*-texinfo-*- @c This is part of the GNU Emacs Lisp Reference Manual. -@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 +@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2002 @c Free Software Foundation, Inc. @c See the file elisp.texi for copying conditions. @setfilename ../info/frames @@ -1717,6 +1717,33 @@ (All color displays can do this.) @end defun +@anchor{Display Face Attribute Testing} +@defun display-supports-face-attributes-p attributes &optional display +@tindex display-supports-face-attributes-p +This function returns non-@code{nil} if all the face attributes in +@var{attributes} are supported (@pxref{Face Attributes}). + +The definition of `supported' is somewhat heuristic, but basically +means that a face containing all the attributes in @var{attributes}, +when merged with the default face for display, can be represented in a +way that's + +@enumerate +@item +different in appearance than the default face, and + +@item +`close in spirit' to what the attributes specify, if not exact. +@end enumerate + +Point (2) implies that a @code{:weight black} attribute will be +satisfied by any display that can display bold, as will +@code{:foreground "yellow"} as long as some yellowish color can be +displayed, but @code{:slant italic} will @emph{not} be satisified by +the tty display code's automatic substitution of a `dim' face for +italic. +@end defun + @defun display-selections-p &optional display @tindex display-selections-p This function returns @code{t} if @var{display} supports selections.