bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Problem with glyphs with face-id over 128 in unicode-2 emacs


From: Kim F. Storm
Subject: Re: Problem with glyphs with face-id over 128 in unicode-2 emacs
Date: Wed, 27 Feb 2008 23:58:20 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

As promised a long time ago, I have installed changes (and cleaned up
related code) to fix the problem with encoding face ids in integer
glyph codes.


Eduardo Ochs <eduardoochs@gmail.com> writes:

> Suppose that we have more than 128 faces defined, and that we want to
> make, say, all "\^O"s be displayed as "*"s with the face
> `face-with-id-138'; we would try to do this:
>
>   (aset standard-display-table ?\^O
>       (vector (make-glyph-code ?* 'face-with-id-138)))
>
> where, of course, face-with-id-138 is a face for which:
>
>   (face-id 'face-with-id-138)
>      ==> 138.
>
> Then we will notice that the "\^O"s get displayed using the face with
> face-id=10 instead (by the way: here (face-id 'highlight) is 10)...
>
> Here's what is happening: `make-glyph-code' has this definition (in
> "disp-table.el" in emacs-unicode-2, i.e., in CVS Emacs after the merge
> or the unicode-2 branch):
>
>   (defun make-glyph-code (char &optional face)
>     "Return a glyph code representing char CHAR with face FACE."
>     ;; Due to limitations on Emacs integer values, faces with
>     ;; face id greater that 512 are silently ignored.
>     (if (and face (<= (face-id face) #x1ff))
>         (logior char (lsh (face-id face) 22))
>       char))
>
> That magic number, 22, used to be 19 in pre-unicode-2 Emacs.
>
> The problem is that (lsh 128 22) is 0, and so (lsh 138 22) drops the
> bit corresponding to the 128 in the shift, and its result is the same
> as of (lsh 10 22).


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk





reply via email to

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