Ubuntu – How to give Noto Color Emoji highest precedence for rendering emoji (19.10)

bravechromiumemojifonts

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.

Best Answer

One way:

  1. Create this file:

    ~/.config/fontconfig/conf.d/10-prefer-emoji.conf
    
  2. 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"