Next: , Previous: , Up: Customization   [Contents][Index]


27.8 Faces

SXEmacs has objects called extents and faces. An extent is a region of text and a face is a collection of textual attributes, such as fonts and colors. Every extent is displayed in some face; therefore, changing the properties of a face immediately updates the display of all associated extents. Faces can be frame-local: you can have a region of text that displays with completely different attributes when its buffer is viewed from a different X window.

The display attributes of faces may be specified either in Lisp or through the X resource manager.

27.8.1 Customizing Faces

You can change the face of an extent with the functions in this section. All the functions prompt for a face as an argument; use completion for a list of possible values.

M-x invert-face

Swap the foreground and background colors of the given face.

M-x make-face-bold

Make the font of the given face bold. When called from a program, returns nil if this is not possible.

M-x make-face-bold-italic

Make the font of the given face bold italic. When called from a program, returns nil if not possible.

M-x make-face-italic

Make the font of the given face italic. When called from a program, returns nil if not possible.

M-x make-face-unbold

Make the font of the given face non-bold. When called from a program, returns nil if not possible.

M-x make-face-unitalic

Make the font of the given face non-italic. When called from a program, returns nil if not possible.

M-x make-face-larger

Make the font of the given face a little larger. When called from a program, returns nil if not possible.

M-x make-face-smaller

Make the font of the given face a little smaller. When called from a program, returns nil if not possible.

M-x set-face-background

Change the background color of the given face.

M-x set-face-background-pixmap

Change the background pixmap of the given face.

M-x set-face-font

Change the font of the given face.

M-x set-face-foreground

Change the foreground color of the given face.

M-x set-face-underline-p

Change whether the given face is underlined.

You can exchange the foreground and background color of the selected face with the function invert-face. If the face does not specify both foreground and background, then its foreground and background are set to the background and foreground of the default face. When calling this from a program, you can supply the optional argument frame to specify which frame is affected; otherwise, all frames are affected.

The work of make-face-bold, make-face-bold-italic, make-face-italic, make-face-unbold, make-face-unitalic functions is affected by face-frob-from-locale-first variable. If it is nil, those functions first try to manipulate device specific data like X font names to obtain the desired font face specification. This may be unsuitable in environments using different font face specifications for different frames, non-Mule environments in particular.

If the variable is non-nil, those functions first try to figure out whether the face font is the same as one of predefined faces: default, bold, italic, bold-italic. If it is the same, then the new face font specification is set to be the same as that of a corresponding predefined face. Thus if the predefined face is set up properly for different frames, the same will hold for the face being changed by the functions. This is the behavior one might desire in non-Mule environments mentioned above: face being changed still looks right in all frames.

How predefined faces might be set up for different frames in such an environments is described in Face Resources.

You can set the background color of the specified face with the function set-face-background. The argument color should be a string, the name of a color. When called from a program, if the optional frame argument is provided, the face is changed only in that frame; otherwise, it is changed in all frames.

You can set the background pixmap of the specified face with the function set-face-background-pixmap. The pixmap argument name should be a string, the name of a file of pixmap data. The directories listed in the x-bitmap-file-path variable are searched. The bitmap may also be a list of the form (width height data), where width and height are the size in pixels, and data is a string containing the raw bits of the bitmap. If the optional frame argument is provided, the face is changed only in that frame; otherwise, it is changed in all frames.

The variable x-bitmap-file-path takes as a value a list of the directories in which X bitmap files may be found. If the value is nil, the list is initialized from the *bitmapFilePath resource.

If the environment variable XBMLANGPATH is set, then it is consulted before the x-bitmap-file-path variable.

You can set the font of the specified face with the function set-face-font. The font argument should be a string, the name of a font. When called from a program, if the optional frame argument is provided, the face is changed only in that frame; otherwise, it is changed in all frames.

You can set the foreground color of the specified face with the function set-face-foreground. The argument color should be a string, the name of a color. If the optional frame argument is provided, the face is changed only in that frame; otherwise, it is changed in all frames.

You can set underline the specified face with the function set-face-underline-p. The argument underline-p can be used to make underlining an attribute of the face or not. If the optional frame argument is provided, the face is changed only in that frame; otherwise, it is changed in all frames.


Next: , Previous: , Up: Customization   [Contents][Index]