diff options
| author | Chong Yidong | 2009-01-09 14:18:59 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-01-09 14:18:59 +0000 |
| commit | c2aa555a1c09d7b96caec5e1ad8bb39d15a34d58 (patch) | |
| tree | 633e10fc60da295b6d52e3355e4406b54dcb46f5 | |
| parent | 1c1282fbc4795a5af3cdef9df53041406471b7c9 (diff) | |
| download | emacs-c2aa555a1c09d7b96caec5e1ad8bb39d15a34d58.tar.gz emacs-c2aa555a1c09d7b96caec5e1ad8bb39d15a34d58.zip | |
(Font Lookup): Remove obsolete function
x-font-family-list. x-list-fonts accepts Fontconfig/GTK syntax.
(Low-Level Font): Rename from Fonts, move to end of Faces section.
(Font Selection): Reorder order of variable descriptions. Minor
clarifications.
| -rw-r--r-- | doc/lispref/display.texi | 429 |
1 files changed, 200 insertions, 229 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index bf034813277..cc358fe65b8 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -1789,12 +1789,12 @@ particular face name a special meaning in one frame if you wish. | |||
| 1789 | * Face Remapping:: Remapping faces to alternative definitions. | 1789 | * Face Remapping:: Remapping faces to alternative definitions. |
| 1790 | * Face Functions:: How to define and examine faces. | 1790 | * Face Functions:: How to define and examine faces. |
| 1791 | * 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. | 1792 | * Font Selection:: Finding the best available font for a face. |
| 1794 | * Font Lookup:: Looking up the names of available fonts | 1793 | * Font Lookup:: Looking up the names of available fonts |
| 1795 | and information about them. | 1794 | and information about them. |
| 1796 | * Fontsets:: A fontset is a collection of fonts | 1795 | * Fontsets:: A fontset is a collection of fonts |
| 1797 | that handle a range of character sets. | 1796 | that handle a range of character sets. |
| 1797 | * Low-Level Font:: Lisp representation for character display fonts. | ||
| 1798 | @end menu | 1798 | @end menu |
| 1799 | 1799 | ||
| 1800 | @node Defining Faces | 1800 | @node Defining Faces |
| @@ -2616,189 +2616,48 @@ For efficiency, we recommend writing these functions so that they | |||
| 2616 | usually assign faces to around 400 to 600 characters at each call. | 2616 | usually assign faces to around 400 to 600 characters at each call. |
| 2617 | @end defvar | 2617 | @end defvar |
| 2618 | 2618 | ||
| 2619 | @node Fonts | 2619 | @node Font Selection |
| 2620 | @subsection Fonts | 2620 | @subsection Font Selection |
| 2621 | 2621 | ||
| 2622 | Before Emacs can draw a character on a particular display, it must | 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 | 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 | 2624 | term @dfn{font} has nothing to do with Font Lock (@pxref{Font Lock |
| 2625 | Mode}).}. Normally, Emacs automatically chooses a font for displaying | 2625 | Mode}).}. Normally, Emacs automatically chooses a font based on the |
| 2626 | a character based on the faces assigned to that | 2626 | faces assigned to that character---specifically, the face attributes |
| 2627 | character---specifically, the face attributes @code{:family}, | 2627 | @code{:family}, @code{:weight}, @code{:slant}, and @code{:width} |
| 2628 | @code{:weight}, @code{:slant}, and @code{:width}. The choice of font | 2628 | (@pxref{Face Attributes}). The choice of font also depends on the |
| 2629 | also depends on the character to be displayed; some fonts can only | 2629 | character to be displayed; some fonts can only display a limited set |
| 2630 | display a limited set of characters. Normally, it is not necessary to | 2630 | of characters. If no available font exactly fits the requirements, |
| 2631 | manipulate fonts directly. In case you need to do so, this section | 2631 | Emacs looks for the @dfn{closest matching font}. The variables in |
| 2632 | explains how. | 2632 | this section control how Emacs makes this selection. |
| 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 | 2633 | ||
| 2669 | @defun font-spec &rest arguments | 2634 | @defvar face-font-family-alternatives |
| 2670 | Return a new font spec using the specifications in @var{arguments}, | 2635 | If a given family is specified but does not exist, this variable |
| 2671 | which should come in @code{property}-@code{value} pairs. The possible | 2636 | specifies alternative font families to try. Each element should have |
| 2672 | specifications are as follows: | 2637 | this form: |
| 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 | 2638 | ||
| 2781 | @node Font Selection | 2639 | @example |
| 2782 | @subsection Font Selection | 2640 | (@var{family} @var{alternate-families}@dots{}) |
| 2641 | @end example | ||
| 2783 | 2642 | ||
| 2784 | Emacs tries to find an available font to display each character | 2643 | If @var{family} is specified but not available, Emacs will try the other |
| 2785 | based on the face attributes and the character's registry and | 2644 | families given in @var{alternate-families}, one by one, until it finds a |
| 2786 | encoding. If there is a font that matches exactly, it is used, of | 2645 | family that does exist. |
| 2787 | course. The hard case is when no available font exactly fits the | 2646 | @end defvar |
| 2788 | specification. Then Emacs looks for one that is ``close''---one | ||
| 2789 | attribute at a time. You can specify the order to consider the | ||
| 2790 | attributes. In the case where a specified font family is not | ||
| 2791 | available, you can specify a set of mappings for alternatives to try. | ||
| 2792 | 2647 | ||
| 2793 | @defvar face-font-selection-order | 2648 | @defvar face-font-selection-order |
| 2794 | This variable specifies the order of importance of the face attributes | 2649 | If there is no font that exactly matches all desired face attributes |
| 2795 | @code{:width}, @code{:height}, @code{:weight}, and @code{:slant}. The | 2650 | (@code{:width}, @code{:height}, @code{:weight}, and @code{:slant}), |
| 2796 | value should be a list containing those four symbols, in order of | 2651 | this variable specifies the order in which these attributes should be |
| 2797 | decreasing importance. | 2652 | considered when selecting the closest matching font. The value should |
| 2653 | be a list containing those four attribute symbols, in order of | ||
| 2654 | decreasing importance. The default is @code{(:width :height :weight | ||
| 2655 | :slant)}. | ||
| 2798 | 2656 | ||
| 2799 | Font selection first finds the best available matches for the first | 2657 | Font selection first finds the best available matches for the first |
| 2800 | attribute listed; then, among the fonts which are best in that way, it | 2658 | attribute in the list; then, among the fonts which are best in that |
| 2801 | searches for the best matches in the second attribute, and so on. | 2659 | way, it searches for the best matches in the second attribute, and so |
| 2660 | on. | ||
| 2802 | 2661 | ||
| 2803 | The attributes @code{:weight} and @code{:width} have symbolic values in | 2662 | The attributes @code{:weight} and @code{:width} have symbolic values in |
| 2804 | a range centered around @code{normal}. Matches that are more extreme | 2663 | a range centered around @code{normal}. Matches that are more extreme |
| @@ -2806,11 +2665,6 @@ a range centered around @code{normal}. Matches that are more extreme | |||
| 2806 | less extreme (closer to @code{normal}); this is designed to ensure that | 2665 | less extreme (closer to @code{normal}); this is designed to ensure that |
| 2807 | non-normal faces contrast with normal ones, whenever possible. | 2666 | non-normal faces contrast with normal ones, whenever possible. |
| 2808 | 2667 | ||
| 2809 | The default is @code{(:width :height :weight :slant)}, which means first | ||
| 2810 | find the fonts closest to the specified @code{:width}, then---among the | ||
| 2811 | fonts with that width---find a best match for the specified font height, | ||
| 2812 | and so on. | ||
| 2813 | |||
| 2814 | One example of a case where this variable makes a difference is when the | 2668 | One example of a case where this variable makes a difference is when the |
| 2815 | default font has no italic equivalent. With the default ordering, the | 2669 | default font has no italic equivalent. With the default ordering, the |
| 2816 | @code{italic} face will use a non-italic font that is similar to the | 2670 | @code{italic} face will use a non-italic font that is similar to the |
| @@ -2819,20 +2673,6 @@ default one. But if you put @code{:slant} before @code{:height}, the | |||
| 2819 | quite right. | 2673 | quite right. |
| 2820 | @end defvar | 2674 | @end defvar |
| 2821 | 2675 | ||
| 2822 | @defvar face-font-family-alternatives | ||
| 2823 | This variable lets you specify alternative font families to try, if a | ||
| 2824 | given family is specified and doesn't exist. Each element should have | ||
| 2825 | this form: | ||
| 2826 | |||
| 2827 | @example | ||
| 2828 | (@var{family} @var{alternate-families}@dots{}) | ||
| 2829 | @end example | ||
| 2830 | |||
| 2831 | If @var{family} is specified but not available, Emacs will try the other | ||
| 2832 | families given in @var{alternate-families}, one by one, until it finds a | ||
| 2833 | family that does exist. | ||
| 2834 | @end defvar | ||
| 2835 | |||
| 2836 | @defvar face-font-registry-alternatives | 2676 | @defvar face-font-registry-alternatives |
| 2837 | This variable lets you specify alternative font registries to try, if a | 2677 | This variable lets you specify alternative font registries to try, if a |
| 2838 | given registry is specified and doesn't exist. Each element should have | 2678 | given registry is specified and doesn't exist. Each element should have |
| @@ -2848,8 +2688,7 @@ until it finds a registry that does exist. | |||
| 2848 | @end defvar | 2688 | @end defvar |
| 2849 | 2689 | ||
| 2850 | Emacs can make use of scalable fonts, but by default it does not use | 2690 | Emacs can make use of scalable fonts, but by default it does not use |
| 2851 | them, since the use of too many or too big scalable fonts can crash | 2691 | them. |
| 2852 | XFree86 servers. | ||
| 2853 | 2692 | ||
| 2854 | @defvar scalable-fonts-allowed | 2693 | @defvar scalable-fonts-allowed |
| 2855 | This variable controls which scalable fonts to use. A value of | 2694 | This variable controls which scalable fonts to use. A value of |
| @@ -2886,25 +2725,25 @@ nominal heights and widths would suggest. | |||
| 2886 | @node Font Lookup | 2725 | @node Font Lookup |
| 2887 | @subsection Looking Up Fonts | 2726 | @subsection Looking Up Fonts |
| 2888 | 2727 | ||
| 2889 | @defun x-list-fonts pattern &optional face frame maximum | 2728 | @defun x-list-fonts name &optional reference-face frame maximum |
| 2890 | This function returns a list of available font names that match | 2729 | This function returns a list of available font names that match |
| 2891 | @var{pattern}. If the optional arguments @var{face} and @var{frame} are | 2730 | @var{name}. @var{name} should be a string containing a font name in |
| 2892 | specified, then the list is limited to fonts that are the same size as | 2731 | either the Fontconfig, GTK, or XLFD format (@pxref{Font X,, Font |
| 2893 | @var{face} currently is on @var{frame}. | 2732 | Specification Options, emacs, The GNU Emacs Manual}). Within an XLFD |
| 2894 | 2733 | string, wildcard characters may be used: the @samp{*} character | |
| 2895 | The argument @var{pattern} should be a string, perhaps with wildcard | 2734 | matches any substring, and the @samp{?} character matches any single |
| 2896 | characters: the @samp{*} character matches any substring, and the | 2735 | character. Case is ignored when matching font names. |
| 2897 | @samp{?} character matches any single character. Pattern matching | 2736 | |
| 2898 | of font names ignores case. | 2737 | If the optional arguments @var{reference-face} and @var{frame} are |
| 2899 | 2738 | specified, the returned list includes only fonts that are the same | |
| 2900 | If you specify @var{face} and @var{frame}, @var{face} should be a face name | 2739 | size as @var{reference-face} (a face name) currently is on the frame |
| 2901 | (a symbol) and @var{frame} should be a frame. | 2740 | @var{frame}. |
| 2902 | 2741 | ||
| 2903 | The optional argument @var{maximum} sets a limit on how many fonts to | 2742 | The optional argument @var{maximum} sets a limit on how many fonts to |
| 2904 | return. If this is non-@code{nil}, then the return value is truncated | 2743 | return. If it is non-@code{nil}, then the return value is truncated |
| 2905 | after the first @var{maximum} matching fonts. Specifying a small value | 2744 | after the first @var{maximum} matching fonts. Specifying a small |
| 2906 | for @var{maximum} can make this function much faster, in cases where | 2745 | value for @var{maximum} can make this function much faster, in cases |
| 2907 | many fonts match the pattern. | 2746 | where many fonts match the pattern. |
| 2908 | @end defun | 2747 | @end defun |
| 2909 | 2748 | ||
| 2910 | @defun x-family-fonts &optional family frame | 2749 | @defun x-family-fonts &optional family frame |
| @@ -2918,7 +2757,7 @@ The list describes the display that @var{frame} is on; if @var{frame} is | |||
| 2918 | omitted or @code{nil}, it applies to the selected frame's display | 2757 | omitted or @code{nil}, it applies to the selected frame's display |
| 2919 | (@pxref{Input Focus}). | 2758 | (@pxref{Input Focus}). |
| 2920 | 2759 | ||
| 2921 | The list contains a vector of the following form for each font: | 2760 | Each element in the list is a vector of the following form: |
| 2922 | 2761 | ||
| 2923 | @example | 2762 | @example |
| 2924 | [@var{family} @var{width} @var{point-size} @var{weight} @var{slant} | 2763 | [@var{family} @var{width} @var{point-size} @var{weight} @var{slant} |
| @@ -2933,24 +2772,6 @@ The last three elements give additional information about the font. | |||
| 2933 | @var{full} is the full name of the font, and | 2772 | @var{full} is the full name of the font, and |
| 2934 | @var{registry-and-encoding} is a string giving the registry and | 2773 | @var{registry-and-encoding} is a string giving the registry and |
| 2935 | encoding of the font. | 2774 | encoding of the font. |
| 2936 | |||
| 2937 | The result list is sorted according to the current face font sort order. | ||
| 2938 | @end defun | ||
| 2939 | |||
| 2940 | @defun x-font-family-list &optional frame | ||
| 2941 | This function returns a list of the font families available for | ||
| 2942 | @var{frame}'s display. If @var{frame} is omitted or @code{nil}, it | ||
| 2943 | describes the selected frame's display (@pxref{Input Focus}). | ||
| 2944 | |||
| 2945 | The value is a list of elements of this form: | ||
| 2946 | |||
| 2947 | @example | ||
| 2948 | (@var{family} . @var{fixed-p}) | ||
| 2949 | @end example | ||
| 2950 | |||
| 2951 | @noindent | ||
| 2952 | Here @var{family} is a font family, and @var{fixed-p} is | ||
| 2953 | non-@code{nil} if fonts of that family are fixed-pitch. | ||
| 2954 | @end defun | 2775 | @end defun |
| 2955 | 2776 | ||
| 2956 | @defvar font-list-limit | 2777 | @defvar font-list-limit |
| @@ -3095,6 +2916,156 @@ Fontsets can specify a font on a per-character basis; when the fontset | |||
| 3095 | does that, this function's value may not be accurate. | 2916 | does that, this function's value may not be accurate. |
| 3096 | @end defun | 2917 | @end defun |
| 3097 | 2918 | ||
| 2919 | @node Low-Level Font | ||
| 2920 | @subsection Low-Level Font Representation | ||
| 2921 | |||
| 2922 | Normally, it is not necessary to manipulate fonts directly. In case | ||
| 2923 | you need to do so, this section explains how. | ||
| 2924 | |||
| 2925 | In Emacs Lisp, fonts are represented using three different Lisp | ||
| 2926 | qobject types: @dfn{font objects}, @dfn{font specs}, and @dfn{font | ||
| 2927 | entities}. | ||
| 2928 | |||
| 2929 | @defun fontp object &optional type | ||
| 2930 | Return @code{t} if @var{object} is a font object, font spec, or font | ||
| 2931 | entity. Otherwise, return @code{nil}. | ||
| 2932 | |||
| 2933 | The optional argument @var{type}, if non-@code{nil}, determines the | ||
| 2934 | exact type of Lisp object to check for. In that case, @var{type} | ||
| 2935 | should be one of @code{font-object}, @code{font-spec}, or | ||
| 2936 | @code{font-entity}. | ||
| 2937 | @end defun | ||
| 2938 | |||
| 2939 | A font object is a Lisp object that represents a font that Emacs has | ||
| 2940 | @dfn{opened}. Font objects cannot be modified in Lisp, but they can | ||
| 2941 | be inspected. If you call @code{set-face-attribute} and pass a font | ||
| 2942 | spec, font entity, or font name string as the value of the | ||
| 2943 | @code{:font} attribute, Emacs opens the best ``matching'' font that is | ||
| 2944 | available for display. It then stores the corresponding font object | ||
| 2945 | as the actual value of the @code{:font} attribute for that face. | ||
| 2946 | |||
| 2947 | @defun font-at position &optional window string | ||
| 2948 | Return the font object that is being used to display the character at | ||
| 2949 | position @var{position} in the window @var{window}. If @var{window} | ||
| 2950 | is @code{nil}, it defaults to the selected window. If @var{string} is | ||
| 2951 | @code{nil}, @var{position} specifies a position in the current buffer; | ||
| 2952 | otherwise, @var{string} should be a string, and @var{position} | ||
| 2953 | specifies a position in that string. | ||
| 2954 | @end defun | ||
| 2955 | |||
| 2956 | A font spec is a Lisp object that contains a set of specifications | ||
| 2957 | that can be used to find a font. More than one font may match the | ||
| 2958 | specifications in a font spec. | ||
| 2959 | |||
| 2960 | @defun font-spec &rest arguments | ||
| 2961 | Return a new font spec using the specifications in @var{arguments}, | ||
| 2962 | which should come in @code{property}-@code{value} pairs. The possible | ||
| 2963 | specifications are as follows: | ||
| 2964 | |||
| 2965 | @table @code | ||
| 2966 | @item :name | ||
| 2967 | The font name (a string), in either XLFD, Fontconfig, or GTK format. | ||
| 2968 | @xref{Font X,, Font Specification Options, emacs, The GNU Emacs | ||
| 2969 | Manual}. | ||
| 2970 | |||
| 2971 | @item :family | ||
| 2972 | @itemx :foundry | ||
| 2973 | @itemx :weight | ||
| 2974 | @itemx :slant | ||
| 2975 | @itemx :width | ||
| 2976 | These have the same meanings as the face attributes of the same name. | ||
| 2977 | @xref{Face Attributes}. | ||
| 2978 | |||
| 2979 | @item :size | ||
| 2980 | The font size---either a non-negative integer that specifies the pixel | ||
| 2981 | size, or a floating point number that specifies the point size. | ||
| 2982 | |||
| 2983 | @item :adstyle | ||
| 2984 | Additional typographic style information for the font, such as | ||
| 2985 | @samp{sans}. The value should be a string or a symbol. | ||
| 2986 | |||
| 2987 | @item :registry | ||
| 2988 | The charset registry and encoding of the font, such as | ||
| 2989 | @samp{iso8859-1}. The value should be a string or a symbol. | ||
| 2990 | |||
| 2991 | @item :script | ||
| 2992 | The script that the font must support (a symbol). | ||
| 2993 | @end table | ||
| 2994 | @end defun | ||
| 2995 | |||
| 2996 | @defun font-put font-spec property value | ||
| 2997 | Set the font property @var{property} in the font-spec @var{font-spec} | ||
| 2998 | to @var{value}. | ||
| 2999 | @end defun | ||
| 3000 | |||
| 3001 | A font entity is a reference to a font that need not be open. Its | ||
| 3002 | properties are intermediate between a font object and a font spec: | ||
| 3003 | like a font object, and unlike a font spec, it refers to a single, | ||
| 3004 | specific font. Unlike a font object, creating a font entity does not | ||
| 3005 | load the contents of that font into computer memory. | ||
| 3006 | |||
| 3007 | @defun find-font font-spec &optional frame | ||
| 3008 | This function returns a font entity that best matches the font spec | ||
| 3009 | @var{font-spec} on frame @var{frame}. If @var{frame} is @code{nil}, | ||
| 3010 | it defaults to the selected frame. | ||
| 3011 | @end defun | ||
| 3012 | |||
| 3013 | @defun list-fonts font-spec &optional frame num prefer | ||
| 3014 | This function returns a list of all font entities that match the font | ||
| 3015 | spec @var{font-spec}. | ||
| 3016 | |||
| 3017 | The optional argument @var{frame}, if non-@code{nil}, specifies the | ||
| 3018 | frame on which the fonts are to be displayed. The optional argument | ||
| 3019 | @var{num}, if non-@code{nil}, should be an integer that specifies the | ||
| 3020 | maximum length of the returned list. The optional argument | ||
| 3021 | @var{prefer}, if non-@code{nil}, should be another font spec, which is | ||
| 3022 | used to control the order of the returned list; the returned font | ||
| 3023 | entities are sorted in order of decreasing ``closeness'' to that font | ||
| 3024 | spec. | ||
| 3025 | @end defun | ||
| 3026 | |||
| 3027 | The following functions can be used to obtain information about a | ||
| 3028 | font. For these functions, the @var{font} argument can be a font | ||
| 3029 | object, a font entity, or a font spec. | ||
| 3030 | |||
| 3031 | @defun font-get font property | ||
| 3032 | This function returns the value of the font property @var{property} | ||
| 3033 | for @var{font}. | ||
| 3034 | |||
| 3035 | If @var{font} is a font spec and the font spec does not specify | ||
| 3036 | @var{property}, the return value is @code{nil}. If @var{font} is a | ||
| 3037 | font object or font entity, the value for the @var{:script} property | ||
| 3038 | may be a list of scripts supported by the font. | ||
| 3039 | @end defun | ||
| 3040 | |||
| 3041 | @defun font-face-attributes font &optional frame | ||
| 3042 | This function returns a list of face attributes corresponding to | ||
| 3043 | @var{font}. The optional argument @var{frame} specifies the frame on | ||
| 3044 | which the font is to be displayed. If it is @code{nil}, the selected | ||
| 3045 | frame is used. The return value has the form | ||
| 3046 | |||
| 3047 | @smallexample | ||
| 3048 | (:family @var{family} :height @var{height} :weight @var{weight} | ||
| 3049 | :slant @var{slant} :width @var{width}) | ||
| 3050 | @end smallexample | ||
| 3051 | |||
| 3052 | where the values of @var{family}, @var{height}, @var{weight}, | ||
| 3053 | @var{slant}, and @var{width} are face attribute values. Some of these | ||
| 3054 | key-attribute pairs may be omitted from the list if they are not | ||
| 3055 | specified by @var{font}. | ||
| 3056 | @end defun | ||
| 3057 | |||
| 3058 | @defun font-xlfd-name font &optional fold-wildcards | ||
| 3059 | This function returns the XLFD (X Logical Font Descriptor), a string, | ||
| 3060 | matching @var{font}. @xref{Font X,, Font Specification Options, | ||
| 3061 | emacs, The GNU Emacs Manual}, for information about XLFDs. If the | ||
| 3062 | name is too long for an XLFD (which can contain at most 255 | ||
| 3063 | characters), the function returns @code{nil}. | ||
| 3064 | |||
| 3065 | If the optional argument @var{fold-wildcards} is non-@code{nil}, | ||
| 3066 | consecutive wildcards in the XLFD are folded into one. | ||
| 3067 | @end defun | ||
| 3068 | |||
| 3098 | @node Fringes | 3069 | @node Fringes |
| 3099 | @section Fringes | 3070 | @section Fringes |
| 3100 | @cindex fringes | 3071 | @cindex fringes |