Emoji fonts for Alacritty in Debian 11

Emoji fonts for Alacritty in Debian 11

I am using Alacritty on my Debian GNU/Linux 11 "bullseye" as my primary terminal emulator.

I have to add some customizations to render "emoji fonts" in my Alacritty terminal. I will be adding thoe customization commands and files, hope others can use it on their platform.

I would like to thank TheBunnyMan123 github user, as I am primarily using his customizations as he specified in his gist:

noto-color-emoji-linux.md
GitHub Gist: instantly share code, notes, and snippets.

Install required fonts

We need the following font packages from the Debian 11 official repository.

  • fonts-noto-core
  • fonts-noto-mono
  • fonts-noto-extra
  • fonts-noto-ui-core
  • fonts-noto-color-emoji

You can install all these fonts using:

sudo apt install fonts-noto-core fonts-noto-mono fonts-noto-extra fonts-noto-ui-core fonts-noto-color-emoji

You may also need to install twemoji on your debian, but this package have to be extracted from a Ubuntu package repo.

You need to add a new apt repository, lets create a new file using below command:

sudo vi /etc/apt/sources.list.d/twemoji-color-font.list

Then you should add the below content to this file:

# Twemoji Ubuntu Packages
deb http://ppa.launchpad.net/eosrei/fonts/ubuntu focal main
deb-src http://ppa.launchpad.net/eosrei/fonts/ubuntu focal main

Then import the APT Signing key for eosrei/fonts PPA using:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E2355710884EB80144EAB769ADA83EDC62D7EDF8

Then do:

sudo apt update && sudo apt install fonts-twemoji-svginot

Now we are done with installing the required packages.

Customize Configs for Colored Emoji Fonts

We need to copy two files from his repository below:

GitHub - TheBunnyMan123/config-files
Contribute to TheBunnyMan123/config-files development by creating an account on GitHub.

You need to add two files in ~/.config/fontconfig/ directory on our Debian. So lets do that.

Create a new file : ~/.config/fontconfig/fonts.conf file with below content.

<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- REQUIRES Noto fonts (along with Noto Color Emoji) 
     run `fc-list | grep -i -e "noto sans" -e "noto serif" -e "noto color emoji"` to confirm and sudo apt-get install fonts-noto to install the fonts
-->

 <alias>
 <!-- Change the string in the family tag to whatever font -->
    <family>serif</family>
    <prefer><family>Noto Serif</family></prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer><family>Noto Sans</family></prefer>
  </alias>
  <alias>
    <family>sans</family>
    <prefer><family>Noto Sans</family></prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer><family>Noto Mono</family></prefer>
  </alias>

   <!-- This adds Noto Color Emoji to the font families sans, serif, sans-serif and monospace -->
  <match target="pattern">
        <test name="family"><string>monospace</string></test>
        <edit name="family" mode="append"><string>Noto Color Emoji</string></edit>
  </match>
  <match target="pattern">
        <test name="family"><string>sans</string></test>
        <edit name="family" mode="append"><string>Noto Color Emoji</string></edit>
  </match>

  <match target="pattern">
        <test name="family"><string>serif</string></test>
        <edit name="family" mode="append"><string>Noto Color Emoji</string></edit>
  </match>
  <!-- Discord loads the system's sans-serif font family, add Noto Color Emoji to it -->
  <match target="pattern">
        <test name="family"><string>sans-serif</string></test>
        <edit name="family" mode="append"><string>Noto Color Emoji</string></edit>
    </match>

   <!-- Add emoji generic family -->
  <alias binding="strong">
    <family>emoji</family>
    <default><family>Noto Color Emoji</family></default>
  </alias>

  <!-- Alias requests for the other emoji fonts -->
  <alias binding="strong">
    <family>Apple Color Emoji</family>
    <prefer><family>Noto Color Emoji</family></prefer>
    <default><family>emoji</family></default>
  </alias>
  <alias binding="strong">
    <family>Segoe UI Emoji</family>
    <prefer><family>Noto Color Emoji</family></prefer>
    <default><family>emoji</family></default>
  </alias>

<!-- Run "fc-cache -fv" after saving the file and kill and restart whichever app (like discord) and enjoy emoji -->

</fontconfig>

Then you need to create a directory:

mkdir -vp ~/.config/fontconfig/conf.d

Then create a file named : ~/.config/fontconfig/conf.d/56-twemoji-color.conf with below content.

<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- REQUIRES Noto fonts (along with Noto Color Emoji) 
     run `fc-list | grep -i -e "noto sans" -e "noto serif" -e "noto color emoji"` to confirm
-->

 <alias>
 <!-- Change the string in the family tag to whatever font -->
    <family>serif</family>
    <prefer><family>Noto Serif</family></prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer><family>Noto Sans</family></prefer>
  </alias>
  <alias>
    <family>sans</family>
    <prefer><family>Noto Sans</family></prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer><family>Noto Mono</family></prefer>
  </alias>

   <!-- This adds Noto Color Emoji to the font families sans, serif, sans-serif and monospace -->
  <match target="pattern">
        <test name="family"><string>monospace</string></test>
        <edit name="family" mode="append"><string>Noto Color Emoji</string></edit>
  </match>
  <match target="pattern">
        <test name="family"><string>sans</string></test>
        <edit name="family" mode="append"><string>Noto Color Emoji</string></edit>
  </match>

  <match target="pattern">
        <test name="family"><string>serif</string></test>
        <edit name="family" mode="append"><string>Noto Color Emoji</string></edit>
  </match>
  <!-- Discord loads the system's sans-serif font family, add Noto Color Emoji to it -->
  <match target="pattern">
        <test name="family"><string>sans-serif</string></test>
        <edit name="family" mode="append"><string>Noto Color Emoji</string></edit>
    </match>

   <!-- Add emoji generic family -->
  <alias binding="strong">
    <family>emoji</family>
    <default><family>Noto Color Emoji</family></default>
  </alias>

  <!-- Alias requests for the other emoji fonts -->
  <alias binding="strong">
    <family>Apple Color Emoji</family>
    <prefer><family>Noto Color Emoji</family></prefer>
    <default><family>emoji</family></default>
  </alias>
  <alias binding="strong">
    <family>Segoe UI Emoji</family>
    <prefer><family>Noto Color Emoji</family></prefer>
    <default><family>emoji</family></default>
  </alias>

<!-- Run "fc-cache -fv" after saving the file and kill and restart whichever app (like discord) and enjoy emoji -->

</fontconfig>

Then issue the below command:

fc-cache -fv

This should be all, now your Alacritty would be able to recognize the coloured emoji fonts and will be able to render the same.

Alacritty rendering emoji fonts

Config Mirrors:

Show Comments