[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When using Emacs with a window system, you can set up multiple styles of displaying characters. Each style is called a face. Each face can specify various attributes, such as the height, weight and slant of the characters, the foreground and background color, and underlining. But it does not have to specify all of them.
Emacs on a character terminal supports only part of face attributes. Which attributes are supported depends on your display type, but many displays support inverse video, bold, and underline attributes, and some support colors.
Features which rely on text in multiple faces (such as Font Lock mode)
will also work on non-windowed terminals that can display more than one
face, whether by colors or underlining and emboldening. This includes
the console on GNU/Linux, an xterm
which supports colors, the
MS-DOS display (see section AH. Emacs and MS-DOS), and the MS-Windows version invoked with
the `-nw' option. Emacs determines automatically whether the
terminal has this capability.
You control the appearance of a part of the text in the buffer by
specifying the face or faces to use for it. The style of display used
for any given character is determined by combining the attributes of
all the applicable faces specified for that character. Any attribute
that isn't specified by these faces is taken from the default
face,
whose attributes reflect the default settings of the frame itself.
Enriched mode, the mode for editing formatted text, includes several commands and menus for specifying faces for text in the buffer. See section T.11.4 Faces in Formatted Text, for how to specify the font for text in the buffer. See section T.11.5 Colors in Formatted Text, for how to specify the foreground and background color.
To alter the appearance of a face, use the customization buffer.
See section AD.2.2.3 Customizing Faces. You can also use X resources to specify
attributes of particular faces (see section AE.13 X Resources). Alternatively,
you can change the foreground and background colors of a specific face
with M-x set-face-foreground and M-x set-face-background.
These commands prompt in the minibuffer for a face name and a color
name, with completion, and then set that face to use the specified
color. Changing the colors of the default
face also changes
the foreground and background colors on all frames, both existing and
those to be created in the future. (You can also set foreground and
background colors for the current frame only; see P.12 Setting Frame Parameters.)
Emacs 21 can correctly display variable-width fonts, but Emacs commands that calculate width and indentation do not know how to calculate variable widths. This can sometimes lead to incorrect results when you use variable-width fonts. In particular, indentation commands can give inconsistent results, so we recommend you avoid variable-width fonts for editing program source code. Filling will sometimes make lines too long or too short. We plan to address these issues in future Emacs versions.
To see what faces are currently defined, and what they look like, type M-x list-faces-display. It's possible for a given face to look different in different frames; this command shows the appearance in the frame in which you type it. Here's a list of the standard defined faces:
default
mode-line
header-line
mode-line
for a window's header line. Most modes
don't use the header line, but the Info mode does.
highlight
isearch
isearch-lazy-highlight-face
region
secondary-selection
bold
italic
bold-italic
underline
fixed-pitch
fringe
scroll-bar
border
cursor
mouse
tool-bar
tooltip
menu
trailing-whitespace
show-trailing-whitespace
is non-nil; see J.5 Trailing Whitespace.
variable-pitch
When Transient Mark mode is enabled, the text of the region is
highlighted when the mark is active. This uses the face named
region
; you can control the style of highlighting by changing the
style of this face (see section AD.2.2.3 Customizing Faces). See section H.2 Transient Mark Mode,
for more information about Transient Mark mode and activation and
deactivation of the mark.
One easy way to use faces is to turn on Font Lock mode. This minor mode, which is always local to a particular buffer, arranges to choose faces according to the syntax of the text you are editing. It can recognize comments and strings in most languages; in several languages, it can also recognize and properly highlight various other important constructs. See section J.2 Font Lock mode, for more information about Font Lock mode and syntactic highlighting.
You can print out the buffer with the highlighting that appears
on your screen using the command ps-print-buffer-with-faces
.
See section AC.19 PostScript Hardcopy.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |