summaryrefslogtreecommitdiff
path: root/lisp/disp-table.el
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2007-02-14 11:28:40 +0000
committerKim F. Storm <storm@cua.dk>2007-02-14 11:28:40 +0000
commit7dbfbd9191092032c2878b6d0eac28773e2982e5 (patch)
treef1f31341690800450917ed655eac930f8be63394 /lisp/disp-table.el
parentda55bb9600b988d1ccba72c6272b8df64e218bf2 (diff)
downloademacs-7dbfbd9191092032c2878b6d0eac28773e2982e5.tar.gz
(make-glyph-code, glyph-char, glyph-face): New defuns.
(standard-display-underline): Use make-glyph-code.
Diffstat (limited to 'lisp/disp-table.el')
-rw-r--r--lisp/disp-table.el26
1 files changed, 25 insertions, 1 deletions
diff --git a/lisp/disp-table.el b/lisp/disp-table.el
index fa98086b0bc..2a4dd01897d 100644
--- a/lisp/disp-table.el
+++ b/lisp/disp-table.el
@@ -172,7 +172,7 @@ X frame."
(aset standard-display-table c
(vector
(if window-system
- (logior uc (lsh (face-id 'underline) 19))
+ (make-glyph-code uc 'underline)
(create-glyph (concat "\e[4m" (char-to-string uc) "\e[m"))))))
;;;###autoload
@@ -187,6 +187,30 @@ X frame."
(1- (length glyph-table)))
;;;###autoload
+(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))
+
+;;;###autoload
+(defun glyph-char (glyph)
+ "Return the character of glyph code GLYPH."
+ (logand glyph #x7ffff))
+
+;;;###autoload
+(defun glyph-face (glyph)
+ "Return the face of glyph code GLYPH, or nil if glyph has default face."
+ (let ((face-id (lsh glyph -19)))
+ (and (> face-id 0)
+ (car (delq nil (mapcar (lambda (face)
+ (and (eq (get face 'face) face-id)
+ face))
+ (face-list)))))))
+
+;;;###autoload
(defun standard-display-european (arg)
"Semi-obsolete way to toggle display of ISO 8859 European characters.