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:
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
Like Tianxiang said this is a question of the font being used. Emacs still allows some introspection in that respect.
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