Konubinix' opinionated web of thoughts

How to Emoji Fonts Get Used in Debian?

Fleeting

how to emoji fonts get used in debian?

According to emoji in fonts, it is enough to have one font supporting emoji for them to become used.

It indicates that this is a configuration of fontconfig.

Actually, grepping into the debian configuration gives the answer

grep -C 10 -R /etc/fonts/ -e emoji
/etc/fonts/conf.d/60-generic.conf-<?xml version="1.0"?>
/etc/fonts/conf.d/60-generic.conf-<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
/etc/fonts/conf.d/60-generic.conf-<fontconfig>
/etc/fonts/conf.d/60-generic.conf-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
/etc/fonts/conf.d/60-generic.conf-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
/etc/fonts/conf.d/60-generic.conf-  </its:rules>
/etc/fonts/conf.d/60-generic.conf-
/etc/fonts/conf.d/60-generic.conf:  <description>Set preferable fonts for emoji/math fonts</description>
/etc/fonts/conf.d/60-generic.conf-<!-- Keep in sync with 45-generic.conf -->
/etc/fonts/conf.d/60-generic.conf-
/etc/fonts/conf.d/60-generic.conf-<!-- Emoji -->
/etc/fonts/conf.d/60-generic.conf-
/etc/fonts/conf.d/60-generic.conf:	<!-- Prefer to match color emoji font. -->
/etc/fonts/conf.d/60-generic.conf-	<match>
/etc/fonts/conf.d/60-generic.conf-		<test name="lang">
/etc/fonts/conf.d/60-generic.conf-			<string>und-zsye</string>
/etc/fonts/conf.d/60-generic.conf-		</test>
/etc/fonts/conf.d/60-generic.conf-		<test qual="all" name="color" compare="not_eq">
/etc/fonts/conf.d/60-generic.conf-			<bool>true</bool>
/etc/fonts/conf.d/60-generic.conf-		</test>
/etc/fonts/conf.d/60-generic.conf-		<test qual="all" name="color" compare="not_eq">
/etc/fonts/conf.d/60-generic.conf-			<bool>false</bool>
/etc/fonts/conf.d/60-generic.conf-		</test>
--
/etc/fonts/conf.d/60-generic.conf-			<bool>true</bool>
/etc/fonts/conf.d/60-generic.conf-		</edit>
/etc/fonts/conf.d/60-generic.conf-	</match>
/etc/fonts/conf.d/60-generic.conf-
/etc/fonts/conf.d/60-generic.conf-	<!-- TODO
/etc/fonts/conf.d/60-generic.conf-	 ! Match on "color" and alias B&W ones first if no color is requested.
/etc/fonts/conf.d/60-generic.conf-	 ! That's "hard" because <alias> doesn't work in match and needs to be
/etc/fonts/conf.d/60-generic.conf-	 ! expanded to its non-sugar form.
/etc/fonts/conf.d/60-generic.conf-	 !-->
/etc/fonts/conf.d/60-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/60-generic.conf:		<family>emoji</family>
/etc/fonts/conf.d/60-generic.conf-		<prefer>
/etc/fonts/conf.d/60-generic.conf-			<!-- System fonts -->
/etc/fonts/conf.d/60-generic.conf-			<family>Noto Color Emoji</family> <!-- Google -->
/etc/fonts/conf.d/60-generic.conf-			<family>Apple Color Emoji</family> <!-- Apple -->
/etc/fonts/conf.d/60-generic.conf-			<family>Segoe UI Emoji</family> <!-- Microsoft -->
/etc/fonts/conf.d/60-generic.conf-			<family>Twitter Color Emoji</family> <!-- Twitter -->
/etc/fonts/conf.d/60-generic.conf-			<family>EmojiOne Mozilla</family> <!-- Mozilla -->
/etc/fonts/conf.d/60-generic.conf-			<!-- Third-Party fonts -->
/etc/fonts/conf.d/60-generic.conf-			<family>Emoji Two</family>
/etc/fonts/conf.d/60-generic.conf-			<family>Emoji One</family>
--
/etc/fonts/conf.d/45-generic.conf-<?xml version="1.0"?>
/etc/fonts/conf.d/45-generic.conf-<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
/etc/fonts/conf.d/45-generic.conf-<fontconfig>
/etc/fonts/conf.d/45-generic.conf-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
/etc/fonts/conf.d/45-generic.conf-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
/etc/fonts/conf.d/45-generic.conf-  </its:rules>
/etc/fonts/conf.d/45-generic.conf-
/etc/fonts/conf.d/45-generic.conf:  <description>Set substitutions for emoji/math fonts</description>
/etc/fonts/conf.d/45-generic.conf-
/etc/fonts/conf.d/45-generic.conf-<!-- Keep in sync with 60-generic.conf -->
/etc/fonts/conf.d/45-generic.conf-
/etc/fonts/conf.d/45-generic.conf-<!-- Emoji -->
/etc/fonts/conf.d/45-generic.conf-
/etc/fonts/conf.d/45-generic.conf:	<!-- System emoji -->
/etc/fonts/conf.d/45-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/45-generic.conf-		<family>Noto Color Emoji</family> <!-- Google -->
/etc/fonts/conf.d/45-generic.conf:		<default><family>emoji</family></default>
/etc/fonts/conf.d/45-generic.conf-	</alias>
/etc/fonts/conf.d/45-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/45-generic.conf-		<family>Apple Color Emoji</family> <!-- Apple -->
/etc/fonts/conf.d/45-generic.conf:		<default><family>emoji</family></default>
/etc/fonts/conf.d/45-generic.conf-	</alias>
/etc/fonts/conf.d/45-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/45-generic.conf-		<family>Segoe UI Emoji</family> <!-- Microsoft -->
/etc/fonts/conf.d/45-generic.conf:		<default><family>emoji</family></default>
/etc/fonts/conf.d/45-generic.conf-	</alias>
/etc/fonts/conf.d/45-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/45-generic.conf-		<family>Twitter Color Emoji</family> <!-- Twitter -->
/etc/fonts/conf.d/45-generic.conf:		<default><family>emoji</family></default>
/etc/fonts/conf.d/45-generic.conf-	</alias>
/etc/fonts/conf.d/45-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/45-generic.conf-		<family>EmojiOne Mozilla</family> <!-- Mozilla -->
/etc/fonts/conf.d/45-generic.conf:		<default><family>emoji</family></default>
/etc/fonts/conf.d/45-generic.conf-	</alias>
/etc/fonts/conf.d/45-generic.conf:	<!-- Third-party emoji -->
/etc/fonts/conf.d/45-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/45-generic.conf-		<family>Emoji Two</family>
/etc/fonts/conf.d/45-generic.conf:		<default><family>emoji</family></default>
/etc/fonts/conf.d/45-generic.conf-	</alias>
/etc/fonts/conf.d/45-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/45-generic.conf-		<family>Emoji One</family>
/etc/fonts/conf.d/45-generic.conf:		<default><family>emoji</family></default>
/etc/fonts/conf.d/45-generic.conf-	</alias>
/etc/fonts/conf.d/45-generic.conf-	<!-- B&W -->
/etc/fonts/conf.d/45-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/45-generic.conf-		<family>Noto Emoji</family> <!-- Google -->
/etc/fonts/conf.d/45-generic.conf:		<default><family>emoji</family></default>
/etc/fonts/conf.d/45-generic.conf-	</alias>
/etc/fonts/conf.d/45-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/45-generic.conf-		<family>Android Emoji</family> <!-- Google -->
/etc/fonts/conf.d/45-generic.conf:		<default><family>emoji</family></default>
/etc/fonts/conf.d/45-generic.conf-	</alias>
/etc/fonts/conf.d/45-generic.conf-
/etc/fonts/conf.d/45-generic.conf:	<!-- Add language for emoji, to match other emoji fonts. -->
/etc/fonts/conf.d/45-generic.conf-	<match>
/etc/fonts/conf.d/45-generic.conf-		<test name="family">
/etc/fonts/conf.d/45-generic.conf:			<string>emoji</string>
/etc/fonts/conf.d/45-generic.conf-		</test>
/etc/fonts/conf.d/45-generic.conf-		<edit name="lang" mode="prepend">
/etc/fonts/conf.d/45-generic.conf-			<string>und-zsye</string>
/etc/fonts/conf.d/45-generic.conf-		</edit>
/etc/fonts/conf.d/45-generic.conf-	</match>
/etc/fonts/conf.d/45-generic.conf-
/etc/fonts/conf.d/45-generic.conf-	<match>
/etc/fonts/conf.d/45-generic.conf-		<test name="lang">
/etc/fonts/conf.d/45-generic.conf-			<string>und-zsye</string>
/etc/fonts/conf.d/45-generic.conf-		</test>
/etc/fonts/conf.d/45-generic.conf-		<test qual="all" name="family" compare="not_eq">
/etc/fonts/conf.d/45-generic.conf:			<string>emoji</string>
/etc/fonts/conf.d/45-generic.conf-		</test>
/etc/fonts/conf.d/45-generic.conf-
/etc/fonts/conf.d/45-generic.conf-		<!-- Add generic family. -->
/etc/fonts/conf.d/45-generic.conf-		<edit name="family" mode="append" binding="strong">
/etc/fonts/conf.d/45-generic.conf:			<string>emoji</string>
/etc/fonts/conf.d/45-generic.conf-		</edit>
/etc/fonts/conf.d/45-generic.conf-	</match>
/etc/fonts/conf.d/45-generic.conf-
/etc/fonts/conf.d/45-generic.conf-
/etc/fonts/conf.d/45-generic.conf-<!-- Math -->
/etc/fonts/conf.d/45-generic.conf-
/etc/fonts/conf.d/45-generic.conf-	<!-- https://en.wikipedia.org/wiki/Category:Mathematical_OpenType_typefaces -->
/etc/fonts/conf.d/45-generic.conf-	<alias binding="same">
/etc/fonts/conf.d/45-generic.conf-		<family>XITS Math</family> <!-- Khaled Hosny -->
/etc/fonts/conf.d/45-generic.conf-		<default><family>math</family></default>

We can see that the noto font is matched first.

By looking at fonts using emoji in debian, we can see that

apt search emoji|gi font
fonts-noto-color-emoji/testing,unstable 0~20200916-1 all
  color emoji font from Google
fonts-recommended/testing,unstable 1 all
  set of recommended fonts
fonts-symbola/testing,unstable 2.60-1.1 all
  symbolic font providing emoji characters from Unicode 9.0
texlive-fonts-extra/testing,unstable 2020.20210202-1 all
  TeX Live: Additional fonts
ttf-ancient-fonts-symbola/testing,unstable 2.60-1.1 all
  symbolic font providing emoji chars from Unicode 9.0 (transit. pkg)

Then

apt show fonts-recommended
Package: fonts-recommended
Version: 1
Priority: optional
Section: x11
Maintainer: Debian Fonts Task Force <debian-fonts@lists.debian.org>
Installed-Size: 8192 B
Depends: fonts-dejavu-core, fonts-cantarell, fonts-liberation2 | fonts-croscore, fonts-crosextra-caladea, fonts-crosextra-carlito, fonts-comic-neue, fonts-symbola, fonts-noto-color-emoji, fonts-urw-base35, fonts-freefont-otf, fonts-courier-prime, fonts-firacode | fonts-mononoki | fonts-ricty-diminished, fonts-league-spartan | fonts-clear-sans
Download-Size: 1992 B
APT-Sources: http://deb.debian.org/debian testing/main amd64 Packages
Description: set of recommended fonts
 This metapackage is a list of fonts that, in the opinion of some members
 of the Debian Fonts team, is reasonable to have on most GUI systems.  The
 selection is pretty arbitrary, and includes:
  * compatibility with other operating systems
  * basic coverage of all writing systems
  * all symbols and emojis
  * fonts just nice to have

So maybe I could install this package and everything will be ok.

Notes linking here