[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Integer & glyph (trunk and emacs_unicode)
From: |
Drew Adams |
Subject: |
RE: Integer & glyph (trunk and emacs_unicode) |
Date: |
Thu, 15 Nov 2007 19:39:55 -0800 |
> > (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 4091 are silently ignored.
> > (if (and face (<= (face-id face) #xfff))
> > (logior char (lsh (face-id face) 19))
> > char))
>
> > So, it assumes 12 bits for face id and 19 bits for char code,
> > the result is an integer of 31 bits.
>
> I suspect that the "19" used to be something else (e.g. 16 when
> integers were 28bits, so 16+12=28).
>
> In any case, the test should be made more robust by not assuming
> anything about the available range of integers (which has changed over
> the years and can change depending on your config).
> How 'bout
>
> (let ((id (and face (face-id face)))
> (if (and (numberp id)
> ;; Due to limitations on Emacs integer values, only
> ;; face ids below a certain limit can be used.
> (= id (lsh (lsh id 19) -19)))
> (logior char (lsh id 19))
> char))
I'm not really following this, but is this about the change from `19' to
`22' in this code (this is my own version, to accommodate both the old and
new)?
(defun make-glyph-code (char &optional face)
"Return a glyph code representing char CHAR with face FACE."
(if face
(logior char (lsh (face-id face)
(if (<= emacs-major-version 22) 19 22)))
char))
That is, is this related to thread "bug of display-table & make-glyph-code,
2007-09-10?
Re: Integer & glyph (trunk and emacs_unicode), Richard Stallman, 2007/11/16