Despite recent versions of Firefox having colour emoji built in, Debian users will usually see black-and-white emoji characters due to the wrong font being used. ☹️
I wanted to try getting colour emoji working across my whole system, not just Firefox. 🤔
Here is how I did it. ℹ️
Install the emoji font
Before anything else, you'll need to have a colour emoji font installed. The Google Noto font is available in the Debian package repository, so you simply need to run:
apt install fonts-noto-color-emoji
...as root, or via sudo
. ⌨️
Uninstall the DejaVu fonts
Note: This isn't strictly required; see the update at the end of this page for details.
The DejaVu fonts have black-and-white versions of most emoji, which cause them to get used in place of the colour ones most of the time. The simplest option is to uninstall them:
apt remove fonts-dejavu-core
Make sure that all related packages are removed:
fonts-dejavu
fonts-dejavu-core
fonts-dejavu-extra
Unfortunately, some (non-font) packages - such as blender
or openmw
- rely on these being installed, so you'll need to uninstall those as well. ⚠️
Add a configuration file
The following is a modified version of the configuration file described in this Github issue by abouvier. Save this as /etc/fonts/conf.d/56-emoji.conf
and all should be well:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>sans-serif</family>
<prefer>
<family>Noto Color Emoji</family>
<family>Bitstream Vera Sans</family>
</prefer>
</alias>
<alias>
<family>serif</family>
<prefer>
<family>Noto Color Emoji</family>
<family>Bitstream Vera Serif</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Noto Color Emoji</family>
<family>Bitstream Vera Sans Mono</family>
</prefer>
</alias>
<match>
<test name="family" compare="contains">
<string>emoji</string>
</test>
<edit name="family" mode="prepend" binding="same">
<string>Noto Color Emoji</string>
</edit>
</match>
</fontconfig>
You might need to re-start some program(s) in order for the font configuration changes to take effect, but that's basically it. ☺️
Update (10th June 2019)
Recent versions of Debian implicitly require the DejaVu fonts to be installed when installing a new kernel, or it will fail with a cannot stat '/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf': No such file or directory
error.
To work around this, run dpkg-query -L fonts-dejavu-core
to get a list of installed font files:
/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf
/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf
...and "ignore" them by adding the following to the bottom of /etc/fonts/fonts.conf
, just before the </fontconfig>
tag:
<selectfont>
<rejectfont>
<glob>/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf</glob>
<glob>/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf</glob>
<glob>/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf</glob>
<glob>/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf</glob>
<glob>/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf</glob>
<glob>/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf</glob>
</rejectfont>
</selectfont>
This ensures that the fonts-dejavu-core
files exist, but don't override fonts-noto-color-emoji
with black-and-white versions. 👍