aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-01-08 11:46:04 +0000
committerChong Yidong2009-01-08 11:46:04 +0000
commitd466a866bf6f5cebc1b5b6b45451db79a270defb (patch)
treebb1fbf507ce6f1199b5a5f0d390f89db0b480368
parent6221c8db7cab421e94787157228e7d1ac395274d (diff)
downloademacs-d466a866bf6f5cebc1b5b6b45451db79a270defb.tar.gz
emacs-d466a866bf6f5cebc1b5b6b45451db79a270defb.zip
(Attribute Functions): Note that a function value :height is relative,
and that compatibility functions work by calling set-face-attribute. (Displaying Faces): Reorder list in order of increasing priority. (Face Remapping): New node. Content moved here from Displaying Faces. (Glyphs): Link to Face Functions.
-rw-r--r--doc/lispref/display.texi162
1 files changed, 82 insertions, 80 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 4cde977f15a..0625285603d 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -1786,6 +1786,7 @@ particular face name a special meaning in one frame if you wish.
1786* Face Attributes:: What is in a face? 1786* Face Attributes:: What is in a face?
1787* Attribute Functions:: Functions to examine and set face attributes. 1787* Attribute Functions:: Functions to examine and set face attributes.
1788* Displaying Faces:: How Emacs combines the faces specified for a character. 1788* Displaying Faces:: How Emacs combines the faces specified for a character.
1789* Face Remapping:: Remapping faces to alternative definitions.
1789* Font Selection:: Finding the best available font for a face. 1790* Font Selection:: Finding the best available font for a face.
1790* Face Functions:: How to define and examine faces. 1791* Face Functions:: How to define and examine faces.
1791* Auto Faces:: Hook for automatic face assignment. 1792* Auto Faces:: Hook for automatic face assignment.
@@ -2199,8 +2200,8 @@ it would modify, rather than completely override, any value that comes
2199from a subsequent face in the face list or that is inherited from 2200from a subsequent face in the face list or that is inherited from
2200another face. 2201another face.
2201 2202
2202@code{unspecified} is a relative value for all attributes. 2203@code{unspecified} is a relative value for all attributes. For
2203For @code{:height}, floating point values are also relative. 2204@code{:height}, floating point and function values are also relative.
2204 2205
2205For example: 2206For example:
2206 2207
@@ -2227,51 +2228,47 @@ face attribute @var{attribute}, returns @var{value1} unchanged.
2227@end defun 2228@end defun
2228 2229
2229 The following functions provide compatibility with Emacs 20 and 2230 The following functions provide compatibility with Emacs 20 and
2230below. They use values of @code{t} and @code{nil} for @var{frame} 2231below. They work by calling @code{set-face-attribute}. Values of
2232@code{t} and @code{nil} for their @var{frame} argument are handled
2231just like @code{set-face-attribute} and @code{face-attribute}. 2233just like @code{set-face-attribute} and @code{face-attribute}.
2232 2234
2233@defun set-face-foreground face color &optional frame 2235@defun set-face-foreground face color &optional frame
2234@defunx set-face-background face color &optional frame 2236@defunx set-face-background face color &optional frame
2235These functions set the foreground (or background, respectively) color 2237These functions set the @code{:foreground} attribute (or
2236of face @var{face} to @var{color}. The argument @var{color} should be 2238@code{:background} attribute, respectively) of @var{face} to
2237a string, the name of a color. 2239@var{color}.
2238@end defun 2240@end defun
2239 2241
2240@defun set-face-stipple face pattern &optional frame 2242@defun set-face-stipple face pattern &optional frame
2241This function sets the background stipple pattern of face @var{face} 2243This function sets the @code{:stipple} attribute of @var{face} to
2242to @var{pattern}. The argument PATTERN should be the name of a 2244@var{pattern}.
2243stipple pattern defined by the X server, or actual bitmap data
2244(@pxref{Face Attributes}), or `nil' meaning don't use stipple.
2245@end defun 2245@end defun
2246 2246
2247@defun set-face-font face font &optional frame 2247@defun set-face-font face font &optional frame
2248This function sets the font of face @var{face}. This actually sets 2248This function sets the @code{:font} attribute of @var{face} to
2249the attributes @code{:family}, @code{:width}, @code{:height},
2250@code{:weight}, and @code{:slant} according to the font name
2251@var{font}. 2249@var{font}.
2252@end defun 2250@end defun
2253 2251
2254@defun set-face-bold-p face bold-p &optional frame 2252@defun set-face-bold-p face bold-p &optional frame
2255This function specifies whether @var{face} should be bold. If 2253This function sets the @code{:weight} attribute of @var{face} to
2256@var{bold-p} is non-@code{nil}, that means yes; @code{nil} means no. 2254@var{normal} if @var{bold-p} is @code{nil}, and to @var{bold}
2257This actually sets the @code{:weight} attribute. 2255otherwise.
2258@end defun 2256@end defun
2259 2257
2260@defun set-face-italic-p face italic-p &optional frame 2258@defun set-face-italic-p face italic-p &optional frame
2261This function specifies whether @var{face} should be italic. If 2259This function sets the @code{:slant} attribute of @var{face} to
2262@var{italic-p} is non-@code{nil}, that means yes; @code{nil} means no. 2260@var{normal} if @var{italic-p} is @code{nil}, and to @var{italic}
2263This actually sets the @code{:slant} attribute. 2261otherwise.
2264@end defun 2262@end defun
2265 2263
2266@defun set-face-underline-p face underline &optional frame 2264@defun set-face-underline-p face underline &optional frame
2267This function sets the underline attribute of face @var{face}. 2265This function sets the @code{:underline} attribute of @var{face} to
2268Non-@code{nil} means do underline; @code{nil} means don't. 2266@var{underline}.
2269If @var{underline} is a string, underline with that color.
2270@end defun 2267@end defun
2271 2268
2272@defun set-face-inverse-video-p face inverse-video-p &optional frame 2269@defun set-face-inverse-video-p face inverse-video-p &optional frame
2273This function sets the @code{:inverse-video} attribute of face 2270This function sets the @code{:inverse-video} attribute of @var{face}
2274@var{face}. 2271to @var{inverse-video-p}.
2275@end defun 2272@end defun
2276 2273
2277@defun invert-face face &optional frame 2274@defun invert-face face &optional frame
@@ -2279,9 +2276,9 @@ This function swaps the foreground and background colors of face
2279@var{face}. 2276@var{face}.
2280@end defun 2277@end defun
2281 2278
2282 These functions examine the attributes of a face. If you don't 2279 The following functions examine the attributes of a face. If you
2283specify @var{frame}, they refer to the selected frame; @code{t} refers 2280don't specify @var{frame}, they refer to the selected frame; @code{t}
2284to the default data for new frames. They return the symbol 2281refers to the default data for new frames. They return the symbol
2285@code{unspecified} if the face doesn't define any value for that 2282@code{unspecified} if the face doesn't define any value for that
2286attribute. 2283attribute.
2287 2284
@@ -2316,12 +2313,15 @@ This function returns the name of the font of face @var{face}.
2316@end defun 2313@end defun
2317 2314
2318@defun face-bold-p face &optional frame 2315@defun face-bold-p face &optional frame
2319This function returns @code{t} if @var{face} is bold---that is, if it is 2316This function returns a non-@code{nil} value if the @code{:weight}
2320bolder than normal. It returns @code{nil} otherwise. 2317attribute of @var{face} is bolder than normal (i.e., one of
2318@code{semi-bold}, @code{bold}, @code{extra-bold}, or
2319@code{ultra-bold}). Otherwise, it returns @code{nil}.
2321@end defun 2320@end defun
2322 2321
2323@defun face-italic-p face &optional frame 2322@defun face-italic-p face &optional frame
2324This function returns @code{t} if @var{face} is italic or oblique, 2323This function returns a non-@code{nil} value if the @code{:slant}
2324attribute of @var{face} is @code{italic} or @code{oblique}, and
2325@code{nil} otherwise. 2325@code{nil} otherwise.
2326@end defun 2326@end defun
2327 2327
@@ -2336,69 +2336,74 @@ This function returns the @code{:inverse-video} attribute of face @var{face}.
2336@node Displaying Faces 2336@node Displaying Faces
2337@subsection Displaying Faces 2337@subsection Displaying Faces
2338 2338
2339 Here are the ways to specify which faces to use for display of text: 2339 Here is how Emacs determines the face to use for displaying any
2340given piece of text:
2340 2341
2341@itemize @bullet 2342@itemize @bullet
2342@item 2343@item
2343With defaults. The @code{default} face is used as the ultimate 2344If the text consists of a special glyph, the glyph can specify a
2344default for all text. (In Emacs 19 and 20, the @code{default} 2345particular face. @xref{Glyphs}.
2345face is used only when no other face is specified.)
2346 2346
2347@item 2347@item
2348For a mode line or header line, the face @code{mode-line} or 2348If the text lies within an active region, Emacs highlights it using
2349@code{mode-line-inactive}, or @code{header-line}, is merged in just 2349the @code{region} face. @xref{Standard Faces,,, emacs, The GNU Emacs
2350before @code{default}. 2350Manual}.
2351 2351
2352@item 2352@item
2353With text properties. A character can have a @code{face} property; if 2353If the text lies within an overlay with a non-@code{nil} @code{face}
2354so, the faces and face attributes specified there apply. @xref{Special 2354property, Emacs applies the face or face attributes specified by that
2355Properties}. 2355property. If the overlay has a @code{mouse-face} property and the
2356mouse is ``near enough'' to the overlay, Emacs applies the face or
2357face attributes specified by the @code{mouse-face} property instead.
2358@xref{Overlay Properties}.
2356 2359
2357If the character has a @code{mouse-face} property, that is used instead 2360When multiple overlays cover one character, an overlay with higher
2358of the @code{face} property when the mouse is ``near enough'' to the 2361priority overrides those with lower priority. @xref{Overlays}.
2359character.
2360 2362
2361@item 2363@item
2362With overlays. An overlay can have @code{face} and @code{mouse-face} 2364If the text contains a @code{face} or @code{mouse-face} property,
2363properties too; they apply to all the text covered by the overlay. 2365Emacs applies the specified faces and face attributes. @xref{Special
2366Properties}. (This is how Font Lock mode faces are applied.
2367@xref{Font Lock Mode}.)
2364 2368
2365@item 2369@item
2366With a region that is active. In Transient Mark mode, the region is 2370If the text lies within the mode line of the selected window, Emacs
2367highlighted with the face @code{region} (@pxref{Standard Faces,,, 2371applies the @code{mode-line} face. For the mode line of a
2368emacs, The GNU Emacs Manual}). 2372non-selected window, Emacs applies the @code{mode-line-inactive} face.
2373For a header line, Emacs applies the @code{header-line} face.
2369 2374
2370@item 2375@item
2371With special glyphs. Each glyph can specify a particular face 2376If any given attribute has not been specified during the preceding
2372number. @xref{Glyphs}. 2377steps, Emacs applies the attribute of the @code{default} face.
2373@end itemize 2378@end itemize
2374 2379
2375 If these various sources together specify more than one face for a 2380 If these various sources together specify more than one face for a
2376particular character, Emacs merges the attributes of the various faces 2381particular character, Emacs merges the attributes of the various faces
2377specified. For each attribute, Emacs tries first the face of any 2382specified. For each attribute, Emacs tries using the above order
2378special glyph; then the face for region highlighting, if appropriate; 2383(i.e., first the face of any special glyph; then the face for region
2379then the faces specified by overlays, followed by those specified by 2384highlighting, if appropriate; then faces specified by overlays, then
2380text properties, then the @code{mode-line} or 2385faces specified by text properties, then the @code{mode-line} or
2381@code{mode-line-inactive} or @code{header-line} face (if in a mode 2386@code{mode-line-inactive} or @code{header-line} face, if appropriate,
2382line or a header line), and last the @code{default} face. 2387and finally the @code{default} face).
2383
2384 When multiple overlays cover one character, an overlay with higher
2385priority overrides those with lower priority. @xref{Overlays}.
2386 2388
2387@defvar face-remapping-alist 2389@node Face Remapping
2388 This variable is used for buffer-local or global changes in the 2390@subsection Face Remapping
2389appearance of a face, for instance making the @code{default} face a
2390variable-pitch face in a particular buffer.
2391 2391
2392 Its value should be an alist, whose elements have the form 2392 The variable @code{face-remapping-alist} is used for buffer-local or
2393@code{(@var{face} @var{remapping...})}. This causes Emacs to display 2393global changes in the appearance of a face. For instance, it can be
2394text using the face @var{face} using @var{remapping...} instead of 2394used to make the @code{default} face a variable-pitch face within a
2395@var{face}'s global definition. @var{remapping...} may be any face 2395particular buffer.
2396specification suitable for a @code{face} text property, usually a face
2397name, but also perhaps a property list of face attribute/value pairs.
2398@xref{Special Properties}.
2399 2396
2400 To affect display only in a single buffer, 2397@defvar face-remapping-alist
2401@code{face-remapping-alist} should be made buffer-local. 2398An alist whose elements have the form @code{(@var{face}
2399@var{remapping...})}. This causes Emacs to display text using the
2400face @var{face} using @var{remapping...} instead of @var{face}'s
2401ordinary definition. @var{remapping...} may be any face specification
2402suitable for a @code{face} text property: either a face name, or a
2403property list of attribute/value pairs. @xref{Special Properties}.
2404
2405If @code{face-remapping-alist} is buffer-local, its local value takes
2406effect only within that buffer.
2402 2407
2403Two points bear emphasizing: 2408Two points bear emphasizing:
2404 2409
@@ -2426,6 +2431,7 @@ then the new definition of the @code{mode-line} face inherits from the
2426@code{italic} face, and the @emph{normal} (non-remapped) definition of 2431@code{italic} face, and the @emph{normal} (non-remapped) definition of
2427@code{mode-line} face. 2432@code{mode-line} face.
2428@end enumerate 2433@end enumerate
2434@end defvar
2429 2435
2430 A typical use of the @code{face-remapping-alist} is to change a 2436 A typical use of the @code{face-remapping-alist} is to change a
2431buffer's @code{default} face; for example, the following changes a 2437buffer's @code{default} face; for example, the following changes a
@@ -2437,17 +2443,12 @@ with the height doubled:
2437 '((default variable-pitch :height 2.0))) 2443 '((default variable-pitch :height 2.0)))
2438@end example 2444@end example
2439 2445
2440@end defvar 2446 The following functions implement a higher-level interface to
2441
2442@noindent
2443The following functions implement a somewhat higher-level interface to
2444@code{face-remapping-alist}, making it easier to use 2447@code{face-remapping-alist}, making it easier to use
2445``cooperatively''. They are mainly intended for buffer-local use, and 2448``cooperatively''. They are mainly intended for buffer-local use, and
2446so all make @code{face-remapping-alist} variable buffer-local as a 2449so all make @code{face-remapping-alist} variable buffer-local as a
2447side-effect. 2450side-effect. They use entries in @code{face-remapping-alist} which
2448 2451have the general form:
2449These functions use entries in @code{face-remapping-alist} which have
2450the general form:
2451 2452
2452@example 2453@example
2453 (@var{face} @var{relative_specs_1} @var{relative_specs_2} @var{...} @var{base_specs}) 2454 (@var{face} @var{relative_specs_1} @var{relative_specs_2} @var{...} @var{base_specs})
@@ -5546,6 +5547,7 @@ This function returns the character of simple glyph code @var{glyph}.
5546@defun glyph-face glyph 5547@defun glyph-face glyph
5547This function returns face of simple glyph code @var{glyph}, or 5548This function returns face of simple glyph code @var{glyph}, or
5548@code{nil} if @var{glyph} has the default face (face-id 0). 5549@code{nil} if @var{glyph} has the default face (face-id 0).
5550@xref{Face Functions}.
5549@end defun 5551@end defun
5550 5552
5551 On character terminals, you can set up a @dfn{glyph table} to define 5553 On character terminals, you can set up a @dfn{glyph table} to define