Function: char-displayable-p
char-displayable-p is a byte-compiled function defined in mule.el.gz.
Signature
(char-displayable-p CHAR)
Documentation
Return non-nil if we should be able to display CHAR.
On a multi-font display, the test is only whether there is an appropriate font from the selected frame's fontset to display CHAR's charset in general. Since fonts may be specified on a per-character basis, this may not be accurate.
Probably introduced at or before Emacs version 22.1.
Source Code
;; Defined in /usr/src/emacs/lisp/international/mule.el.gz
(defun char-displayable-p (char)
"Return non-nil if we should be able to display CHAR.
On a multi-font display, the test is only whether there is an
appropriate font from the selected frame's fontset to display
CHAR's charset in general. Since fonts may be specified on a
per-character basis, this may not be accurate."
(cond ((< char 128)
;; ASCII characters are always displayable.
t)
((not enable-multibyte-characters)
;; Maybe there's a font for it, but we can't put it in the buffer.
nil)
(t
(let ((font-glyph (internal-char-font nil char)))
(if font-glyph
(if (consp font-glyph)
;; On a window system, a character is displayable
;; if a font for that character is in the default
;; face of the currently selected frame.
(car font-glyph)
;; On a text terminal supporting glyph codes, CHAR is
;; displayable if its glyph code is nonnegative.
(<= 0 font-glyph))
;; On a text terminal without glyph codes, CHAR is displayable
;; if the coding system for the terminal can encode it.
(let ((coding (terminal-coding-system)))
(when coding
(let ((cs-list (coding-system-get coding :charset-list)))
(cond
((listp cs-list)
(catch 'tag
(mapc (lambda (charset)
(if (encode-char char charset)
(throw 'tag charset)))
cs-list)
nil))
((eq cs-list 'iso-2022)
(catch 'tag2
(mapc (lambda (charset)
(if (and (plist-get (charset-plist charset)
:iso-final-char)
(encode-char char charset))
(throw 'tag2 charset)))
charset-list)
nil))
((eq cs-list 'emacs-mule)
(catch 'tag3
(mapc (lambda (charset)
(if (and (plist-get (charset-plist charset)
:emacs-mule-id)
(encode-char char charset))
(throw 'tag3 charset)))
charset-list)
nil)))))))))))