Skip to content

Instantly share code, notes, and snippets.

@SohamG
Last active Oct 18, 2021
Embed
What would you like to do?
Fix emoji in Linux and get color emoji in Discord! Place this fontconfig file in ~/.config/fontconfig/fonts.conf
<?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>
@3k2

This comment has been minimized.

Copy link

@3k2 3k2 commented Jun 21, 2019

Hey!

thx for this! I have one question how do you change which emoji set discord uses?

@SohamG

This comment has been minimized.

Copy link
Owner Author

@SohamG SohamG commented Jun 21, 2019

Discord uses the sans-serif font so changing "Noto Color Emoji" in line 42 will change that. This only for emoji in names ie emoji in channel/category/server/user name

@3k2

This comment has been minimized.

Copy link

@3k2 3k2 commented Jun 21, 2019

Discord uses the sans-serif font so changing "Noto Color Emoji" in line 42 will change that. This only for emoji in names ie emoji in channel/category/server/user name

https://github.com/eosrei/twemoji-color-font is it possible to use this on discord? do you know any other emoji sets that work? thx!

@SohamG

This comment has been minimized.

Copy link
Owner Author

@SohamG SohamG commented Jun 23, 2019

Yes, you can install that font and replace "Noto Color Emoji" in line 42 with "Twitter Color Emoji". And pretty much any font that provides emoji would work like symbola (b/w only) etc. (only applicable to emoji in names)

@LionelBeato

This comment has been minimized.

Copy link

@LionelBeato LionelBeato commented Feb 18, 2020

Thanks, works like a charm 👍

@Isti115

This comment has been minimized.

Copy link

@Isti115 Isti115 commented Apr 20, 2020

Thank you very much for the fix, this made things look much better! 🙂
Helped a lot in reducing that "this is linux, you don't get beautiful things" feel. 🙃

@flying-sheep

This comment has been minimized.

Copy link

@flying-sheep flying-sheep commented Dec 16, 2020

The part after “This adds Noto Color Emoji to the font families …” could probably be made into a standalone file that can be inserted into /etc/fonts/conf.d/ or $XDG_CONFIG_HOME/fontconfig/conf.d/.

And that way, it could be made into e.g. an package that one can install to select an emoji font, e.g. on Arch:

pkgname=noto-fonts-blobmoji-prefer
...
depends=(noto-fonts-blobmoji)
sources=(50-noto-fonts-blobmoji.conf)

package() {
    install -Dm644 {,/etc/fonts/conf.d/}50-noto-fonts-blobmoji.conf
}
@UltraBlackLinux

This comment has been minimized.

Copy link

@UltraBlackLinux UltraBlackLinux commented Apr 26, 2021

Yes, you can install that font and replace "Noto Color Emoji" in line 42 with "Twitter Color Emoji". And pretty much any font that provides emoji would work like symbola (b/w only) etc. (only applicable to emoji in names)

That does not seem to work for me, I just get the standard black and white emojis then 🤔

@Brin-o

This comment has been minimized.

Copy link

@Brin-o Brin-o commented May 23, 2021

Thanks! I was not able to get the Twitter Emoji to work that @3k2 mentions but I was able to get the noto sans emoji to be fully ready in discord :)

@Joellidin

This comment has been minimized.

Copy link

@Joellidin Joellidin commented May 25, 2021

Unfortunately, this does not work for me. Previously it worked when I used Snap and changed the font config in a ~/snap/discord folder. But as of today, because I needed to update discord, I had to install Discord with the deb file. Now when adding this to the default font config, it won't work. Does anyone have any suggestions?

@Brin-o

This comment has been minimized.

Copy link

@Brin-o Brin-o commented May 25, 2021

@Joellidin did you edit the font config in ~/.config/fontconfig/fonts.conf ?

I'm on the new version of Discord today as and it works for me with the font config file thats provided above.

The file is not created by default so you might need to make it. Otherwise, do you have noto-sans-emoji installed?

@Joellidin

This comment has been minimized.

Copy link

@Joellidin Joellidin commented May 25, 2021

Yeah, this is really embarrassing, but I noticed I accidentally had used font.conf instead of fonts.conf...

@MatveiM11

This comment has been minimized.

Copy link

@MatveiM11 MatveiM11 commented Jul 20, 2021

Thanks!

@Akitakek

This comment has been minimized.

Copy link

@Akitakek Akitakek commented Aug 14, 2021

This should be default for all discord installs honestly, sooo much better.
Thanks for your work, spread the word around to fellow linux users!

@shiggitay

This comment has been minimized.

Copy link

@shiggitay shiggitay commented Aug 15, 2021

I just reinstalled Void Linux on my rig here and I was having the stupid boxy issue in Discord channel names. Installing a crapton of unicode emoji fonts as well as placing this fonts.conf file into ~/.config/fontsconfig/ fixed the issue for me! Thanks for posting it!

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