Function: describe-char-display

describe-char-display is a byte-compiled function defined in descr-text.el.gz.

Signature

(describe-char-display POS CHAR)

Source Code

;; Defined in /usr/src/emacs/lisp/descr-text.el.gz
;; Return information about how CHAR is displayed at the buffer
;; position POS.  If the selected frame is on a graphic display,
;; return a string "FONT-DRIVER:FONT-NAME (GLYPH-CODE)" where:
;;   FONT-DRIVER is the font-driver name,
;;   FONT-NAME is the font name,
;;   GLYPH-CODE is a hexadigit string representing the glyph-ID.
;; Otherwise, return a string describing the terminal codes for the
;; character.
(defun describe-char-display (pos char)
  (if (display-graphic-p (selected-frame))
      (let ((char-font-info (internal-char-font pos char)))
	(if char-font-info
	    (let ((type (font-get (car char-font-info) :type))
		  (name (font-xlfd-name (car char-font-info)))
		  (code (cdr char-font-info)))
	       (if (integerp code)
		   (format "%s:%s (#x%02X)" type name code)
		 (format "%s:%s (#x%04X%04X)"
			 type name (car code) (cdr code))))))
    (let* ((charset (get-text-property pos 'charset))
	   (coding (or (terminal-coding-system) 'us-ascii))
	   (encoded (encode-coding-char char coding charset)))
      (if encoded
	  (encoded-string-description encoded coding)))))