-
-
Save himalay/5c404a5f6653cb35154ceb3a6c606211 to your computer and use it in GitHub Desktop.
# create folders if does not exist | |
mkdir -p ~/.fonts | |
mkdir -p ~/.config/fontconfig/ | |
# download noto color emoji font from https://www.google.com/get/noto/#emoji-zsye-color | |
# extract NotoColorEmoji.ttf file into ~/.fonts/ | |
# create font config file | |
cat << 'EOF' > ~/.config/fontconfig/fonts.conf | |
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
<match> | |
<test name="family"><string>sans-serif</string></test> | |
<edit name="family" mode="prepend" binding="strong"> | |
<string>Noto Color Emoji</string> | |
</edit> | |
</match> | |
<match> | |
<test name="family"><string>serif</string></test> | |
<edit name="family" mode="prepend" binding="strong"> | |
<string>Noto Color Emoji</string> | |
</edit> | |
</match> | |
<match> | |
<test name="family"><string>Apple Color Emoji</string></test> | |
<edit name="family" mode="prepend" binding="strong"> | |
<string>Noto Color Emoji</string> | |
</edit> | |
</match> | |
EOF | |
# build font information cache files | |
fc-cache -f -v |
Fontconfig error: "/home/henrique/.config/fontconfig/fonts.conf", line 8: junk after document element
I'm getting this error running fc-cache
... Anybody knows why?
@hbarcelos try adding a <fontconfig>
-root tag for all <match>
-tags, that worked for me.
does not work - it enforces Noto Color Emoji
in the whole OS, which basically breaks fonts.
It is outdated. I prepared updated and compatible file. Here is:
https://gist.github.com/gusbemacbe/393613ac23ec19f39dc963b40fb8a704
➜ cat /etc/fonts/conf.d/99-noto-mono-color-emoji.conf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match>
<test name="family"><string>monospace</string></test>
<edit name="family" mode="append_last" binding="strong">
<string>Noto Color Emoji</string>
</edit>
</match>
</fontconfig>
then restart. It works for me
I just followed this suggestion here
In my ~/.config/fontconfig/fonts.conf
, I just have this somewhere near the bottom:
<match>
<edit name="family" mode="append_last" binding="same">
<string>Noto Color Emoji</string>
</edit>
</match>
That was all I needed for everything to have emoji support. Of course, you will need to install the noto emoji fonts. If you're on Arch, you can find it here. You can also run fc-cache
after, but this is usually done automatically if you are running an application which is using the fontconfig library.
For someone lazy
wget -O- https://gist.github.com/himalay/5c404a5f6653cb35154ceb3a6c606211/raw/b6ca198357b458c0e7ecc1ae0352de93621f8b87/color-emoji-on-linux.sh | bash
use at your own risk
I tried running the script and had issues with spaces and numbers, then removed
mode="prepend" binding="strong"
and ranfc-cache -f -v
as @gjvnq recommended and still had issues with spaces taht @jcpsantiago mentioned. I then removed the all of the contents from~/.config/fontconfig/fonts.conf
and ranfc-cache -f -v
again. After rebooting I now get Emoji One emoji with no number/spacing issues in GTK/Qt applications. Thanks for the script and helpful commnts! I don't know if it is possible, but it would also be interesting to display these Emoji One fonts inurxvt
. The fonts seem to work just fine in gnome-terminal but some are displayed as boxes in urxvt.