aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/disp-table.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/disp-table.el b/lisp/disp-table.el
index a71ef02e8cb..9124353884b 100644
--- a/lisp/disp-table.el
+++ b/lisp/disp-table.el
@@ -190,19 +190,27 @@ X frame."
190 "Return a glyph code representing char CHAR with face FACE." 190 "Return a glyph code representing char CHAR with face FACE."
191 ;; Due to limitations on Emacs integer values, faces with 191 ;; Due to limitations on Emacs integer values, faces with
192 ;; face id greater that 512 are silently ignored. 192 ;; face id greater that 512 are silently ignored.
193 (if (and face (<= (face-id face) #x1ff)) 193 (if (not face)
194 (logior char (lsh (face-id face) 22)) 194 char
195 char)) 195 (let ((fid (face-id face)))
196 (cond
197 ((not fid) (error "unknown face"))
198 ((< fid 64) ; we have 32 - 3(LSB) - 1(SIGN) - 22(CHAR) = 6 bits for face id
199 (logior char (lsh fid 22)))
200 (t (cons char fid))))))
196 201
197;;;###autoload 202;;;###autoload
198(defun glyph-char (glyph) 203(defun glyph-char (glyph)
199 "Return the character of glyph code GLYPH." 204 "Return the character of glyph code GLYPH."
200 (logand glyph #x3fffff)) 205 (if (consp glyph)
206 (car glyph)
207 (logand glyph #x3fffff)))
201 208
202;;;###autoload 209;;;###autoload
203(defun glyph-face (glyph) 210(defun glyph-face (glyph)
204 "Return the face of glyph code GLYPH, or nil if glyph has default face." 211 "Return the face of glyph code GLYPH, or nil if glyph has default face."
205 (let ((face-id (lsh glyph -22))) 212
213 (let ((face-id (if (consp glyph) (cdr glyph) (lsh glyph -22))))
206 (and (> face-id 0) 214 (and (> face-id 0)
207 (car (delq nil (mapcar (lambda (face) 215 (car (delq nil (mapcar (lambda (face)
208 (and (eq (get face 'face) face-id) 216 (and (eq (get face 'face) face-id)