* Re: Problem with glyphs with face-id over 128 in unicode-2 emacs
[not found] <87tzjytzww.fsf@gmail.com>
@ 2008-02-27 22:58 ` Kim F. Storm
2008-02-28 16:41 ` Richard Stallman
0 siblings, 1 reply; 2+ messages in thread
From: Kim F. Storm @ 2008-02-27 22:58 UTC (permalink / raw)
To: Eduardo Ochs; +Cc: bug-gnu-emacs, emacs-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread