I'm using Gnu Emacs 27.1 GTK on Debian 10 from buster-backports. I'm also using the MesloLGS NF font that ships with zsh powerlevel10k, and has a heck of a lot of unicode characters. Nonetheless, Emacs does not bother to display most the characters in the unicode-smp charset, all I see are the classic boxes with hex code in them. E.g., the 🔒 character (0x1f512) renders just fine in my terminal using the same font, but does not in Emacs.
I tried googling for the solution, but nothing I found so far helped. E.g., I tried calling set-fontset-font
and tell it to use the default font for the entire range, to no avail. What I don't want to do is to install several other fonts and use a mixed font set to display all the characters, just give me what MesloLGS offers (which is a lot). I also do not see how the package unicode-fonts would help, but I tried it nonetheless, without success.
I double checked and Emacs seems to be using cairo and harfbuzz just finem the backend being used is ftcrhb
. Here is the output of describe-char
for Greek alpha, for example:
position: 3 of 5 (40%), column: 0
character: α (displayed as α) (codepoint 945, #o1661, #x3b1)
charset: unicode-bmp (Unicode Basic Multilingual Plane (U+0000..U+FFFF))
code point in charset: 0x03B1
script: greek
syntax: w which means: word
category: .:Base, G:2-byte Greek, L:Left-to-right (strong), c:Chinese, g:Greek, h:Korean, j:Japanese
to input: type "C-x 8 RET 3b1" or "C-x 8 RET GREEK SMALL LETTER ALPHA"
buffer code: #xCE #xB1
file code: #xCE #xB1 (encoded by coding system utf-8-unix)
display: by this font (glyph code)
ftcrhb:-PfEd-MesloLGS NF-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1 (#x2F6)
The same kind of output for the lock icon, however:
position: 1 of 5 (0%), column: 0
character: 🔒 (displayed as 🔒) (codepoint 128274, #o372422, #x1f512)
charset: unicode (Unicode (ISO10646))
code point in charset: 0x1F512
script: symbol
syntax: w which means: word
category: .:Base
to input: type "C-x 8 RET 1f512" or "C-x 8 RET LOCK"
buffer code: #xF0 #x9F #x94 #x92
file code: #xF0 #x9F #x94 #x92 (encoded by coding system utf-8-unix)
display: no font available
My Emacs of course, contrary to your browser, does not display the lock symbols in the second row, only the boxes. And it beats me why it keeps saying "no font available". After several hours of searching and trying, I gave up. Any help would be greatly appreciated!
Update: With Noto Color Emoji and adding this line to my .emacs:
(set-fontset-font t 'symbol "Noto Color Emoji" nil)
The special characters render just fine. I would still like to figure out why Emacs is unable to use the same characters from MesloLGS NF, though.
2nd update: it appears that the MesloLGS font does not include emojis after all. It is more tricky than meets the eye to find a program which shows you which characters appear in a font and which don't.
I'm closing this issue as resolved now, since using Noto Color Emoji solves the primary issue.
ldd emacs
, it shows that it is linked to libcario.so.2, and the libcairo version also checks.gnome-terminal
is a tricky little beast and it seems that it secretly uses a different font for emojis, even though there is no sign of this in its preferences. Perhaps MesloLGS NF does not include emojis afterall.