aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-01-08 01:19:44 +0000
committerChong Yidong2009-01-08 01:19:44 +0000
commit42a2a154142f296d056132c982f1f41ba265c847 (patch)
treed4e530566a4e9da6eb9d057f088e33b0a4322de0
parente3d3799a7134dbbe9cb05f35499c3634c339b1f5 (diff)
downloademacs-42a2a154142f296d056132c982f1f41ba265c847.tar.gz
emacs-42a2a154142f296d056132c982f1f41ba265c847.zip
(Faces): Don't discuss face id here. facep does
not return t. (Defining Faces): Minor clarification. (Face Attributes): Rearrange items to match docstring of set-face-attribute. Add :foundry attribute. Document new role of :font attribute. Texinfo usage fix. (Attribute Functions): Copyedits. (Face Functions): Note that face number is seldom used.
-rw-r--r--doc/lispref/display.texi291
1 files changed, 139 insertions, 152 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 25b29b2ec01..4c23c04a164 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -1760,26 +1760,26 @@ height.
1760@section Faces 1760@section Faces
1761@cindex faces 1761@cindex faces
1762 1762
1763 A @dfn{face} is a named collection of graphical attributes: font 1763 A @dfn{face} is a collection of graphical attributes for displaying
1764family, foreground color, background color, optional underlining, and 1764text: font family, foreground color, background color, optional
1765many others. Faces are used in Emacs to control the style of display of 1765underlining, and so on. Faces control how buffer text is displayed,
1766particular parts of the text or the frame. @xref{Standard Faces,,, 1766and how some parts of the frame, such as the mode-line, are displayed.
1767emacs, The GNU Emacs Manual}, for the list of faces Emacs normally 1767@xref{Standard Faces,,, emacs, The GNU Emacs Manual}, for the list of
1768comes with. 1768faces Emacs normally comes with.
1769 1769
1770@cindex face id 1770@cindex face id
1771Each face has its own @dfn{face number}, which distinguishes faces at 1771 For most purposes, you refer to a face in Lisp programs using its
1772low levels within Emacs. However, for most purposes, you refer to 1772@dfn{face name}. This is either a string or (equivalently) a Lisp
1773faces in Lisp programs by the symbols that name them. 1773symbol whose name is equal to that string.
1774 1774
1775@defun facep object 1775@defun facep object
1776This function returns @code{t} if @var{object} is a face name string 1776This function returns a non-@code{nil} value if @var{object} is a Lisp
1777or symbol. It returns @code{nil} otherwise. 1777symbol or string that names a face. Otherwise, it returns @code{nil}.
1778@end defun 1778@end defun
1779 1779
1780Each face name is meaningful for all frames, and by default it has the 1780 Each face name is meaningful for all frames, and by default it has
1781same meaning in all frames. But you can arrange to give a particular 1781the same meaning in all frames. But you can arrange to give a
1782face name a special meaning in one frame if you wish. 1782particular face name a special meaning in one frame if you wish.
1783 1783
1784@menu 1784@menu
1785* Defining Faces:: How to define a face with @code{defface}. 1785* Defining Faces:: How to define a face with @code{defface}.
@@ -1809,12 +1809,12 @@ majority of cases, this is not necessary, and simply using faces
1809directly is preferable. 1809directly is preferable.
1810 1810
1811@defmac defface face spec doc [keyword value]@dots{} 1811@defmac defface face spec doc [keyword value]@dots{}
1812This declares @var{face} as a customizable face that defaults 1812This declares @var{face} as a customizable face whose default
1813according to @var{spec}. You should not quote the symbol @var{face}, 1813attributes are given by @var{spec}. You should not quote the symbol
1814and it should not end in @samp{-face} (that would be redundant). The 1814@var{face}, and it should not end in @samp{-face} (that would be
1815argument @var{doc} specifies the face documentation. The keywords you 1815redundant). The argument @var{doc} specifies the face documentation.
1816can use in @code{defface} are the same as in @code{defgroup} and 1816The keywords you can use in @code{defface} are the same as in
1817@code{defcustom} (@pxref{Common Keywords}). 1817@code{defgroup} and @code{defcustom} (@pxref{Common Keywords}).
1818 1818
1819When @code{defface} executes, it defines the face according to 1819When @code{defface} executes, it defines the face according to
1820@var{spec}, then uses any customizations that were read from the 1820@var{spec}, then uses any customizations that were read from the
@@ -1882,10 +1882,9 @@ should support. This matches a frame if its
1882 1882
1883@item supports 1883@item supports
1884Whether or not the frame can display the face attributes given in 1884Whether or not the frame can display the face attributes given in
1885@var{value}@dots{} (@pxref{Face Attributes}). See the documentation 1885@var{value}@dots{} (@pxref{Face Attributes}). @xref{Display Face
1886for the function @code{display-supports-face-attributes-p} for more 1886Attribute Testing}, for more information on exactly how this testing
1887information on exactly how this testing is done. @xref{Display Face 1887is done.
1888Attribute Testing}.
1889@end table 1888@end table
1890 1889
1891If an element of @var{display} specifies more than one @var{value} for a 1890If an element of @var{display} specifies more than one @var{value} for a
@@ -1923,11 +1922,13 @@ frame must match one of the @var{value}s specified for it in
1923@end example 1922@end example
1924 1923
1925 Internally, @code{defface} uses the symbol property 1924 Internally, @code{defface} uses the symbol property
1926@code{face-defface-spec} to record the face attributes specified in 1925@code{face-defface-spec} to record the specified face attributes. The
1927@code{defface}, @code{saved-face} for the attributes saved by the user 1926attributes saved by the user with the customization buffer are
1928with the customization buffer, @code{customized-face} for the 1927recorded in the symbol property @code{saved-face}; the attributes
1929attributes customized by the user for the current session, but not 1928customized by the user for the current session, but not saved, are
1930saved, and @code{face-documentation} for the documentation string. 1929recorded in the symbol property @code{customized-face}. The
1930documentation string is recorded in the symbol property
1931@code{face-documentation}.
1931 1932
1932@defopt frame-background-mode 1933@defopt frame-background-mode
1933This option, if non-@code{nil}, specifies the background type to use for 1934This option, if non-@code{nil}, specifies the background type to use for
@@ -1942,92 +1943,74 @@ as if they had a light background.
1942@cindex face attributes 1943@cindex face attributes
1943 1944
1944 The effect of using a face is determined by a fixed set of @dfn{face 1945 The effect of using a face is determined by a fixed set of @dfn{face
1945attributes}. This table lists all the face attributes, and what they 1946attributes}. This table lists all the face attributes, their possible
1946mean. You can specify more than one face for a given piece of text; 1947values, and their effects. You can specify more than one face for a
1947Emacs merges the attributes of all the faces to determine how to 1948given piece of text; Emacs merges the attributes of all the faces to
1948display the text. @xref{Displaying Faces}. 1949determine how to display the text. @xref{Displaying Faces}.
1949 1950
1950 Any attribute in a face can have the value @code{unspecified}. This 1951 In addition to the values given below, each face attribute can also
1951means the face doesn't specify that attribute. In face merging, when 1952have the value @code{unspecified}. This special value means the face
1952the first face fails to specify a particular attribute, that means the 1953doesn't specify that attribute. In face merging, when the first face
1953next face gets a chance. However, the @code{default} face must 1954fails to specify a particular attribute, the next face gets a chance.
1954specify all attributes. 1955However, the @code{default} face must specify all attributes.
1955 1956
1956 Some of these font attributes are meaningful only on certain kinds of 1957 Some of these font attributes are meaningful only on certain kinds
1957displays---if your display cannot handle a certain attribute, the 1958of displays. If your display cannot handle a certain attribute, the
1958attribute is ignored. (The attributes @code{:family}, @code{:width}, 1959attribute is ignored.
1959@code{:height}, @code{:weight}, and @code{:slant} correspond to parts of
1960an X Logical Font Descriptor.)
1961 1960
1962@table @code 1961@table @code
1963@item :family 1962@item :family
1964Font family name, or fontset name (@pxref{Fontsets}). If you specify a 1963Font family name (@pxref{Font Lookup}), or fontset name
1965font family name, the wild-card characters @samp{*} and @samp{?} are 1964(@pxref{Fontsets}). If you specify a font family name, the wild-card
1966allowed. 1965characters @samp{*} and @samp{?} are allowed. @xref{Font Lookup}.
1966
1967@item :foundry
1968The @dfn{font foundry} in which the font family specified by the
1969@code{:family} attribute is located. The wild-card characters
1970@samp{*} and @samp{?} are allowed. @xref{Font Lookup}.
1967 1971
1968@item :width 1972@item :width
1969Relative proportionate width, also known as the character set width or 1973Relative proportionate character width, also known as the character
1970set width. This should be one of the symbols @code{ultra-condensed}, 1974set width. This should be one of the symbols @code{ultra-condensed},
1971@code{extra-condensed}, @code{condensed}, @code{semi-condensed}, 1975@code{extra-condensed}, @code{condensed}, @code{semi-condensed},
1972@code{normal}, @code{semi-expanded}, @code{expanded}, 1976@code{normal}, @code{semi-expanded}, @code{expanded},
1973@code{extra-expanded}, or @code{ultra-expanded}. 1977@code{extra-expanded}, or @code{ultra-expanded}.
1974 1978
1975@item :height 1979@item :height
1976Either the font height, an integer in units of 1/10 point, a floating 1980Font height---either an integer in units of 1/10 point, or a floating
1977point number specifying the amount by which to scale the height of any 1981point number specifying the amount by which to scale the height of any
1978underlying face, or a function, which is called with the old height 1982underlying face, or a function that is called with one argument (the
1979(from the underlying face), and should return the new height. 1983height of the underlying face) and returns the height of the new face.
1984If the function is passed an integer argument, it must return an
1985integer.
1986
1987The height of the default face must be specified using an integer;
1988floating point and function values are not allowed.
1980 1989
1981@item :weight 1990@item :weight
1982Font weight---a symbol from this series (from most dense to most faint): 1991Font weight---one of the symbols (from densest to faintest)
1983@code{ultra-bold}, @code{extra-bold}, @code{bold}, @code{semi-bold}, 1992@code{ultra-bold}, @code{extra-bold}, @code{bold}, @code{semi-bold},
1984@code{normal}, @code{semi-light}, @code{light}, @code{extra-light}, 1993@code{normal}, @code{semi-light}, @code{light}, @code{extra-light}, or
1985or @code{ultra-light}. 1994@code{ultra-light}. On text-only terminals that support
1986 1995variable-brightness text, any weight greater than normal is displayed
1987On a text-only terminal, any weight greater than normal is displayed as 1996as extra bright, and any weight less than normal is displayed as
1988extra bright, and any weight less than normal is displayed as 1997half-bright.
1989half-bright (provided the terminal supports the feature).
1990 1998
1991@item :slant 1999@item :slant
1992Font slant---one of the symbols @code{italic}, @code{oblique}, @code{normal}, 2000Font slant---one of the symbols @code{italic}, @code{oblique},
1993@code{reverse-italic}, or @code{reverse-oblique}. 2001@code{normal}, @code{reverse-italic}, or @code{reverse-oblique}. On
1994 2002text-only terminals that support variable-brightness text, slanted
1995On a text-only terminal, slanted text is displayed as half-bright, if 2003text is displayed as half-bright.
1996the terminal supports the feature.
1997 2004
1998@item :foreground 2005@item :foreground
1999Foreground color, a string. The value can be a system-defined color 2006Foreground color, a string. The value can be a system-defined color
2000name, or a hexadecimal color specification of the form 2007name, or a hexadecimal color specification. @xref{Color Names}. On
2001@samp{#@var{rr}@var{gg}@var{bb}}. (@samp{#000000} is black, 2008black-and-white displays, certain shades of gray are implemented by
2002@samp{#ff0000} is red, @samp{#00ff00} is green, @samp{#0000ff} is 2009stipple patterns.
2003blue, and @samp{#ffffff} is white.)
2004 2010
2005@item :background 2011@item :background
2006Background color, a string, like the foreground color. 2012Background color, a string. The value can be a system-defined color
2007 2013name, or a hexadecimal color specification. @xref{Color Names}.
2008@item :inverse-video
2009Whether or not characters should be displayed in inverse video. The
2010value should be @code{t} (yes) or @code{nil} (no).
2011
2012@item :stipple
2013The background stipple, a bitmap.
2014
2015The value can be a string; that should be the name of a file containing
2016external-format X bitmap data. The file is found in the directories
2017listed in the variable @code{x-bitmap-file-path}.
2018
2019Alternatively, the value can specify the bitmap directly, with a list
2020of the form @code{(@var{width} @var{height} @var{data})}. Here,
2021@var{width} and @var{height} specify the size in pixels, and
2022@var{data} is a string containing the raw bits of the bitmap, row by
2023row. Each row occupies @math{(@var{width} + 7) / 8} consecutive bytes
2024in the string (which should be a unibyte string for best results).
2025This means that each row always occupies at least one whole byte.
2026
2027If the value is @code{nil}, that means use no stipple pattern.
2028
2029Normally you do not need to set the stipple attribute, because it is
2030used automatically to handle certain shades of gray.
2031 2014
2032@item :underline 2015@item :underline
2033Whether or not characters should be underlined, and in what color. If 2016Whether or not characters should be underlined, and in what color. If
@@ -2043,20 +2026,10 @@ The value is used like that of @code{:underline}.
2043Whether or not characters should be strike-through, and in what 2026Whether or not characters should be strike-through, and in what
2044color. The value is used like that of @code{:underline}. 2027color. The value is used like that of @code{:underline}.
2045 2028
2046@item :inherit
2047The name of a face from which to inherit attributes, or a list of face
2048names. Attributes from inherited faces are merged into the face like an
2049underlying face would be, with higher priority than underlying faces.
2050If a list of faces is used, attributes from faces earlier in the list
2051override those from later faces.
2052
2053@item :box 2029@item :box
2054Whether or not a box should be drawn around characters, its color, the 2030Whether or not a box should be drawn around characters, its color, the
2055width of the box lines, and 3D appearance. 2031width of the box lines, and 3D appearance. Here are the possible
2056@end table 2032values of the @code{:box} attribute, and what they mean:
2057
2058 Here are the possible values of the @code{:box} attribute, and what
2059they mean:
2060 2033
2061@table @asis 2034@table @asis
2062@item @code{nil} 2035@item @code{nil}
@@ -2083,43 +2056,63 @@ that is being pressed. If it is @code{nil} or omitted, a plain 2D box
2083is used. 2056is used.
2084@end table 2057@end table
2085 2058
2086 In older versions of Emacs, before @code{:family}, @code{:height}, 2059@item :inverse-video
2087@code{:width}, @code{:weight}, and @code{:slant} existed, these 2060Whether or not characters should be displayed in inverse video. The
2088attributes were used to specify the type face. They are now 2061value should be @code{t} (yes) or @code{nil} (no).
2089semi-obsolete, but they still work:
2090
2091@table @code
2092@item :font
2093This attribute specifies the font name.
2094 2062
2095@item :bold 2063@item :stipple
2096A non-@code{nil} value specifies a bold font. 2064The background stipple, a bitmap.
2097 2065
2098@item :italic 2066The value can be a string; that should be the name of a file containing
2099A non-@code{nil} value specifies an italic font. 2067external-format X bitmap data. The file is found in the directories
2100@end table 2068listed in the variable @code{x-bitmap-file-path}.
2101 2069
2102 For compatibility, you can still set these ``attributes,'' even 2070Alternatively, the value can specify the bitmap directly, with a list
2103though they are not real face attributes. Here is what that does: 2071of the form @code{(@var{width} @var{height} @var{data})}. Here,
2072@var{width} and @var{height} specify the size in pixels, and
2073@var{data} is a string containing the raw bits of the bitmap, row by
2074row. Each row occupies @math{(@var{width} + 7) / 8} consecutive bytes
2075in the string (which should be a unibyte string for best results).
2076This means that each row always occupies at least one whole byte.
2104 2077
2105@table @code 2078If the value is @code{nil}, that means use no stipple pattern.
2106@item :font
2107You can specify an X font name as the ``value'' of this ``attribute'';
2108that sets the @code{:family}, @code{:width}, @code{:height},
2109@code{:weight}, and @code{:slant} attributes according to the font name.
2110 2079
2111If the value is a pattern with wildcards, the first font that matches 2080Normally you do not need to set the stipple attribute, because it is
2112the pattern is used to set these attributes. 2081used automatically to handle certain shades of gray.
2113 2082
2114@item :bold 2083@item :font
2115A non-@code{nil} makes the face bold; @code{nil} makes it normal. 2084The font used to display the face. Its value should be a font object
2116This actually works by setting the @code{:weight} attribute. 2085(@pxref{Font Lookup}).
2086
2087When specifying this attribute using @code{set-face-attribute}
2088(@pxref{Attribute Functions}), you may supply a font spec, a font
2089entity, or a string. Emacs converts such values to an appropriate
2090font object, and stores that font object internally. If you specify a
2091string, the contents of the string should be an XLFD font name
2092(@pxref{Font X,, Font Specification Options, emacs, The GNU Emacs
2093Manual}); if the XLFD contains wildcards, Emacs chooses the first font
2094matching those wildcards. Specifying this attribute also changes the
2095values of the @code{:family}, @code{:foundry}, @code{:width},
2096@code{:height}, @code{:weight}, and @code{:slant} attributes.
2117 2097
2118@item :italic 2098@item :inherit
2119A non-@code{nil} makes the face italic; @code{nil} makes it normal. 2099The name of a face from which to inherit attributes, or a list of face
2120This actually works by setting the @code{:slant} attribute. 2100names. Attributes from inherited faces are merged into the face like
2101an underlying face would be, with higher priority than underlying
2102faces. If a list of faces is used, attributes from faces earlier in
2103the list override those from later faces.
2121@end table 2104@end table
2122 2105
2106For compatibility with Emacs 20, you can also specify values for two
2107``fake'' face attributes: @code{:bold} and @code{:italic}. Their
2108values must be either @code{t} or @code{nil}; a value of
2109@code{unspecified} is not allowed. Setting @code{:bold} to @code{t}
2110is equivalent to setting the @code{:weight} attribute to @code{bold},
2111and setting it to @code{nil} is equivalent to setting @code{:weight}
2112to @code{normal}. Setting @code{:italic} to @code{t} is equivalent to
2113setting the @code{:slant} attribute to @code{italic}, and setting it
2114to @code{nil} is equivalent to setting @code{:slant} to @code{normal}.
2115
2123@defvar x-bitmap-file-path 2116@defvar x-bitmap-file-path
2124This variable specifies a list of directories for searching 2117This variable specifies a list of directories for searching
2125for bitmap files, for the @code{:stipple} attribute. 2118for bitmap files, for the @code{:stipple} attribute.
@@ -2138,7 +2131,7 @@ suitable for use with @code{:stipple} (see above). It returns
2138attributes of an existing face. 2131attributes of an existing face.
2139 2132
2140@defun set-face-attribute face frame &rest arguments 2133@defun set-face-attribute face frame &rest arguments
2141This function sets one or more attributes of face @var{face} for frame 2134This function sets one or more attributes of @var{face} for
2142@var{frame}. The attributes you specify this way override whatever 2135@var{frame}. The attributes you specify this way override whatever
2143the @code{defface} says. 2136the @code{defface} says.
2144 2137
@@ -2167,9 +2160,9 @@ all existing frames, and the default for new frames.
2167@end defun 2160@end defun
2168 2161
2169@defun face-attribute face attribute &optional frame inherit 2162@defun face-attribute face attribute &optional frame inherit
2170This returns the value of the @var{attribute} attribute of face 2163This returns the value of the @var{attribute} attribute of @var{face}
2171@var{face} on @var{frame}. If @var{frame} is @code{nil}, 2164on @var{frame}. If @var{frame} is @code{nil}, that means the selected
2172that means the selected frame (@pxref{Input Focus}). 2165frame (@pxref{Input Focus}).
2173 2166
2174If @var{frame} is @code{t}, this returns whatever new-frames default 2167If @var{frame} is @code{t}, this returns whatever new-frames default
2175value you previously specified with @code{set-face-attribute} for the 2168value you previously specified with @code{set-face-attribute} for the
@@ -2233,30 +2226,22 @@ If @var{value1} is a relative value for the face attribute
2233face attribute @var{attribute}, returns @var{value1} unchanged. 2226face attribute @var{attribute}, returns @var{value1} unchanged.
2234@end defun 2227@end defun
2235 2228
2236 The functions above did not exist before Emacs 21. For compatibility 2229 The following functions provide compatibility with Emacs 20 and
2237with older Emacs versions, you can use the following functions to set 2230below. They use values of @code{t} and @code{nil} for @var{frame}
2238and examine the face attributes which existed in those versions.
2239They use values of @code{t} and @code{nil} for @var{frame}
2240just like @code{set-face-attribute} and @code{face-attribute}. 2231just like @code{set-face-attribute} and @code{face-attribute}.
2241 2232
2242@defun set-face-foreground face color &optional frame 2233@defun set-face-foreground face color &optional frame
2243@defunx set-face-background face color &optional frame 2234@defunx set-face-background face color &optional frame
2244These functions set the foreground (or background, respectively) color 2235These functions set the foreground (or background, respectively) color
2245of face @var{face} to @var{color}. The argument @var{color} should be a 2236of face @var{face} to @var{color}. The argument @var{color} should be
2246string, the name of a color. 2237a string, the name of a color.
2247
2248Certain shades of gray are implemented by stipple patterns on
2249black-and-white screens.
2250@end defun 2238@end defun
2251 2239
2252@defun set-face-stipple face pattern &optional frame 2240@defun set-face-stipple face pattern &optional frame
2253This function sets the background stipple pattern of face @var{face} 2241This function sets the background stipple pattern of face @var{face}
2254to @var{pattern}. The argument @var{pattern} should be the name of a 2242to @var{pattern}. The argument PATTERN should be the name of a
2255stipple pattern defined by the X server, or actual bitmap data 2243stipple pattern defined by the X server, or actual bitmap data
2256(@pxref{Face Attributes}), or @code{nil} meaning don't use stipple. 2244(@pxref{Face Attributes}), or `nil' meaning don't use stipple.
2257
2258Normally there is no need to pay attention to stipple patterns, because
2259they are used automatically to handle certain shades of gray.
2260@end defun 2245@end defun
2261 2246
2262@defun set-face-font face font &optional frame 2247@defun set-face-font face font &optional frame
@@ -2672,7 +2657,9 @@ in @var{new-frame}.
2672@end defun 2657@end defun
2673 2658
2674@defun face-id face 2659@defun face-id face
2675This function returns the face number of face @var{face}. 2660This function returns the @dfn{face number} of face @var{face}. This
2661is a number that uniquely identifies a face at low levels within
2662Emacs. It is seldom necessary to refer to a face by its face number.
2676@end defun 2663@end defun
2677 2664
2678@defun face-documentation face 2665@defun face-documentation face