comparison doc/lispref/display.texi @ 95515:328f63bafded

Add lisp/face-remap.el and associated documentation Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1200
author Miles Bader <miles@gnu.org>
date Tue, 03 Jun 2008 11:05:52 +0000
parents 415f68458e61
children 9145bbb09578
comparison
equal deleted inserted replaced
95514:ad40a2d6712f 95515:328f63bafded
2418 '((default variable-pitch :height 2.0))) 2418 '((default variable-pitch :height 2.0)))
2419 @end example 2419 @end example
2420 2420
2421 @end defvar 2421 @end defvar
2422 2422
2423 @noindent
2424 The following functions implement a somewhat higher-level interface to
2425 @code{face-remapping-alist}, making it easier to use
2426 ``cooperatively''. They are mainly intended for buffer-local use, and
2427 so all make @code{face-remapping-alist} variable buffer-local as a
2428 side-effect.
2429
2430 These functions use entries in @code{face-remapping-alist} which have
2431 the general form:
2432
2433 @example
2434 (@var{face} @var{relative_specs_1} @var{relative_specs_2} @var{...} @var{base_specs})
2435 @end example
2436
2437 Everything except the @var{face} is a ``face spec'', a list of face
2438 names or face attribute-value pairs. All face specs are merged
2439 together, with earlier values taking precedence.
2440
2441 The @var{relative_specs_}n values are ``relative specs'', and are
2442 added by @code{add-relative-face-remapping} (and removed by
2443 @code{remove-relative-face-remapping}. These are intended for face
2444 modifications (such as increasing the size). Typical users of these
2445 relative specs would be minor modes.
2446
2447 @var{base_specs} is the lowest-priority value, and by default is just the
2448 face name, which causes the global definition of that face to be used.
2449
2450 A non-default value of @var{base_specs} may also be set using
2451 @code{set-base-face-remapping}. Because this @emph{overwrites} the
2452 default base-spec value (which inherits the global face definition),
2453 it is up to the caller of @code{set-base-face-remapping} to add such
2454 inheritance if it is desired. A typical use of
2455 @code{set-base-face-remapping} would be a major mode adding a face
2456 remappings, e.g., of the default face.
2457
2458
2459 @defun add-relative-face-remapping face &rest specs
2460 This functions adds a face remapping entry of @var{face} to @var{specs}
2461 in the current buffer.
2462
2463 It returns a ``cookie'' which can be used to later delete the remapping with
2464 @code{remove-relative-face-remapping}.
2465
2466 @var{specs} can be any value suitable for the @code{face} text
2467 property, including a face name, a list of face names, or a
2468 face-attribute property list. The attributes given by @var{specs}
2469 will be merged with any other currently active face remappings of
2470 @var{face}, and with the global definition of @var{face} (by default;
2471 this may be changed using @code{set-base-face-remapping}),
2472 with the most recently added relative remapping taking precedence.
2473 @end defun
2474
2475 @defun remove-relative-face-remapping cookie
2476 This function removes a face remapping previously added by
2477 @code{add-relative-face-remapping}. @var{cookie} should be a return
2478 value from that function.
2479 @end defun
2480
2481 @defun set-base-face-remapping face &rest specs
2482 This function sets the ``base remapping'' of @var{face} in the current
2483 buffer to @var{specs}. If @var{specs} is empty, the default base
2484 remapping is restored, which inherits from the global definition of
2485 @var{face}; note that this is different from @var{specs} containing a
2486 single value @code{nil}, which has the opposite result (the global
2487 definition of @var{face} is ignored).
2488 @end defun
2489
2490 @defun set-default-base-face-remapping face
2491 This function sets the ``base remapping'' of @var{face} to its default
2492 value, which inherits from @var{face}'s global definition.
2493 @end defun
2494
2423 @node Font Selection 2495 @node Font Selection
2424 @subsection Font Selection 2496 @subsection Font Selection
2425 2497
2426 @dfn{Selecting a font} means mapping the specified face attributes for 2498 @dfn{Selecting a font} means mapping the specified face attributes for
2427 a character to a font that is available on a particular display. The 2499 a character to a font that is available on a particular display. The