comparison lispref/display.texi @ 46240:df64f9f41c5f

Add entries for face-attribute-relative-p, merge-face-attribute. Describe INHERIT argument to face-attribute function.
author Miles Bader <miles@gnu.org>
date Sun, 07 Jul 2002 23:43:25 +0000
parents 115fa2a7cd26
children fb42c0446cbf
comparison
equal deleted inserted replaced
46239:6d4eadedbff1 46240:df64f9f41c5f
1652 sets the attributes @code{:width}, @code{:weight} and @code{:underline} 1652 sets the attributes @code{:width}, @code{:weight} and @code{:underline}
1653 to the corresponding values. 1653 to the corresponding values.
1654 @end defun 1654 @end defun
1655 1655
1656 @tindex face-attribute 1656 @tindex face-attribute
1657 @defun face-attribute face attribute &optional frame 1657 @defun face-attribute face attribute &optional frame inherit
1658 This returns the value of the @var{attribute} attribute of face 1658 This returns the value of the @var{attribute} attribute of face
1659 @var{face} on @var{frame}. If @var{frame} is @code{nil}, 1659 @var{face} on @var{frame}. If @var{frame} is @code{nil},
1660 that means the selected frame (@pxref{Input Focus}). 1660 that means the selected frame (@pxref{Input Focus}).
1661 1661
1662 If @var{frame} is @code{t}, the value is the default for 1662 If @var{frame} is @code{t}, the value is the default for
1663 @var{face} for new frames. 1663 @var{face} for new frames.
1664
1665 If @var{inherit} is nil, only attributes directly defined by
1666 @var{face} are considered, so the return value may be
1667 @code{unspecified}, or a relative value. If @var{inherit} is non-nil,
1668 @var{face}'s definition of @var{attribute} is merged with the faces
1669 specified by its @code{:inherit} attribute; however the return value
1670 may still be @code{unspecified} or relative. If @var{inherit} is a
1671 face or a list of faces, then the result is further merged with that
1672 face (or faces), until it becomes specified and absolute.
1673
1674 To ensure that the return value is always specified and absolute, use
1675 a value of @code{default} for @var{inherit}; this will resolve any
1676 unspecified or relative values by merging with the @code{default} face
1677 (which is always completely specified).
1664 1678
1665 For example, 1679 For example,
1666 1680
1667 @example 1681 @example
1668 (face-attribute 'bold :weight) 1682 (face-attribute 'bold :weight)
1671 @end defun 1685 @end defun
1672 1686
1673 The functions above did not exist before Emacs 21. For compatibility 1687 The functions above did not exist before Emacs 21. For compatibility
1674 with older Emacs versions, you can use the following functions to set 1688 with older Emacs versions, you can use the following functions to set
1675 and examine the face attributes which existed in those versions. 1689 and examine the face attributes which existed in those versions.
1690
1691 @tindex face-attribute-relative-p
1692 @defun face-attribute-relative-p attribute value
1693 This function returns non-@code{nil} if @var{value}, when used as a
1694 the value of the face attribute @var{attribute}, is relative (that is,
1695 if it modifies an underlying or inherited value of @var{attribute}).
1696 @end defun
1697
1698 @tindex merge-face-attribute
1699 @defun merge-face-attribute attribute value1 value2
1700 If @var{value1} is a relative value for the face attribute
1701 @var{attribute}, returns it merged with the underlying value
1702 @var{value2}; otherwise, if @var{value1} is an absolute value for the
1703 face a attribute @var{attribute}, returns @var{value1} unchanged.
1704 @end defun
1676 1705
1677 @defun set-face-foreground face color &optional frame 1706 @defun set-face-foreground face color &optional frame
1678 @defunx set-face-background face color &optional frame 1707 @defunx set-face-background face color &optional frame
1679 These functions set the foreground (or background, respectively) color 1708 These functions set the foreground (or background, respectively) color
1680 of face @var{face} to @var{color}. The argument @var{color} should be a 1709 of face @var{face} to @var{color}. The argument @var{color} should be a