Is there a way to programmatically determine whether a given unicode character will render as tofu in some context in Emacs?
Some bug-flavored (U+1F41B) tofu renders in a face using DejaVu Sans Mono:
Is there a way to programmatically determine whether a given unicode character will render as tofu in some context in Emacs?
Some bug-flavored (U+1F41B) tofu renders in a face using DejaVu Sans Mono:
The function char-displayable-p
was added for that kind of purpose, but I'm not sure it does what it purports to in all cases. If it doesn't work for you, please report it as a bug.
Like Tianxiang said this is a question of the font being used. Emacs still allows some introspection in that respect.
The internal-char-font
function allows you to see if a character is defined in the current font. There is a comment describing the function in font.c
. It says
It returns nil in the following cases:
(1) The window system doesn't have a font for the character (thus
it is displayed by an empty box).
That means that you can do something like:
(internal-char-font nil (string-to-char "\u0034"))
to see if the character represented by "\u0034" has a character in the current font