2

Frustratingly, I am unable to make emoji render properly in any terminal on up-to-date Ubuntu 22.04. I have them working in the browser (fully expected), LibreOffice, even Emacs shell but not in any of my terminals. I've checked the locale (en_GB.UTF-8), fc-list "MesloLGS NF Regular" (or any other emoji friendly font installed with apt like fonts-noto-color-emoji or fonts-emojione and they all check out. I've rebuilt the fc-cache.

If I run shell in emacs alongside a terminal window and run the same commands in both, I get identical answers until I try to cat my test file. In Emacs shell I get

Hello World 

but in terminal (either Tilix, Guake or GNOME Termial 3.44.0) I get

Hello World  

Yes, the emoji character is there, it is just displayed as an empty character (and I know that because it pasted into my browser correctly so I had to remove it for illustrative purposes).

As requested, running

od -c emoji_test.txt

puts out

0000000   H   e   l   l   o       W   o   r   l   d     360 237 230 204
0000020  \n

The hex for the test emoji should be 😄 1F604 hex maps to 373004 in octal so I think I've got that bit right.

It doesn't make any difference what shell I'm running - zsh, bash or even sh.

I'm running libcairo2 version 1.16.0-5ubuntu2 and I do have an emoji conf file in .config/fontmanager/conf.d pointing to Noto Color Emoji.

I know I'm being stupid somewhere but has anyone got a debug guide to help me pin point just where?

rolandw
  • 33

4 Answers4

2

Whether a glyph is displayed will depend on whether the font you are using supports it. If you switch to one that has emoji support, it should work as you expect. You mentioned Noto in your question, so try that. Open gnome-terminal, go to Preferences -> "Custom font" and choose Noto or something like Ubuntu Mono:

screenshot of gnome terminal preferences showing Ubuntu Mono as the selected font

This should let you see emojis:

screenshot of gnome terminal with working emoji

terdon
  • 104,119
1

TLDR; There are chances that you have the font file in multiple system font folders. Remove those & try installing fonts-noto-color-emoji again.

I faced the same issue, even after I installed fonts-noto-color-emoji( as advised here and various other forums ) my system couldn't render emojis on the terminal, gedit, emote (emoji-picker), etc.

I stumbled upon this. And then when I ran $ fc-cache -f -v on my terminal, I figured that I had multiple folders with the same font file. I just removed them manually & did the process again.

dirtbkr
  • 11
0

This a more detailed version of @dirtbkr's answer, which is too much for a comment or edit, but migth add some more hints:

TL;TR: You might have duplicate font files. Use this command to locate them:

find /usr/share/fonts/truetype -name Noto\*

If you have installed fonts manually, you might recognize them in this list already. Delete the duplicates. You should keep the ones in /usr/share/fonts/truetype/noto - these should be the ones installed from the package fonts-noto-color-emoji.

If this did not help proceed with the long answer below.

Then run fc-cache -f -v.

Any running processes might still use the old files, so restart programs you use to test it (e.g. Libre Office). For some programs you might need to logout and log in again (e.g. the Gnome terminal).

Longer answer:

I've used this script to install all Google fonts. Turns out, using install scripts instead of official package repositories can break things, even if it is only about font files.

In my case, I simply removed all Google Fonts matching Noto*.

The following command lists all files with duplicate filename in the global font directory:

find /usr/share/fonts/ -type f -exec basename {} \; | sort | uniq -d

Use fc-list : file to find other font directories - you might need to widen your search.

Why?

I couldn't figure out. I tried removing the packages fonts-noto-color-emoji, fonts-noto-core, fonts-noto-cjk. After that, there were no other fonts installed in /usr/share/fonts/truetype/noto. So I thought I could use all Google Fonts and use the emojis from there. However, this did not work - no emojis displayed in this case.

See also

lumbric
  • 4,129
0

Having "duplicates" in your font folders causes emojis to render as blanks. In my case, I had both NotoEmojiColor-Regular.ttf and NotoEmojiColor.ttf in my /usr/share/fonts/truetype/noto/ folder. Simply removing one of the files solved the issue.