emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug of display-table & make-glyph-code


From: Eli Zaretskii
Subject: Re: bug of display-table & make-glyph-code
Date: Fri, 07 Sep 2007 11:47:17 +0300

> From: Kenichi Handa <address@hidden>
> Date: Fri, 07 Sep 2007 14:11:35 +0900
> Cc: address@hidden, address@hidden, address@hidden, address@hidden,
>       address@hidden
> 
> I started to study the glyph related codes, and ran into the
> function create-glyph (disp-table.el).  It is a strange
> function, and I don't understand how to utilize it.  Could
> someone please explain it?

I'm not sure what is there to explain, since the code looks quite
self-explanatory, if read in together with the "Glyphs" node in the
ELisp manual.  Perhaps I'm missing something; if the below doesn't
help, please ask specific questions.

`create-glyph' is used on a character terminal to create a glyph that
is displayed instead of some character C.  The way you use it is like
this:

  (aset standard-display-table c
        (vector (create-glyph (concat "\e(0" (char-to-string gc) "\e(B")))))

This sets up the slot for C in standard-display-table to send to the
terminal the string `(concat "\e(0" (char-to-string gc) "\e(B")))'
(where GC is a code of some other character).

standard-display-table needs an integer code of a glyph to put in the
slot used to display C.  Therefore, `create-glyph' returns such an
integer, which is an index into a glyph table.  In the glyph table,
the first 256 slots are left unused, to avoid affecting the ASCII and
unibyte non-ASCII ranges.  Starting from entry #256 (zero-based),
`create-glyph' adds a new entry for its argument (which is a string to
be sent to the terminal when a specific character is displayed), and
stores that string argument in glyph-table.

Thereafter, when character C is to be displayed, Emacs will look it up
in standard-display-table and see that its slot has a glyph index.
Emacs will then look up that index's slot in glyph-table, fetch the
string stored at that slot, and send the string to the terminal.
Presumably, the string uses character terminal escape sequences to
produce the desired effect, such as underlining the character etc.

Did I manage to answer your question?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]