Skip to content

Instantly share code, notes, and snippets.

@kylewlacy
Forked from ssaavedra/57-add-emoji-support.conf
Last active January 25, 2024 21:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylewlacy/39118604775071fc2fbd0743f9958ea0 to your computer and use it in GitHub Desktop.
Save kylewlacy/39118604775071fc2fbd0743f9958ea0 to your computer and use it in GitHub Desktop.
Add Emoji to Linux Fontconfig (edited to fix broken fonts for Zoom video conference)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
Author: Santiago Saavedra <ssaavedra@gpul.org>, Kyle Lacy
License: CC0
Year: 2016-2017
Install:
Copy to $XDG_CONFIG_DIR/fontconfig/conf.d/57-add-emoji-support.conf
Run fc-cache -f
Description:
This fontconfig script is an update to Santiago Saavedra's original emoji
fontconfig script. It uses Noto Color Emoji instead of EmojiOne color,
and it also tweaks the match rules to fix some broken apps (namely, Zoom
video conference, which has a weird font rendering issue if the original
script is used).
-->
<fontconfig>
<match>
<test qual="any" name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend_first">
<string>emoji</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="append" binding="same">
<string>emoji</string>
</edit>
</match>
<!-- Hack to fix font issue in Zoom when the above match is applied: -->
<match target="pattern">
<test qual="any" name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="append" binding="same">
<string>DejaVu Sans</string>
</edit>
</match>
<match target="font">
<test name="family" compare="eq">
<string>DejaVu Sans</string>
</test>
<edit name="family" mode="prepend_first">
<string>emoji</string>
</edit>
</match>
<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>emoji</family></prefer>
<default><family>sans-serif</family></default>
</alias>
<alias binding="strong">
<family>Segoe UI Emoji</family>
<prefer><family>emoji</family></prefer>
<default><family>sans-serif</family></default>
</alias>
<alias binding="strong">
<family>EmojiOne Color</family>
<prefer><family>emoji</family></prefer>
<default><family>sans-serif</family></default>
</alias>
</fontconfig>
@coccome85
Copy link

hello, thank you very much for the code, that's really great! but how exactly does it work? I haven't been working with Linux for long.
Thank you

@o10222
Copy link

o10222 commented Jan 25, 2024

COCCOME85
Copy to $XDG_CONFIG_DIR/fontconfig/conf.d/57-add-emoji-support.conf
Run fc-cache -f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment