Twemoji emojis don't display in some apps

I configured the following with home-manager:

{
    fonts.fontconfig = {
        enable = true;
        defaultFonts.emoji = [
            "Twitter Color Emoji"
        ];
    };
}

And installed the twemoji-color-font package. However, I still don’t see emojis in alacritty. If I understood that correctly, the code block above should enable Twemoji emojis everywhere, at least that’s how it worked on Arch Linux. That doesn’t happen though.

There are multiple color font formats with different level of support by different toolkits. To avoid the package size blowing up, we have twemoji-color-font containing SVG table and twitter-color-emoji with CBDT. Not sure about Alacrity specifically but most Linux GUI programs need CBDT.

2 Likes

I’ve been trying to debug this issue for a couple of hours:

This issue goes beyond just alacritty, but also other apps, like dmenu. Just to test I tried different ones.

The config I had previously doesn’t work, because for some reason it doesn’t write any files. So I set Twitter Color Emoji to be the emoji font systemwide, in configuration.nix. Now I see emojis properly in GTK apps, rofi and Zathura. Dmenu and alacritty don’t show emojis (it’s just blank) and kitty shows black and white emojis, instead of colored ones.

If I keep the configuration for Twemoji to be the system font but remove the twemoji-color-font package alacritty has black and white emojis, kitty has noto emojis, dmenu has black and white emojis and rofi has noto emojis. I would guess all of that is set as a fallback.

If we have the font installed some apps do show twemojis and some don’t. Probably because some apps render them properly and some don’t, resulting in blank space.

The problem is that emojis used to work everywhere on Arch Linux, using the ttf-twemoji-color package. so it shouldn’t be an issue with a specific application.

If we look inside of the PKGBUILD, we will see what it does. Basically, it pulls a .tar.gz archive from github, installs the ttf font (which differs from the one NixOS uses now, judging by a simple diff) and installs a fontconfig rule to /usr/share/fontconfig/conf.avail/46-ttf-twemoji-color.conf.
I tried to replicate that: installed the ttf to ~/.local/share/fonts/ and the rule via using fonts.fontconfig.localConf in configuration.nix. That results in dmenu showing blank space, alacritty showing blank space, rofi and zathura showing twemojis, kitty showing black and white emojis.

UPD: Seems like alacritty (and most likely other tested apps) don’t just show black and white emojis. Now, without twitter-color-emoji installed alacritty shows some colored noto emojis, some, however, are black and white