Is there any way to create a custom image (e.g., using an xpm format) and use it in the display-table
?
I see that XEmacs had a function called make-glyph
-- e.g., (make-glyph '([xpm :file "~/something.xpm"] [string :data "[END]"]))
. However, regular Emacs doesn't have that function.
The function make-glyph-code
requires a character (e.g., ?\U0001D4D5
) -- and there is an optional face
argument (e.g., 'font-lock-warning-face
).
I would like to do something similar to:
(when (not buffer-display-table)
(setq buffer-display-table (make-display-table)))
(aset buffer-display-table ?\014 form-feed)
(defvar form-feed `(image :type xpm :mask nil :ascent center :data
"/* XPM */
static char * form_feed_xpm[] = {
\"11 20 5 1\",
\" c None\",
\". c purple\",
\"+ c yellow\",
\"@ c #7F0000\",
\"% c yellow\",
\"%%%%%%%%%%%\",
\"%.........%\",
\"%.........%\",
\"%.........%\",
\"%.........%\",
\"%...++++++%\",
\"%.++.++...%\",
\"%+...+....%\",
\"%+...+....%\",
\"%+...+....%\",
\"%+...++++.%\",
\"%....+....%\",
\"%...++....%\",
\"%...+.....%\",
\"%.++++....%\",
\"%.........%\",
\"%.........%\",
\"%.........%\",
\"%.........%\",
\"%%%%%%%%%%%\"};"))
EDIT: As a first impression, it seemed that the library gamegrid.el
might have been using the concept outlined above. However, it turned out that gamegrid.el
uses the buffer-display-table
as a buffer-local storage facility for the xpm
images, which are later used by the function gamegrid-set-face
to add-text-properties
using the 'display
property. While it was a good excuse to play pong and tetris, it did not resolve this particular question.