diff options
| author | Chong Yidong | 2009-01-08 20:58:13 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-01-08 20:58:13 +0000 |
| commit | 9185bf498e6f594940f2913cdf93e60966af3523 (patch) | |
| tree | 9b1ffa412afebc4a620f1f5c1a826a004f4bf445 | |
| parent | 606061b9f7c8ec51d0d28648248695e4594f95e5 (diff) | |
| download | emacs-9185bf498e6f594940f2913cdf93e60966af3523.tar.gz emacs-9185bf498e6f594940f2913cdf93e60966af3523.zip | |
(Faces): Put Font Selection node after Auto Faces.
(Face Attributes): Don't link to Font Lookup. Document font-family-list.
(Fonts): New node.
| -rw-r--r-- | doc/lispref/display.texi | 421 |
1 files changed, 291 insertions, 130 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 0625285603d..bf034813277 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -1787,9 +1787,10 @@ particular face name a special meaning in one frame if you wish. | |||
| 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 | * Face Remapping:: Remapping faces to alternative definitions. |
| 1790 | * Font Selection:: Finding the best available font for a face. | ||
| 1791 | * Face Functions:: How to define and examine faces. | 1790 | * Face Functions:: How to define and examine faces. |
| 1792 | * Auto Faces:: Hook for automatic face assignment. | 1791 | * Auto Faces:: Hook for automatic face assignment. |
| 1792 | * Fonts:: Lisp representation for character display fonts. | ||
| 1793 | * Font Selection:: Finding the best available font for a face. | ||
| 1793 | * Font Lookup:: Looking up the names of available fonts | 1794 | * Font Lookup:: Looking up the names of available fonts |
| 1794 | and information about them. | 1795 | and information about them. |
| 1795 | * Fontsets:: A fontset is a collection of fonts | 1796 | * Fontsets:: A fontset is a collection of fonts |
| @@ -1961,14 +1962,16 @@ attribute is ignored. | |||
| 1961 | 1962 | ||
| 1962 | @table @code | 1963 | @table @code |
| 1963 | @item :family | 1964 | @item :family |
| 1964 | Font family name (@pxref{Font Lookup}), or fontset name | 1965 | Font family name or fontset name (a string). If you specify a font |
| 1965 | (@pxref{Fontsets}). If you specify a font family name, the wild-card | 1966 | family name, the wild-card characters @samp{*} and @samp{?} are |
| 1966 | characters @samp{*} and @samp{?} are allowed. @xref{Font Lookup}. | 1967 | allowed. The function @code{font-family-list}, described below, |
| 1968 | returns a list of available family names. @xref{Fontsets}, for | ||
| 1969 | information about fontsets. | ||
| 1967 | 1970 | ||
| 1968 | @item :foundry | 1971 | @item :foundry |
| 1969 | The @dfn{font foundry} in which the font family specified by the | 1972 | The name of the @dfn{font foundry} in which the font family specified |
| 1970 | @code{:family} attribute is located. The wild-card characters | 1973 | by the @code{:family} attribute is located (a string). The wild-card |
| 1971 | @samp{*} and @samp{?} are allowed. @xref{Font Lookup}. | 1974 | characters @samp{*} and @samp{?} are allowed. |
| 1972 | 1975 | ||
| 1973 | @item :width | 1976 | @item :width |
| 1974 | Relative proportionate character width, also known as the character | 1977 | Relative proportionate character width, also known as the character |
| @@ -2082,19 +2085,20 @@ Normally you do not need to set the stipple attribute, because it is | |||
| 2082 | used automatically to handle certain shades of gray. | 2085 | used automatically to handle certain shades of gray. |
| 2083 | 2086 | ||
| 2084 | @item :font | 2087 | @item :font |
| 2085 | The font used to display the face. Its value should be a font object | 2088 | The font used to display the face. Its value should be a font object. |
| 2086 | (@pxref{Font Lookup}). | 2089 | @xref{Font Selection}, for information about font objects. |
| 2087 | 2090 | ||
| 2088 | When specifying this attribute using @code{set-face-attribute} | 2091 | When specifying this attribute using @code{set-face-attribute} |
| 2089 | (@pxref{Attribute Functions}), you may supply a font spec, a font | 2092 | (@pxref{Attribute Functions}), you may also supply a font spec, a font |
| 2090 | entity, or a string. Emacs converts such values to an appropriate | 2093 | entity, or a string. Emacs converts such values to an appropriate |
| 2091 | font object, and stores that font object internally. If you specify a | 2094 | font object, and stores that font object as the actual attribute |
| 2092 | string, the contents of the string should be an XLFD font name | 2095 | value. If you specify a string, the contents of the string should be |
| 2093 | (@pxref{Font X,, Font Specification Options, emacs, The GNU Emacs | 2096 | a font name (@pxref{Font X,, Font Specification Options, emacs, The |
| 2094 | Manual}); if the XLFD contains wildcards, Emacs chooses the first font | 2097 | GNU Emacs Manual}); if the font name is an XLFD containing wildcards, |
| 2095 | matching those wildcards. Specifying this attribute also changes the | 2098 | Emacs chooses the first font matching those wildcards. Specifying |
| 2096 | values of the @code{:family}, @code{:foundry}, @code{:width}, | 2099 | this attribute also changes the values of the @code{:family}, |
| 2097 | @code{:height}, @code{:weight}, and @code{:slant} attributes. | 2100 | @code{:foundry}, @code{:width}, @code{:height}, @code{:weight}, and |
| 2101 | @code{:slant} attributes. | ||
| 2098 | 2102 | ||
| 2099 | @item :inherit | 2103 | @item :inherit |
| 2100 | The name of a face from which to inherit attributes, or a list of face | 2104 | The name of a face from which to inherit attributes, or a list of face |
| @@ -2114,6 +2118,12 @@ to @code{normal}. Setting @code{:italic} to @code{t} is equivalent to | |||
| 2114 | setting the @code{:slant} attribute to @code{italic}, and setting it | 2118 | setting the @code{:slant} attribute to @code{italic}, and setting it |
| 2115 | to @code{nil} is equivalent to setting @code{:slant} to @code{normal}. | 2119 | to @code{nil} is equivalent to setting @code{:slant} to @code{normal}. |
| 2116 | 2120 | ||
| 2121 | @defun font-family-list &optional frame | ||
| 2122 | This function returns a list of available font family names. The | ||
| 2123 | optional argument @var{frame} specifies the frame on which the text is | ||
| 2124 | to be displayed; if it is @code{nil}, the selected frame is used. | ||
| 2125 | @end defun | ||
| 2126 | |||
| 2117 | @defvar x-bitmap-file-path | 2127 | @defvar x-bitmap-file-path |
| 2118 | This variable specifies a list of directories for searching | 2128 | This variable specifies a list of directories for searching |
| 2119 | for bitmap files, for the @code{:stipple} attribute. | 2129 | for bitmap files, for the @code{:stipple} attribute. |
| @@ -2512,27 +2522,273 @@ This function sets the ``base remapping'' of @var{face} to its default | |||
| 2512 | value, which inherits from @var{face}'s global definition. | 2522 | value, which inherits from @var{face}'s global definition. |
| 2513 | @end defun | 2523 | @end defun |
| 2514 | 2524 | ||
| 2525 | @node Face Functions | ||
| 2526 | @subsection Functions for Working with Faces | ||
| 2527 | |||
| 2528 | Here are additional functions for creating and working with faces. | ||
| 2529 | |||
| 2530 | @defun make-face name | ||
| 2531 | This function defines a new face named @var{name}, initially with all | ||
| 2532 | attributes @code{nil}. It does nothing if there is already a face named | ||
| 2533 | @var{name}. | ||
| 2534 | @end defun | ||
| 2535 | |||
| 2536 | @defun face-list | ||
| 2537 | This function returns a list of all defined face names. | ||
| 2538 | @end defun | ||
| 2539 | |||
| 2540 | @defun copy-face old-face new-name &optional frame new-frame | ||
| 2541 | This function defines a face named @var{new-name} as a copy of the existing | ||
| 2542 | face named @var{old-face}. It creates the face @var{new-name} if that | ||
| 2543 | doesn't already exist. | ||
| 2544 | |||
| 2545 | If the optional argument @var{frame} is given, this function applies | ||
| 2546 | only to that frame. Otherwise it applies to each frame individually, | ||
| 2547 | copying attributes from @var{old-face} in each frame to @var{new-face} | ||
| 2548 | in the same frame. | ||
| 2549 | |||
| 2550 | If the optional argument @var{new-frame} is given, then @code{copy-face} | ||
| 2551 | copies the attributes of @var{old-face} in @var{frame} to @var{new-name} | ||
| 2552 | in @var{new-frame}. | ||
| 2553 | @end defun | ||
| 2554 | |||
| 2555 | @defun face-id face | ||
| 2556 | This function returns the @dfn{face number} of face @var{face}. This | ||
| 2557 | is a number that uniquely identifies a face at low levels within | ||
| 2558 | Emacs. It is seldom necessary to refer to a face by its face number. | ||
| 2559 | @end defun | ||
| 2560 | |||
| 2561 | @defun face-documentation face | ||
| 2562 | This function returns the documentation string of face @var{face}, or | ||
| 2563 | @code{nil} if none was specified for it. | ||
| 2564 | @end defun | ||
| 2565 | |||
| 2566 | @defun face-equal face1 face2 &optional frame | ||
| 2567 | This returns @code{t} if the faces @var{face1} and @var{face2} have the | ||
| 2568 | same attributes for display. | ||
| 2569 | @end defun | ||
| 2570 | |||
| 2571 | @defun face-differs-from-default-p face &optional frame | ||
| 2572 | This returns non-@code{nil} if the face @var{face} displays | ||
| 2573 | differently from the default face. | ||
| 2574 | @end defun | ||
| 2575 | |||
| 2576 | @cindex face alias | ||
| 2577 | A @dfn{face alias} provides an equivalent name for a face. You can | ||
| 2578 | define a face alias by giving the alias symbol the @code{face-alias} | ||
| 2579 | property, with a value of the target face name. The following example | ||
| 2580 | makes @code{modeline} an alias for the @code{mode-line} face. | ||
| 2581 | |||
| 2582 | @example | ||
| 2583 | (put 'modeline 'face-alias 'mode-line) | ||
| 2584 | @end example | ||
| 2585 | |||
| 2586 | @node Auto Faces | ||
| 2587 | @subsection Automatic Face Assignment | ||
| 2588 | @cindex automatic face assignment | ||
| 2589 | @cindex faces, automatic choice | ||
| 2590 | |||
| 2591 | This hook is used for automatically assigning faces to text in the | ||
| 2592 | buffer. It is part of the implementation of Jit-Lock mode, used by | ||
| 2593 | Font-Lock. | ||
| 2594 | |||
| 2595 | @defvar fontification-functions | ||
| 2596 | This variable holds a list of functions that are called by Emacs | ||
| 2597 | redisplay as needed to assign faces automatically to text in the buffer. | ||
| 2598 | |||
| 2599 | The functions are called in the order listed, with one argument, a | ||
| 2600 | buffer position @var{pos}. Each function should attempt to assign faces | ||
| 2601 | to the text in the current buffer starting at @var{pos}. | ||
| 2602 | |||
| 2603 | Each function should record the faces they assign by setting the | ||
| 2604 | @code{face} property. It should also add a non-@code{nil} | ||
| 2605 | @code{fontified} property for all the text it has assigned faces to. | ||
| 2606 | That property tells redisplay that faces have been assigned to that text | ||
| 2607 | already. | ||
| 2608 | |||
| 2609 | It is probably a good idea for each function to do nothing if the | ||
| 2610 | character after @var{pos} already has a non-@code{nil} @code{fontified} | ||
| 2611 | property, but this is not required. If one function overrides the | ||
| 2612 | assignments made by a previous one, the properties as they are | ||
| 2613 | after the last function finishes are the ones that really matter. | ||
| 2614 | |||
| 2615 | For efficiency, we recommend writing these functions so that they | ||
| 2616 | usually assign faces to around 400 to 600 characters at each call. | ||
| 2617 | @end defvar | ||
| 2618 | |||
| 2619 | @node Fonts | ||
| 2620 | @subsection Fonts | ||
| 2621 | |||
| 2622 | Before Emacs can draw a character on a particular display, it must | ||
| 2623 | select a @dfn{font} for that character@footnote{In this context, the | ||
| 2624 | term @dfn{font} has nothing to do with Font Lock (@pxref{Font Lock | ||
| 2625 | Mode}).}. Normally, Emacs automatically chooses a font for displaying | ||
| 2626 | a character based on the faces assigned to that | ||
| 2627 | character---specifically, the face attributes @code{:family}, | ||
| 2628 | @code{:weight}, @code{:slant}, and @code{:width}. The choice of font | ||
| 2629 | also depends on the character to be displayed; some fonts can only | ||
| 2630 | display a limited set of characters. Normally, it is not necessary to | ||
| 2631 | manipulate fonts directly. In case you need to do so, this section | ||
| 2632 | explains how. | ||
| 2633 | |||
| 2634 | In Emacs Lisp, fonts are represented using three different Lisp | ||
| 2635 | object types: @dfn{font objects}, @dfn{font specs}, and @dfn{font | ||
| 2636 | entities}. | ||
| 2637 | |||
| 2638 | @defun fontp object &optional type | ||
| 2639 | Return @code{t} if @var{object} is a font object, font spec, or font | ||
| 2640 | entity. Otherwise, return @code{nil}. | ||
| 2641 | |||
| 2642 | The optional argument @var{type}, if non-@code{nil}, determines the | ||
| 2643 | exact type of Lisp object to check for. In that case, @var{type} | ||
| 2644 | should be one of @code{font-object}, @code{font-spec}, or | ||
| 2645 | @code{font-entity}. | ||
| 2646 | @end defun | ||
| 2647 | |||
| 2648 | A font object is a Lisp object that represents a font that Emacs has | ||
| 2649 | @dfn{opened}. Font objects cannot be modified in Lisp, but they can | ||
| 2650 | be inspected. For instance, if you call @code{set-face-attribute} and | ||
| 2651 | pass a font spec, font entity, or font name string as the value of the | ||
| 2652 | @code{:font} attribute, Emacs opens the best ``matching'' font that is | ||
| 2653 | available for display. It then stores the corresponding font object | ||
| 2654 | as the actual value of the @code{:font} attribute for that face. | ||
| 2655 | |||
| 2656 | @defun font-at position &optional window string | ||
| 2657 | Return the font object that is being used to display the character at | ||
| 2658 | position @var{position} in the window @var{window}. If @var{window} | ||
| 2659 | is @code{nil}, it defaults to the selected window. If @var{string} is | ||
| 2660 | @code{nil}, @var{position} specifies a position in the current buffer; | ||
| 2661 | otherwise, @var{string} should be a string, and @var{position} | ||
| 2662 | specifies a position in that string. | ||
| 2663 | @end defun | ||
| 2664 | |||
| 2665 | A font spec is a Lisp object that contains a set of specifications | ||
| 2666 | that can be used to find a font. More than one font may match the | ||
| 2667 | specifications in a font spec. | ||
| 2668 | |||
| 2669 | @defun font-spec &rest arguments | ||
| 2670 | Return a new font spec using the specifications in @var{arguments}, | ||
| 2671 | which should come in @code{property}-@code{value} pairs. The possible | ||
| 2672 | specifications are as follows: | ||
| 2673 | |||
| 2674 | @table @code | ||
| 2675 | @item :name | ||
| 2676 | The font name string, in either XLFD, Fontconfig, or GTK format. | ||
| 2677 | @xref{Font X,, Font Specification Options, emacs, The GNU Emacs | ||
| 2678 | Manual}. | ||
| 2679 | |||
| 2680 | @item :family | ||
| 2681 | @itemx :foundry | ||
| 2682 | @itemx :weight | ||
| 2683 | @itemx :slant | ||
| 2684 | @itemx :width | ||
| 2685 | These have the same meanings as the face attributes of the same name. | ||
| 2686 | @xref{Face Attributes}. | ||
| 2687 | |||
| 2688 | @item :size | ||
| 2689 | The font size---either a non-negative integer that specifies the pixel | ||
| 2690 | size, or a floating point number that specifies the point size. | ||
| 2691 | |||
| 2692 | @item :adstyle | ||
| 2693 | Additional typographic style information for the font, such as | ||
| 2694 | @samp{sans}. The value should be a string or a symbol. | ||
| 2695 | |||
| 2696 | @item :registry | ||
| 2697 | The charset registry and encoding of the font, such as | ||
| 2698 | @samp{iso8859-1}. The value should be a string or a symbol. | ||
| 2699 | |||
| 2700 | @item :script | ||
| 2701 | The script that the font must support (a symbol). | ||
| 2702 | @end table | ||
| 2703 | @end defun | ||
| 2704 | |||
| 2705 | @defun font-put font-spec property value | ||
| 2706 | Set the font property @var{property} in the font-spec @var{font-spec} | ||
| 2707 | to @var{value}. | ||
| 2708 | @end defun | ||
| 2709 | |||
| 2710 | A font entity is a reference to a font that need not have been | ||
| 2711 | opened. Its properties are intermediate between a font object and a | ||
| 2712 | font spec: like a font object, and unlike a font spec, it refers to a | ||
| 2713 | single, specific font. Unlike a font object, it can be modified in | ||
| 2714 | Lisp, and creating a font entity does not load the contents of that | ||
| 2715 | font into computer memory. | ||
| 2716 | |||
| 2717 | @defun find-font font-spec &optional frame | ||
| 2718 | Return a font entity that best matches the font spec @var{font-spec} | ||
| 2719 | on frame @var{frame}. If @var{frame} is @code{nil}, it defaults to | ||
| 2720 | the selected frame. | ||
| 2721 | @end defun | ||
| 2722 | |||
| 2723 | @defun list-fonts font-spec &optional frame num prefer | ||
| 2724 | This function returns a list of all font entities that match the font | ||
| 2725 | spec @var{font-spec}. | ||
| 2726 | |||
| 2727 | The optional argument @var{frame}, if non-@code{nil}, specifies the | ||
| 2728 | frame on which the fonts are to be displayed. The optional argument | ||
| 2729 | @var{num}, if non-@code{nil}, should be an integer; in that case, the | ||
| 2730 | function returns a list of at most @var{num} font entities. The | ||
| 2731 | optional argument @var{prefer}, if non-@code{nil}, should be another | ||
| 2732 | font spec, which is used to control the order of the returned list; | ||
| 2733 | the returned font entities are sorted in order of decreasing | ||
| 2734 | ``closeness'' to that font spec. | ||
| 2735 | @end defun | ||
| 2736 | |||
| 2737 | The following functions can be used to obtain information about font | ||
| 2738 | objects, font entities, and font specs alike: | ||
| 2739 | |||
| 2740 | @defun font-get font property | ||
| 2741 | This function returns the value of the font property @var{property} | ||
| 2742 | for @var{font}, which should be either a font object, font spec, or | ||
| 2743 | font entity. | ||
| 2744 | |||
| 2745 | If @var{font} is a font spec and the font spec does not specify | ||
| 2746 | @var{property}, the return value is @code{nil}. If @var{font} is a | ||
| 2747 | font object or font entity, the value for the @var{:script} property | ||
| 2748 | may be a list of scripts supported by the font. | ||
| 2749 | @end defun | ||
| 2750 | |||
| 2751 | @defun font-face-attributes font &optional frame | ||
| 2752 | This function returns a list of face attributes corresponding to | ||
| 2753 | @var{font} , which should be either a font name, a font object, a font | ||
| 2754 | spec, or a font entity. The optional argument @var{frame} specifies | ||
| 2755 | the frame on which the font is to be displayed. If it is @code{nil}, | ||
| 2756 | the selected frame is used. The return value has the form | ||
| 2757 | |||
| 2758 | @smallexample | ||
| 2759 | (:family @var{family} :height @var{height} :weight @var{weight} | ||
| 2760 | :slant @var{slant} :width @var{width}) | ||
| 2761 | @end smallexample | ||
| 2762 | |||
| 2763 | where the values of @var{family}, @var{height}, @var{weight}, | ||
| 2764 | @var{slant}, and @var{width} are face attribute values. Some of these | ||
| 2765 | key-attribute pairs may be omitted from the list if they are not | ||
| 2766 | specified by @var{font}. | ||
| 2767 | @end defun | ||
| 2768 | |||
| 2769 | @defun font-xlfd-name font &optional fold-wildcards | ||
| 2770 | This function returns the XLFD (X Logical Font Descriptor), a string, | ||
| 2771 | matching @var{font}. @xref{Font X,, Font Specification Options, | ||
| 2772 | emacs, The GNU Emacs Manual}, for information about XLFDs. @var{font} | ||
| 2773 | should be a font spec, font entity, or font object. If the name is | ||
| 2774 | too long for an XLFD (which can contain at most 255 characters), the | ||
| 2775 | function returns @code{nil}. | ||
| 2776 | |||
| 2777 | If the optional argument @var{fold-wildcards} is non-@code{nil}, | ||
| 2778 | consecutive wildcards in the XLFD are folded into one. | ||
| 2779 | @end defun | ||
| 2780 | |||
| 2515 | @node Font Selection | 2781 | @node Font Selection |
| 2516 | @subsection Font Selection | 2782 | @subsection Font Selection |
| 2517 | 2783 | ||
| 2518 | @dfn{Selecting a font} means mapping the specified face attributes for | 2784 | Emacs tries to find an available font to display each character |
| 2519 | a character to a font that is available on a particular display. The | 2785 | based on the face attributes and the character's registry and |
| 2520 | face attributes, as determined by face merging, specify most of the | 2786 | encoding. If there is a font that matches exactly, it is used, of |
| 2521 | font choice, but not all. Part of the choice depends on what character | 2787 | course. The hard case is when no available font exactly fits the |
| 2522 | it is. | 2788 | specification. Then Emacs looks for one that is ``close''---one |
| 2523 | 2789 | attribute at a time. You can specify the order to consider the | |
| 2524 | If the face specifies a fontset name, that fontset determines a | 2790 | attributes. In the case where a specified font family is not |
| 2525 | pattern for fonts of the given charset. If the face specifies a font | 2791 | available, you can specify a set of mappings for alternatives to try. |
| 2526 | family, a font pattern is constructed. | ||
| 2527 | |||
| 2528 | Emacs tries to find an available font for the given face attributes | ||
| 2529 | and character's registry and encoding. If there is a font that matches | ||
| 2530 | exactly, it is used, of course. The hard case is when no available font | ||
| 2531 | exactly fits the specification. Then Emacs looks for one that is | ||
| 2532 | ``close''---one attribute at a time. You can specify the order to | ||
| 2533 | consider the attributes. In the case where a specified font family is | ||
| 2534 | not available, you can specify a set of mappings for alternatives to | ||
| 2535 | try. | ||
| 2536 | 2792 | ||
| 2537 | @defvar face-font-selection-order | 2793 | @defvar face-font-selection-order |
| 2538 | This variable specifies the order of importance of the face attributes | 2794 | This variable specifies the order of importance of the face attributes |
| @@ -2627,101 +2883,6 @@ the font size if certain fonts are bigger or smaller than their | |||
| 2627 | nominal heights and widths would suggest. | 2883 | nominal heights and widths would suggest. |
| 2628 | @end defvar | 2884 | @end defvar |
| 2629 | 2885 | ||
| 2630 | @node Face Functions | ||
| 2631 | @subsection Functions for Working with Faces | ||
| 2632 | |||
| 2633 | Here are additional functions for creating and working with faces. | ||
| 2634 | |||
| 2635 | @defun make-face name | ||
| 2636 | This function defines a new face named @var{name}, initially with all | ||
| 2637 | attributes @code{nil}. It does nothing if there is already a face named | ||
| 2638 | @var{name}. | ||
| 2639 | @end defun | ||
| 2640 | |||
| 2641 | @defun face-list | ||
| 2642 | This function returns a list of all defined face names. | ||
| 2643 | @end defun | ||
| 2644 | |||
| 2645 | @defun copy-face old-face new-name &optional frame new-frame | ||
| 2646 | This function defines a face named @var{new-name} as a copy of the existing | ||
| 2647 | face named @var{old-face}. It creates the face @var{new-name} if that | ||
| 2648 | doesn't already exist. | ||
| 2649 | |||
| 2650 | If the optional argument @var{frame} is given, this function applies | ||
| 2651 | only to that frame. Otherwise it applies to each frame individually, | ||
| 2652 | copying attributes from @var{old-face} in each frame to @var{new-face} | ||
| 2653 | in the same frame. | ||
| 2654 | |||
| 2655 | If the optional argument @var{new-frame} is given, then @code{copy-face} | ||
| 2656 | copies the attributes of @var{old-face} in @var{frame} to @var{new-name} | ||
| 2657 | in @var{new-frame}. | ||
| 2658 | @end defun | ||
| 2659 | |||
| 2660 | @defun face-id face | ||
| 2661 | This function returns the @dfn{face number} of face @var{face}. This | ||
| 2662 | is a number that uniquely identifies a face at low levels within | ||
| 2663 | Emacs. It is seldom necessary to refer to a face by its face number. | ||
| 2664 | @end defun | ||
| 2665 | |||
| 2666 | @defun face-documentation face | ||
| 2667 | This function returns the documentation string of face @var{face}, or | ||
| 2668 | @code{nil} if none was specified for it. | ||
| 2669 | @end defun | ||
| 2670 | |||
| 2671 | @defun face-equal face1 face2 &optional frame | ||
| 2672 | This returns @code{t} if the faces @var{face1} and @var{face2} have the | ||
| 2673 | same attributes for display. | ||
| 2674 | @end defun | ||
| 2675 | |||
| 2676 | @defun face-differs-from-default-p face &optional frame | ||
| 2677 | This returns non-@code{nil} if the face @var{face} displays | ||
| 2678 | differently from the default face. | ||
| 2679 | @end defun | ||
| 2680 | |||
| 2681 | @cindex face alias | ||
| 2682 | A @dfn{face alias} provides an equivalent name for a face. You can | ||
| 2683 | define a face alias by giving the alias symbol the @code{face-alias} | ||
| 2684 | property, with a value of the target face name. The following example | ||
| 2685 | makes @code{modeline} an alias for the @code{mode-line} face. | ||
| 2686 | |||
| 2687 | @example | ||
| 2688 | (put 'modeline 'face-alias 'mode-line) | ||
| 2689 | @end example | ||
| 2690 | |||
| 2691 | |||
| 2692 | @node Auto Faces | ||
| 2693 | @subsection Automatic Face Assignment | ||
| 2694 | @cindex automatic face assignment | ||
| 2695 | @cindex faces, automatic choice | ||
| 2696 | |||
| 2697 | This hook is used for automatically assigning faces to text in the | ||
| 2698 | buffer. It is part of the implementation of Jit-Lock mode, used by | ||
| 2699 | Font-Lock. | ||
| 2700 | |||
| 2701 | @defvar fontification-functions | ||
| 2702 | This variable holds a list of functions that are called by Emacs | ||
| 2703 | redisplay as needed to assign faces automatically to text in the buffer. | ||
| 2704 | |||
| 2705 | The functions are called in the order listed, with one argument, a | ||
| 2706 | buffer position @var{pos}. Each function should attempt to assign faces | ||
| 2707 | to the text in the current buffer starting at @var{pos}. | ||
| 2708 | |||
| 2709 | Each function should record the faces they assign by setting the | ||
| 2710 | @code{face} property. It should also add a non-@code{nil} | ||
| 2711 | @code{fontified} property for all the text it has assigned faces to. | ||
| 2712 | That property tells redisplay that faces have been assigned to that text | ||
| 2713 | already. | ||
| 2714 | |||
| 2715 | It is probably a good idea for each function to do nothing if the | ||
| 2716 | character after @var{pos} already has a non-@code{nil} @code{fontified} | ||
| 2717 | property, but this is not required. If one function overrides the | ||
| 2718 | assignments made by a previous one, the properties as they are | ||
| 2719 | after the last function finishes are the ones that really matter. | ||
| 2720 | |||
| 2721 | For efficiency, we recommend writing these functions so that they | ||
| 2722 | usually assign faces to around 400 to 600 characters at each call. | ||
| 2723 | @end defvar | ||
| 2724 | |||
| 2725 | @node Font Lookup | 2886 | @node Font Lookup |
| 2726 | @subsection Looking Up Fonts | 2887 | @subsection Looking Up Fonts |
| 2727 | 2888 | ||