Function: char-displayable-on-frame-p

char-displayable-on-frame-p is a byte-compiled function defined in mule.el.gz.

Signature

(char-displayable-on-frame-p CHAR &optional FRAME)

Documentation

Return non-nil if CHAR can be displayed in FRAME.

FRAME nil means the selected frame.

This function provides a stricter test than char-displayable-p does for determining if a character will display properly: in the graphical case, it does not check whether the underlying terminal can encode the character.

Specifically, this function returns non-nil:

- for a text terminal, if char-displayable-p returns non-nil.

- for a graphical terminal, if char-displayable-p returns either t or
  a font object.

The two functions differ in behavior (i.e., char-displayable-strict-p returns nil but char-displayable-p does not) if the underlying terminal is graphical and can encode the character, but FRAME cannot.

View in manual

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule.el.gz
(defun char-displayable-on-frame-p (char &optional frame)
  "Return non-nil if CHAR can be displayed in FRAME.
FRAME nil means the selected frame.

This function provides a stricter test than `char-displayable-p' does
for determining if a character will display properly: in the graphical
case, it does not check whether the underlying terminal can encode the
character.

Specifically, this function returns non-nil:

- for a text terminal, if `char-displayable-p' returns non-nil.

- for a graphical terminal, if `char-displayable-p' returns either t or
  a font object.

The two functions differ in behavior (i.e., `char-displayable-strict-p'
returns nil but `char-displayable-p' does not) if the underlying
terminal is graphical and can encode the character, but FRAME cannot."
  (let ((display-capability (with-selected-frame (or frame (selected-frame))
                              (char-displayable-p char))))
    (if (display-graphic-p frame)
        (or (eq display-capability t)
            (fontp display-capability))
      display-capability)))