GNU Info

Info Node: (emacs)Faces

(emacs)Faces


Next: Font Lock Up: Display
Enter node , (file) or (file)node

Using Multiple Typefaces
========================

   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 (Note: 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.  Note:
Format Faces, for how to specify the font for text in the buffer.
Note: Format Colors, for how to specify the foreground and background
color.

   To alter the appearance of a face, use the customization buffer.
Note: Face Customization.  You can also use X resources to specify
attributes of particular faces (Note: Resources X).  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 Note: 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'
     This face is used for ordinary text that doesn't specify any other
     face.

`mode-line'
     This face is used for mode lines.  By default, it's drawn with
     shadows for a "raised" effect on window systems, and drawn as the
     inverse of the default face on non-windowed terminals.  Note:
     Display Custom.

`header-line'
     Similar to `mode-line' for a window's header line.  Most modes
     don't use the header line, but the Info mode does.

`highlight'
     This face is used for highlighting portions of text, in various
     modes.  For example, mouse-sensitive text is highlighted using
     this face.

`isearch'
     This face is used for highlighting Isearch matches.

`isearch-lazy-highlight-face'
     This face is used for lazy highlighting of Isearch matches other
     than the current one.

`region'
     This face is used for displaying a selected region (when Transient
     Mark mode is enabled--see below).

`secondary-selection'
     This face is used for displaying a secondary X selection (Note:
     Secondary Selection).

`bold'
     This face uses a bold variant of the default font, if it has one.

`italic'
     This face uses an italic variant of the default font, if it has
     one.

`bold-italic'
     This face uses a bold italic variant of the default font, if it
     has one.

`underline'
     This face underlines text.

`fixed-pitch'
     The basic fixed-pitch face.

`fringe'
     The face for the fringes to the left and right of windows on
     graphic displays.  (The fringes are the narrow portions of the
     Emacs frame between the text area and the window's right and left
     borders.)

`scroll-bar'
     This face determines the visual appearance of the scroll bar.

`border'
     This face determines the color of the frame border.

`cursor'
     This face determines the color of the cursor.

`mouse'
     This face determines the color of the mouse pointer.

`tool-bar'
     This is the basic tool-bar face.  No text appears in the tool bar,
     but the colors of this face affect the appearance of tool bar
     icons.

`tooltip'
     This face is used for tooltips.

`menu'
     This face determines the colors and font of Emacs's menus.
     Setting the font of LessTif/Motif menus is currently not
     supported; attempts to set the font are ignored in this case.

`trailing-whitespace'
     The face for highlighting trailing whitespace when
     `show-trailing-whitespace' is non-nil; see Note: Trailing
     Whitespace.

`variable-pitch'
     The basic variable-pitch face.

   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 (Note: Face Customization).  Note: Transient
Mark, 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.  Note: Font Lock, 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'.  Note:
PostScript.


automatically generated by info2www version 1.2.2.9