1

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.

3
  • 1
    Are you really absolutely sure that the lock character is actually present in that font? Have you used a font viewer to check? Because many applications will silently fall back to a different font if an appropriate glyph is not found in the chosen font. It may be that Emacs was unable to do this. Oh, also that is an emoji character, which I believe that Emacs only recently gained support for. I don’t recall which version that happened in; you might try Emacs 28.
    – db48x
    Sep 24 at 15:16
  • I'm positive. I'm using the exact same font in the gnome terminal exactly because it has these characters. I believe Emacs 27 introduced emoji support, so that should be fine as well. I'm kind of suspecting my buster-backports build though, perhaps it doesn't have what is needed to cut the cheese: Multicolor fonts can be displayed on Emacs configured with Cairo drawing and linked with cairo >= 1.16.0." But when I ldd emacs, it shows that it is linked to libcario.so.2, and the libcairo version also checks. Sep 27 at 6:10
  • You know what, you could be right. 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. Sep 27 at 8:05
1

It appears that the MesloLGS NF 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.

Using an emoji font like Noto Color Emoji solves the primary issue.

1
  • 2
    Sadly everything having to do with fonts is “more tricky than meets the eye”.
    – db48x
    Sep 27 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.