comparison man/display.texi @ 37485:12064cf8f86f

Explain better what a face is and what it does.
author Richard M. Stallman <rms@gnu.org>
date Thu, 26 Apr 2001 00:30:15 +0000
parents 80947e6a8952
children bd45e6c57fba
comparison
equal deleted inserted replaced
37484:0e8d5a17a47f 37485:12064cf8f86f
29 @node Faces 29 @node Faces
30 @section Using Multiple Typefaces 30 @section Using Multiple Typefaces
31 @cindex faces 31 @cindex faces
32 32
33 When using Emacs with a window system, you can set up multiple 33 When using Emacs with a window system, you can set up multiple
34 styles of displaying characters. Some of the aspects of style that 34 styles of displaying characters. Each style is called a @dfn{face}.
35 you can control are the type font, the foreground color, the 35 Each face can specify various attributes, such as the height, weight
36 background color, and whether or not to underline text, and in which 36 and slant of the characters, the foreground and background color, and
37 color. 37 underlining. But it does not have to specify all of them.
38 38
39 Features which rely on text in multiple faces (such as Font Lock mode) 39 Features which rely on text in multiple faces (such as Font Lock mode)
40 will also work on non-windowed terminals that can display more than one 40 will also work on non-windowed terminals that can display more than one
41 face, whether by colors or underlining and emboldening. This includes 41 face, whether by colors or underlining and emboldening. This includes
42 the console on GNU/Linux, an @code{xterm} which supports colors, the 42 the console on GNU/Linux, an @code{xterm} which supports colors, the
43 MS-DOS display (@pxref{MS-DOS}), and the MS-Windows version invoked with 43 MS-DOS display (@pxref{MS-DOS}), and the MS-Windows version invoked with
44 the @option{-nw} option. Emacs determines automatically whether the 44 the @option{-nw} option. Emacs determines automatically whether the
45 terminal has this capability. 45 terminal has this capability.
46 46
47 The way you control display style is by defining named @dfn{faces}. 47 You control the appearance of a part of the text in the buffer by
48 Each face can specify various attributes, like the type font's height, 48 specifying the face or faces to use for it. The style of display used
49 weight and slant, foreground and background color, and underlining, 49 for any given character is determined by combining the attributes of
50 but it does not have to specify all of them. By specifying the face 50 all the applicable faces specified for that character. Any attribute
51 or faces to use for a given part of the text in the buffer, you 51 that isn't specified by these faces is taken from the default face,
52 control how that text appears. 52 which embodies the default settings of the frame itself.
53
54 The style of display used for a given character in the text is
55 determined by combining several faces. Any aspect of the display
56 style that isn't specified by overlays or text properties comes from a
57 default face which inherits its settings from the frame itself.
58 53
59 Enriched mode, the mode for editing formatted text, includes several 54 Enriched mode, the mode for editing formatted text, includes several
60 commands and menus for specifying faces. @xref{Format Faces}, for how 55 commands and menus for specifying faces for text in the buffer.
61 to specify the font for text in the buffer. @xref{Format Colors}, for 56 @xref{Format Faces}, for how to specify the font for text in the
62 how to specify the foreground and background color. 57 buffer. @xref{Format Colors}, for how to specify the foreground and
63 58 background color.
64 To alter the appearance of a face, use the customization buffer.
65 @xref{Face Customization}. You can also use X resources to specify
66 attributes of particular faces (@pxref{Resources X}).
67 59
68 @cindex face colors, setting 60 @cindex face colors, setting
69 @findex set-face-foreground 61 @findex set-face-foreground
70 @findex set-face-background 62 @findex set-face-background
71 Alternatively, you can change the foreground and background colors 63 To alter the appearance of a face, use the customization buffer.
72 of a specific face with @kbd{M-x set-face-foreground} and @kbd{M-x 64 @xref{Face Customization}. You can also use X resources to specify
73 set-face-background}. These commands prompt in the minibuffer for a 65 attributes of particular faces (@pxref{Resources X}). Alternatively,
74 face name and a color name, with completion, and then set that face to 66 you can change the foreground and background colors of a specific face
75 use the specified color. 67 with @kbd{M-x set-face-foreground} and @kbd{M-x set-face-background}.
68 These commands prompt in the minibuffer for a face name and a color
69 name, with completion, and then set that face to use the specified
70 color.
71
72 Emacs 21 can correctly display variable-width fonts, but Emacs
73 commands that calculate width and indentation do not know how to
74 calculate variable widths. This can sometimes lead to incorrect
75 results when you use variable-width fonts. In particular, indentation
76 commands can give inconsistent results, so we recommend you avoid
77 variable-width fonts for editing program source code. Filling will
78 sometimes make lines too long or too short. We plan to address these
79 issues in future Emacs versions.
76 80
77 @findex list-faces-display 81 @findex list-faces-display
78 To see what faces are currently defined, and what they look like, type 82 To see what faces are currently defined, and what they look like, type
79 @kbd{M-x list-faces-display}. It's possible for a given face to look 83 @kbd{M-x list-faces-display}. It's possible for a given face to look
80 different in different frames; this command shows the appearance in the 84 different in different frames; this command shows the appearance in the