[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
19.5 Using Multiple Typefaces
You can specify various styles for displaying text using faces. Each face can specify various face attributes, such as the font family, the height, weight and slant of the characters, the foreground and background color, and underlining or overlining. A face does not have to specify all of these attributes; often it inherits most of them from another face.
On graphical display, all the Emacs face attributes are meaningful. On a text-only terminal, only some of them work. Some text-only terminals support inverse video, bold, and underline attributes; some support colors. Text-only terminals generally do not support changing the height and width or the font family.
Emacs uses faces automatically for highlighting, through the work of
Font Lock mode. See section 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 PostScript Hardcopy.
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 Faces in Formatted Text, for how to specify the font for text in the buffer. See section 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 Customizing Faces. You can also use X resources to specify
attributes of particular faces (see section 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 Setting Frame Parameters.)
If you want to alter the appearance of all Emacs frames, you need to
customize the frame parameters in the variable
default-frame-alist
; see default-frame-alist.
Emacs 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.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |