I started with a VM of Ubuntu 19.10. I applied all updates and installed Chromium and Brave Browser. When I try viewing emoji (E.G. getemoji.com) they appear to be rendered by DejaVu Sans (black and white). The system already has Noto Color Emoji installed. How do I give Noto Color Emoji precedence? I've followed several fontconfig tutorials, but none of them have worked. I've had success by reinstalling Noto Color Emoji, but I haven't been able to figure out what reinstalling is doing that makes it work. Also, I'm working with someone who says reinstalling did no work for him.
1 Answer
One way:
Create this file:
~/.config/fontconfig/conf.d/10-prefer-emoji.conf
Give it this contents:
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <alias> <family>sans-serif</family> <prefer> <family>Noto Color Emoji</family> </prefer> </alias> </fontconfig>
Edit:
That seems not to be sufficient (see comment).
$ fc-match -a | head -2
DejaVuSans.ttf: "DejaVu Sans" "Book"
NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"
So maybe change the contents to this variant:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test qual="any" name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Noto Color Emoji</string>
</edit>
</match>
</fontconfig>
That seems to make a difference:
$ fc-match -a | head -2
NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"
DejaVuSans.ttf: "DejaVu Sans" "Book"
-
I closed Chromium and Brave, ensured they didn't have background processes still running, created that file you specified with the contents you specified, ran "fc-cache -f", re-ran Chromium and Brave. They still render emoji with DejaVu Sans instead of Noto Color Emoji. Jan 20, 2020 at 4:09
-
-
The new file contents you provided change the output of "fc-match -a | head -2" showing Noto Color Emoji first. However, Chromium and Brave still render emoji using DejaVu Sans. I even rebooted to be sure I wasn't missing anything. Jan 20, 2020 at 16:13
-
@denshigomi: Maybe they don't honor fontconfig. Do they have separate app specific font settings? Jan 20, 2020 at 17:33
-
1I'm not sure. What has me stumped is that if I run "sudo apt install --reinstall fonts-noto-color-emoji" then emoji are displayed using Noto Color Emoji. I extracted the deb file for it and compared filenames, locations, permissions, and checksums. They all match what is already on my system. So why does a reinstall fix it? I can see it runs some fontconfig command when it finishes installing, but I'm not 100% sure what it's doing. I thought it was just running a "fc-config -f", but clearly there's more to it. I've got to be missing something. Jan 20, 2020 at 18:52