Next: Redisplay Glyphs, Previous: Creating Glyphs, Up: Using Glyphs [Contents][Index]
Creating a glyph using make-glyph
does not specify where
the glyph will be used, it only specifies what the glyph will
look like. Once you have created a glyph, you specify where it will be
used by attaching it to an extent as a begin-glyph or
end-glyph.
buffer text
To insert a glyph into a buffer, create an extent in the buffer and then
use set-extent-begin-glyph
or set-extent-end-glyph
to set
a glyph to be displayed at the corresponding edge of the extent. (It is
common to create zero-width extents for this purpose.)
margins
To insert a glyph into the left or right margin of a buffer, first
make sure the margin is visible by setting a value for the specifiers
left-margin-width
or right-margin-width
. (Not strictly necessary
when using margin glyphs with layout policy whitespace
.) Follow
the same procedure above for inserting a glyph in a buffer, then
set a non-default layout policy for the glyph using
set-extent-begin-glyph-layout
or set-extent-end-glyph-layout
.
Alternatively, use the high-level annotations API (see
make-annotation
). (In fact, you can also use the annotations
API for glyphs in a buffer, by setting a layout policy of text
.)