Skip to main content

39.22.4 Glyphs

A glyph is a graphical symbol which occupies a single character position on the screen. Each glyph is represented in Lisp as a glyph code, which specifies a character and optionally a face to display it in (see Faces). The main use of glyph codes is as the entries of display tables (see Display Tables). The following functions are used to manipulate glyph codes:

function make-glyph-code char \&optional face​

This function returns a glyph code representing char char with face face. If face is omitted or nil, the glyph uses the default face; in that case, the glyph code is an integer. If face is non-nil, the glyph code is not necessarily an integer object.

function glyph-char glyph​

This function returns the character of glyph code glyph.

function glyph-face glyph​

This function returns face of glyph code glyph, or nil if glyph uses the default face.

You can set up a glyph table to change how glyph codes are actually displayed on text terminals. This feature is semi-obsolete; use glyphless-char-display instead (see Glyphless Chars).

variable glyph-table​

The value of this variable, if non-nil, is the current glyph table. It takes effect only on character terminals; on graphical displays, all glyphs are displayed literally. The glyph table should be a vector whose gth element specifies how to display glyph code g, where g is the glyph code for a glyph whose face is unspecified. Each element should be one of the following:

nil​

Display this glyph literally.

a string​

Display this glyph by sending the specified string to the terminal.

a glyph code​

Display the specified glyph code instead.

Any integer glyph code greater than or equal to the length of the glyph table is displayed literally.