diff options
| author | Eli Zaretskii | 2019-11-02 12:41:51 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2019-11-02 12:41:51 +0200 |
| commit | cacd58463b9265ab737a85cceb502cd8538d3c9b (patch) | |
| tree | 6be37a89f9e8fa33ce07d01816cea8b8b3e4338b | |
| parent | 5a778d504fdbc4fd729ff2cc80be0ca5a68679b6 (diff) | |
| download | emacs-cacd58463b9265ab737a85cceb502cd8538d3c9b.tar.gz emacs-cacd58463b9265ab737a85cceb502cd8538d3c9b.zip | |
Improve documentation of 'set-face-font'
* lisp/faces.el (set-face-font):
* doc/emacs/frames.texi (Fonts):
* doc/lispref/display.texi (Face Attributes)
(Attribute Functions): Clarify and correct the documentation
of set-face-font and related descriptions of font
specifications. (Bug#14647)
| -rw-r--r-- | doc/emacs/frames.texi | 19 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 33 | ||||
| -rw-r--r-- | lisp/faces.el | 11 |
3 files changed, 40 insertions, 23 deletions
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index cac1f7fea6d..091c011fb96 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi | |||
| @@ -592,9 +592,9 @@ command can be helpful. It describes the character at point, and | |||
| 592 | names the font that it's rendered in. | 592 | names the font that it's rendered in. |
| 593 | 593 | ||
| 594 | @cindex fontconfig | 594 | @cindex fontconfig |
| 595 | On X, there are four different ways to express a font name. The | 595 | There are four different ways to express a font name. The first is |
| 596 | first is to use a @dfn{Fontconfig pattern}. Fontconfig patterns have | 596 | to use a @dfn{Fontconfig pattern}. Fontconfig patterns have the |
| 597 | the following form: | 597 | following form: |
| 598 | 598 | ||
| 599 | @example | 599 | @example |
| 600 | @var{fontname}[-@var{fontsize}][:@var{name1}=@var{values1}][:@var{name2}=@var{values2}]... | 600 | @var{fontname}[-@var{fontsize}][:@var{name1}=@var{values1}][:@var{name2}=@var{values2}]... |
| @@ -650,6 +650,10 @@ For a more detailed description of Fontconfig patterns, see the | |||
| 650 | Fontconfig manual, which is distributed with Fontconfig and available | 650 | Fontconfig manual, which is distributed with Fontconfig and available |
| 651 | online at @url{https://fontconfig.org/fontconfig-user.html}. | 651 | online at @url{https://fontconfig.org/fontconfig-user.html}. |
| 652 | 652 | ||
| 653 | On MS-Windows, only the subset of the form | ||
| 654 | @var{fontname}[-@var{fontsize}] is supported for all fonts; the full | ||
| 655 | Fontconfig pattern might not work for all of them. | ||
| 656 | |||
| 653 | @cindex GTK font pattern | 657 | @cindex GTK font pattern |
| 654 | The second way to specify a font is to use a @dfn{GTK font pattern}. | 658 | The second way to specify a font is to use a @dfn{GTK font pattern}. |
| 655 | These have the syntax | 659 | These have the syntax |
| @@ -685,12 +689,15 @@ Monospace 12 | |||
| 685 | Monospace Bold Italic 12 | 689 | Monospace Bold Italic 12 |
| 686 | @end example | 690 | @end example |
| 687 | 691 | ||
| 692 | On MS-Windows, only the subset @var{fontname} is supported. | ||
| 693 | |||
| 688 | @cindex XLFD | 694 | @cindex XLFD |
| 689 | @cindex X Logical Font Description | 695 | @cindex X Logical Font Description |
| 690 | The third way to specify a font is to use an @dfn{XLFD} (@dfn{X | 696 | The third way to specify a font is to use an @dfn{XLFD} (@dfn{X |
| 691 | Logical Font Description}). This is the traditional method for | 697 | Logical Font Description}). This is the traditional method for |
| 692 | specifying fonts under X@. Each XLFD consists of fourteen words or | 698 | specifying fonts under X, and is also supported on MS-Windows. Each |
| 693 | numbers, separated by dashes, like this: | 699 | XLFD consists of fourteen words or numbers, separated by dashes, like |
| 700 | this: | ||
| 694 | 701 | ||
| 695 | @example | 702 | @example |
| 696 | -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1 | 703 | -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1 |
| @@ -774,6 +781,8 @@ equivalent to | |||
| 774 | -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1 | 781 | -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1 |
| 775 | @end example | 782 | @end example |
| 776 | 783 | ||
| 784 | This form is not supported on MS-Windows. | ||
| 785 | |||
| 777 | @cindex client-side fonts | 786 | @cindex client-side fonts |
| 778 | @cindex server-side fonts | 787 | @cindex server-side fonts |
| 779 | On X, Emacs recognizes two types of fonts: @dfn{client-side} fonts, | 788 | On X, Emacs recognizes two types of fonts: @dfn{client-side} fonts, |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 29abc0a9f27..95f9cc15a8b 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -2466,16 +2466,18 @@ or a fontset. @xref{Low-Level Font}, for information about font | |||
| 2466 | objects, font specs, and font entities. @xref{Fontsets}, for | 2466 | objects, font specs, and font entities. @xref{Fontsets}, for |
| 2467 | information about fontsets. | 2467 | information about fontsets. |
| 2468 | 2468 | ||
| 2469 | When specifying this attribute using @code{set-face-attribute} | 2469 | @anchor{face-font-attribute} |
| 2470 | (@pxref{Attribute Functions}), you may also supply a font spec, a font | 2470 | When specifying this attribute using @code{set-face-attribute} or |
| 2471 | entity, or a string. Emacs converts such values to an appropriate | 2471 | @code{set-face-font} (@pxref{Attribute Functions}), you may also |
| 2472 | font object, and stores that font object as the actual attribute | 2472 | supply a font spec, a font entity, or a string. Emacs converts such |
| 2473 | value. If you specify a string, the contents of the string should be | 2473 | values to an appropriate font object, and stores that font object as |
| 2474 | a font name (@pxref{Fonts,,, emacs, The GNU Emacs Manual}); if the | 2474 | the actual attribute value. If you specify a string, the contents of |
| 2475 | font name is an XLFD containing wildcards, Emacs chooses the first | 2475 | the string should be a font name (@pxref{Fonts,,, emacs, The GNU Emacs |
| 2476 | font matching those wildcards. Specifying this attribute also changes | 2476 | Manual}); if the font name is an XLFD containing wildcards, Emacs |
| 2477 | the values of the @code{:family}, @code{:foundry}, @code{:width}, | 2477 | chooses the first font matching those wildcards. Specifying this |
| 2478 | @code{:height}, @code{:weight}, and @code{:slant} attributes. | 2478 | attribute also changes the values of the @code{:family}, |
| 2479 | @code{:foundry}, @code{:width}, @code{:height}, @code{:weight}, and | ||
| 2480 | @code{:slant} attributes. | ||
| 2479 | 2481 | ||
| 2480 | @cindex inheritance, for faces | 2482 | @cindex inheritance, for faces |
| 2481 | @item :inherit | 2483 | @item :inherit |
| @@ -2834,10 +2836,13 @@ This sets the @code{:stipple} attribute of @var{face} to | |||
| 2834 | 2836 | ||
| 2835 | @deffn Command set-face-font face font &optional frame | 2837 | @deffn Command set-face-font face font &optional frame |
| 2836 | Change the font-related attributes of @var{face} to those of | 2838 | Change the font-related attributes of @var{face} to those of |
| 2837 | @var{font} (a string). This sets the attributes @code{:family}, | 2839 | @var{font} (a string or a font object). @xref{face-font-attribute}, |
| 2838 | @code{:foundry}, @code{:width}, @code{:height}, @code{:weight}, and | 2840 | for the supported formats of the @var{font} argument. This function |
| 2839 | @code{:slant}. If @var{frame} is non-@code{nil}, only change the | 2841 | sets the attribute @code{:font} of the face, and indirectly also the |
| 2840 | attributes on the specified frame. | 2842 | @code{:family}, @code{:foundry}, @code{:width}, @code{:height}, |
| 2843 | @code{:weight}, and @code{:slant} attributes, as defined by the font. | ||
| 2844 | If @var{frame} is non-@code{nil}, only change the attributes on the | ||
| 2845 | specified frame. | ||
| 2841 | @end deffn | 2846 | @end deffn |
| 2842 | 2847 | ||
| 2843 | @defun set-face-bold face bold-p &optional frame | 2848 | @defun set-face-bold face bold-p &optional frame |
diff --git a/lisp/faces.el b/lisp/faces.el index 75753ecefc9..dc5bcca7609 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -887,10 +887,13 @@ Use `set-face-attribute' for finer control of font weight and slant." | |||
| 887 | 887 | ||
| 888 | 888 | ||
| 889 | (defun set-face-font (face font &optional frame) | 889 | (defun set-face-font (face font &optional frame) |
| 890 | "Change font-related attributes of FACE to those of FONT (a string). | 890 | "Change font-related attributes of FACE to those of FONT. |
| 891 | The format of the font varies based on the font system in used, | 891 | FONT can be a string, a font spec, a font entity, a font object, |
| 892 | but it can commonly be an X logical font description (XLFD) | 892 | or a fontset. However, interactively, only strings are accepted. |
| 893 | string, or a simpler XFD string like \"courier:size=10\". | 893 | The format of the font string specification varies based on the font |
| 894 | system in use, but it can commonly be an X Logical Font | ||
| 895 | Description (XLFD) string, or a simpler string like \"Courier-10\" | ||
| 896 | or \"courier:size=10\". | ||
| 894 | 897 | ||
| 895 | FRAME nil or not specified means change face on all frames. | 898 | FRAME nil or not specified means change face on all frames. |
| 896 | This sets the attributes `:family', `:foundry', `:width', | 899 | This sets the attributes `:family', `:foundry', `:width', |