aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2019-11-02 12:41:51 +0200
committerEli Zaretskii2019-11-02 12:41:51 +0200
commitcacd58463b9265ab737a85cceb502cd8538d3c9b (patch)
tree6be37a89f9e8fa33ce07d01816cea8b8b3e4338b
parent5a778d504fdbc4fd729ff2cc80be0ca5a68679b6 (diff)
downloademacs-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.texi19
-rw-r--r--doc/lispref/display.texi33
-rw-r--r--lisp/faces.el11
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
592names the font that it's rendered in. 592names 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
596first is to use a @dfn{Fontconfig pattern}. Fontconfig patterns have 596to use a @dfn{Fontconfig pattern}. Fontconfig patterns have the
597the following form: 597following 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
650Fontconfig manual, which is distributed with Fontconfig and available 650Fontconfig manual, which is distributed with Fontconfig and available
651online at @url{https://fontconfig.org/fontconfig-user.html}. 651online at @url{https://fontconfig.org/fontconfig-user.html}.
652 652
653On MS-Windows, only the subset of the form
654@var{fontname}[-@var{fontsize}] is supported for all fonts; the full
655Fontconfig 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}.
655These have the syntax 659These have the syntax
@@ -685,12 +689,15 @@ Monospace 12
685Monospace Bold Italic 12 689Monospace Bold Italic 12
686@end example 690@end example
687 691
692On 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
691Logical Font Description}). This is the traditional method for 697Logical Font Description}). This is the traditional method for
692specifying fonts under X@. Each XLFD consists of fourteen words or 698specifying fonts under X, and is also supported on MS-Windows. Each
693numbers, separated by dashes, like this: 699XLFD consists of fourteen words or numbers, separated by dashes, like
700this:
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
784This 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
2466objects, font specs, and font entities. @xref{Fontsets}, for 2466objects, font specs, and font entities. @xref{Fontsets}, for
2467information about fontsets. 2467information about fontsets.
2468 2468
2469When 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 2470When specifying this attribute using @code{set-face-attribute} or
2471entity, or a string. Emacs converts such values to an appropriate 2471@code{set-face-font} (@pxref{Attribute Functions}), you may also
2472font object, and stores that font object as the actual attribute 2472supply a font spec, a font entity, or a string. Emacs converts such
2473value. If you specify a string, the contents of the string should be 2473values to an appropriate font object, and stores that font object as
2474a font name (@pxref{Fonts,,, emacs, The GNU Emacs Manual}); if the 2474the actual attribute value. If you specify a string, the contents of
2475font name is an XLFD containing wildcards, Emacs chooses the first 2475the string should be a font name (@pxref{Fonts,,, emacs, The GNU Emacs
2476font matching those wildcards. Specifying this attribute also changes 2476Manual}); if the font name is an XLFD containing wildcards, Emacs
2477the values of the @code{:family}, @code{:foundry}, @code{:width}, 2477chooses the first font matching those wildcards. Specifying this
2478@code{:height}, @code{:weight}, and @code{:slant} attributes. 2478attribute 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
2836Change the font-related attributes of @var{face} to those of 2838Change 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 2840for the supported formats of the @var{font} argument. This function
2839@code{:slant}. If @var{frame} is non-@code{nil}, only change the 2841sets the attribute @code{:font} of the face, and indirectly also the
2840attributes 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.
2844If @var{frame} is non-@code{nil}, only change the attributes on the
2845specified 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.
891The format of the font varies based on the font system in used, 891FONT can be a string, a font spec, a font entity, a font object,
892but it can commonly be an X logical font description (XLFD) 892or a fontset. However, interactively, only strings are accepted.
893string, or a simpler XFD string like \"courier:size=10\". 893The format of the font string specification varies based on the font
894system in use, but it can commonly be an X Logical Font
895Description (XLFD) string, or a simpler string like \"Courier-10\"
896or \"courier:size=10\".
894 897
895FRAME nil or not specified means change face on all frames. 898FRAME nil or not specified means change face on all frames.
896This sets the attributes `:family', `:foundry', `:width', 899This sets the attributes `:family', `:foundry', `:width',