Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to render NotoColorEmoji on Linux #36

Closed
engen0 opened this issue Dec 30, 2015 · 124 comments
Closed

How to render NotoColorEmoji on Linux #36

engen0 opened this issue Dec 30, 2015 · 124 comments

Comments

@engen0
Copy link

engen0 commented Dec 30, 2015

I've built the font and uploaded it here but my system is unable to read it.
What do I need to be able to use it?

@behdad
Copy link
Contributor

behdad commented Dec 31, 2015

You need latest fontconfig, but also a patched version of cairo from this branch:
https://github.com/behdad/cairo/tree/color-emoji

Unfortunately no one has finished the patch to integrate into cairo yet :(.

@engen0
Copy link
Author

engen0 commented Jan 1, 2016

I installed fontconfig, patched cairo, and also freetype, graphite2, harfbuzz, zlib, libpng, libX11, libXrender, and pixman.
I'm still unable to read it though.

@behdad
Copy link
Contributor

behdad commented Jan 1, 2016

What does this command say, does it find the font:

$ fc-match "Noto Color Emoji"

@engen0
Copy link
Author

engen0 commented Jan 1, 2016

No:

$ fc-match "Noto Color Emoji"
Fontconfig warning: "/.fonts.conf", line 185: Having multiple values in isn't supported and may not work as expected
Fontconfig warning: "
/.fonts.conf", line 247: Having multiple values in isn't supported and may not work as expected
Fontconfig warning: "/.fonts.conf", line 279: Having multiple values in isn't supported and may not work as expected
Fontconfig warning: "
/.fonts.conf", line 301: Having multiple values in isn't supported and may not work as expected
Fontconfig warning: "/.fonts.conf", line 386: Having multiple values in isn't supported and may not work as expected
Fontconfig warning: "
/.fonts.conf", line 466: Having multiple values in isn't supported and may not work as expected
Fontconfig warning: "/.fonts.conf", line 533: Having multiple values in isn't supported and may not work as expected
Fontconfig warning: "
/.fonts.conf", line 627: saw number, expected matrix
Fontconfig warning: "/.fonts.conf", line 1309: Having multiple values in isn't supported and may not work as expected
Fontconfig warning: "
/.fonts.conf", line 1440: Having multiple values in isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 1518: Having multiple values in isn't supported and may not work as expected
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
DejaVuSans.ttf: "DejaVu Sans" "Book"

@behdad
Copy link
Contributor

behdad commented Jan 1, 2016

Where / how did you install the new fontconfig?

@engen0
Copy link
Author

engen0 commented Jan 1, 2016

Got it from here: http://www.freedesktop.org/software/fontconfig/release/
And did
$ sudo ./configure
$ sudo make
$ sudo make install

$ fc-cache -V
fontconfig version 2.11.94

$ ls -l /usr/include/fontconfig/
total 36
-rw-r--r--. 1 root root 1951 Mar 5 2013 fcfreetype.h
-rw-r--r--. 1 root root 4110 Mar 5 2013 fcprivate.h
-rw-r--r--. 1 root root 24060 Mar 5 2013 fontconfig.h

$ ls -l /usr/bin/fc*
-rwxr-xr-x. 1 root root 9792 Mar 5 2013 /usr/bin/fc-cache
-rwxr-xr-x. 1 root root 9780 Mar 5 2013 /usr/bin/fc-cat
-rwxr-xr-x. 1 root root 9728 Mar 5 2013 /usr/bin/fc-list
-rwxr-xr-x. 1 root root 9756 Mar 5 2013 /usr/bin/fc-match
-rwxr-xr-x. 1 root root 9728 Mar 5 2013 /usr/bin/fc-pattern
-rwxr-xr-x. 1 root root 9708 Mar 5 2013 /usr/bin/fc-query
-rwxr-xr-x. 1 root root 9732 Mar 5 2013 /usr/bin/fc-scan

It looks like maybe I have a conflicting old installation

@behdad
Copy link
Contributor

behdad commented Jan 1, 2016

Yeah, new version probably went into /usr/local. The question is, why does it seem to be trying to read config files from /etc instead of /usr/local/etc

@vooze
Copy link

vooze commented Jan 18, 2016

Hello, I'm also looking into this. But wondering if its even worth it, when chrome does not even support color emoji anyway.

@behdad
Copy link
Contributor

behdad commented Jan 19, 2016

Hello, I'm also looking into this. But wondering if its even worth it, when chrome does not even support color emoji anyway.

What do you mean? Chrome on Linux certainly supports Noto Color Emoji just fine for me. You might need a newer fontconfig.

@vooze
Copy link

vooze commented Jan 19, 2016

Thank you for getting back to me. I compiled cairo patch from your repo and fontconfig 2.11.94 from http://www.freedesktop.org/software/fontconfig/release/.

vooze@vooze-vb:$ ls -l /usr/include/fontconfig/
total 40
-rw-r--r-- 1 root root 1951 Jan 19 2015 fcfreetype.h
-rw-r--r-- 1 root root 4139 Jan 19 2015 fcprivate.h
-rw-r--r-- 1 root root 24833 Jan 19 2015 fontconfig.h
vooze@vooze-vb:
$ fc-match "Noto Color Emoji"
DejaVuSans.ttf: "DejaVu Sans" "Book"
vooze@vooze-vb:~$ fc-cache -V
fontconfig version 2.11.94

Still unable to install the font. Either manually (press Install in font viewer on ubuntu 16.04 daily) or putting it in .fonts dir.
Am I missing something?

@vooze
Copy link

vooze commented Jan 19, 2016

Also just tested. Microsoft color emojis (tested with those, because noto wont install) works in Firefox but is still black/white in Chrome in Linux, like in Windows.

@behdad
Copy link
Contributor

behdad commented Jan 19, 2016

Try deleting /etc/fonts/conf.d/70-no-bitmaps.conf that I believe Ubuntu puts in there. Though, that shouldn't be needed with latest fontconfig, hence, why I don't know what your problem is.

@chenxiaolong
Copy link

@behdad I've compiled the latest fontconfig from git as well as the color-emoji branch from your cairo repo and Noto Color Emoji seems to be working for the most part. However, it seems to have a lower priority than another emoji font? Do you know how I could give Noto a higher priority?

Thanks!

(Apologies for the colors in the screenshot. Not sure why taking a screenshot messes with the colors of the emojis)

image

@vooze
Copy link

vooze commented Feb 15, 2016

Thats dejavu sans.

@behdad
Copy link
Contributor

behdad commented Feb 17, 2016

We don't have a good solution to that yet, but one way would be to add this snippet to your ~/.fonts.conf:

<?xml version='1.0'?> 
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> 
<fontconfig> 
  <match target="pattern"> 
    <edit name="family" mode="prepend"> 
      <string>Noto Color Emoji</string> 
    </edit> 
  </match> 
</fontconfig> 

@chenxiaolong
Copy link

@behdad Thanks for the reply! I gave that a try (put it in ~/.config/fontconfig/conf.d/10-noto-color-emoji.conf) and it didn't seem to work. I did a export FC_DEBUG=1024 before running Chrome and fontconfig does seem to be loading the file:

╭─   ~/.config/fontconfig/conf.d                                                                  1 ↵  22:42:39 
╰─ export FC_DEBUG=1024
╭─   ~/.config/fontconfig/conf.d                                                                      22:42:44 
╰─ google-chrome-stable
FC_DEBUG=1024
    Loading config file /etc/fonts/fonts.conf
    Scanning config dir /etc/fonts/conf.d
    Loading config file /etc/fonts/conf.d/10-hinting-slight.conf
    Loading config file /etc/fonts/conf.d/10-scale-bitmap-fonts.conf
    Loading config file /etc/fonts/conf.d/10-sub-pixel-rgb.conf
    Loading config file /etc/fonts/conf.d/11-lcdfilter-default.conf
    Loading config file /etc/fonts/conf.d/20-unhint-small-dejavu-sans-mono.conf
    Loading config file /etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf
    Loading config file /etc/fonts/conf.d/20-unhint-small-dejavu-serif.conf
    Loading config file /etc/fonts/conf.d/20-unhint-small-vera.conf
    Loading config file /etc/fonts/conf.d/30-metric-aliases.conf
    Loading config file /etc/fonts/conf.d/30-urw-aliases.conf
    Loading config file /etc/fonts/conf.d/30-win32-aliases.conf
    Loading config file /etc/fonts/conf.d/40-nonlatin.conf
    Loading config file /etc/fonts/conf.d/44-source-han-sans-cn.conf
    Loading config file /etc/fonts/conf.d/44-wqy-microhei.conf
    Loading config file /etc/fonts/conf.d/45-latin.conf
    Loading config file /etc/fonts/conf.d/49-sansserif.conf
    Loading config file /etc/fonts/conf.d/50-user.conf
    Scanning config dir /home/chenxiaolong/.config/fontconfig/conf.d
    Loading config file /home/chenxiaolong/.config/fontconfig/conf.d/10-noto-color-emoji.conf
    Loading config file /home/chenxiaolong/.config/fontconfig/conf.d/10-symbols.conf
    Loading config file /home/chenxiaolong/.config/fontconfig/fonts.conf
    Loading config file /etc/fonts/conf.d/51-local.conf
    Loading config file /etc/fonts/conf.d/57-dejavu-sans-mono.conf
    Loading config file /etc/fonts/conf.d/57-dejavu-sans.conf
    Loading config file /etc/fonts/conf.d/57-dejavu-serif.conf
    Loading config file /etc/fonts/conf.d/60-latin.conf
    Loading config file /etc/fonts/conf.d/65-fonts-persian.conf
    Loading config file /etc/fonts/conf.d/65-nonlatin.conf
    Loading config file /etc/fonts/conf.d/65-wqy-zenhei.conf
    Loading config file /etc/fonts/conf.d/69-unifont.conf
    Loading config file /etc/fonts/conf.d/70-no-bitmaps.conf
    Loading config file /etc/fonts/conf.d/80-delicious.conf
    Loading config file /etc/fonts/conf.d/81-ubuntu.conf
    Loading config file /etc/fonts/conf.d/90-synthetic.conf
    Loading config file /etc/fonts/conf.d/99pdftoopvp.conf

@behdad
Copy link
Contributor

behdad commented Feb 17, 2016

Humm, I don't know.

@jungshik
Copy link

Even with an old version of fontconfig included in Ubuntu Trusty (but with a recent FreeType to support color bitmap fonts that I installed locally), putting the following in your local fontconfig configuration file (e.g. ~/.fonts.conf ) would work (at least, it works well for me with Chrome). The 2nd part below does, only to chrome, what Behdad's snippet (2 days ago) does for all programs so that they should be equivalent as long as chrome is concerned.

 <match target="scan">
   <test name="family">
      <string>Noto Color Emoji</string>
   </test>
   <edit name="scalable" mode="assign"><bool>true</bool></edit>
 </match>

<match target="pattern">
    <test name="prgname">
      <string>chrome</string>
    </test>
    <edit name="family" mode="prepend_first">
      <string>Noto Color Emoji</string>
    </edit>
</match>

@vooze
Copy link

vooze commented Feb 18, 2016

Jungshik: have you got it all working on Ubuntu? If so you you possible post a small "guide"? I Would be truly grateful!

@vooze
Copy link

vooze commented Feb 18, 2016

Wow autocorrect screwed that up. Let me try again:

Jungshik: Have you got it all working on Ubuntu? If so would you possible post a small "guide"? I would be truly grateful! I have tried and failed. :-\

@abbradar
Copy link

Hi! I'm interested if there is upstream bug opened for this. Also, is future work on those patches planned? Thanks!

@13rac1
Copy link

13rac1 commented Mar 29, 2016

I subscribed to this issue a while ago hoping for a better fontconfig solution myself. I researched this font/glyph priority issue for far too long and I ended up settling on replacing DejaVu with Bitstream Vera for my emoji font's suggested fontconfig. Bitstream Vera is the source of the DejaVu glyphs and doesn't have any of the conflicting emoji characters. The same process can be adjusted to work for Noto Color Emoji. The only other solution AFAIK is subsetting DejaVu or Noto. Long term, DejaVu or Noto Sans/Serif/etc probably should use the solution Apple & Microsoft went with, as I understand, and not put any emoji (even text-default emoji) characters anywhere except emoji specific fonts. A different solution would be great though.

Edit: Difference vs the @jungshik method is my method is for a system-wide replacement. It may not be applicable for Noto Color Emoji since it doesn't contain regular glyphs.

@jungshik
Copy link

@vooze : Do what I wrote in #36 (comment)

  1. Grab the latest version of FreeType from freetype.org and build and install. This is necessary because FreeType on Ubuntu tends to lags behind the upstream and may not have a color font support, yet.
  2. Add my fontconfig snippet to ~/.fonts.conf
  3. Install NotoColorEmoji.ttf : ie copy it where fontconfig looks for fonts. Although not necessary, just run fc-cache
  4. Restart Chrome

@abbradar
Copy link

@jungshik, do you have this font working without patched Cairo (you don't mention it in your guide)?

@jungshik
Copy link

@abbradar What I wrote is Chrome-specific (pngname matching 'chrome' in fontconfig) and Chrome does not use Cairo.

@abbradar
Copy link

@jungshik Ah, I see! Thanks.

@kq01526
Copy link

kq01526 commented Apr 7, 2016

Any progress on this one?

What exactly needs to be done to make color Emojis show up everywhere on Linux (not just in the browser)?

Today Microsoft presented their brand new Emojis for Windows 10, see:

https://blogs.windows.com/windowsexperience/2016/04/06/announcing-windows-10-insider-preview-build-14316/

Yet on Linux desktop operating systems we still don't have full color Emoji support.

Why is that?

@behdad
Copy link
Contributor

behdad commented Apr 7, 2016

Ugh. I wish emoji die so we don't get so much "any progress on this" messages.

No progress on this. Because apparently no one in the world (including myself) has time to finish my patch. Period. Go bug your Linux distro please.

@bodqhrohro
Copy link

@jbicha The reason was the disabled hinting. Changing it to slight brought colour emojis to life. Why do bitmaps depend on hinting?

@behdad
Copy link
Contributor

behdad commented Jan 16, 2018

@jbicha The reason was the disabled hinting. Changing it to slight brought colour emojis to life. Why do bitmaps depend on hinting?

That's a bug. File a bug at bugs.freedesktop.org against cairo graphics library.

@genebean
Copy link

I see here that things should work out of the box on Debian Buster... is there a backports setup or PPA with all the needed updated components that will work on systems based on Ubuntu 16.04? I've gotten things working in Arch but would like it to also work elsewhere. I guess along those same lines, can I get a list of the minimum versions I should look for? I've gathered I need cairo, fontconfig, and the noto fonts but am not sure which versions and if the needed config is bundled or if I need to verify it exists.

Thanks to all who've put work into this and have posted comments about their experiments. Both are greatly appreciated.

@behdad
Copy link
Contributor

behdad commented Feb 10, 2018

@jbicha The reason was the disabled hinting. Changing it to slight brought colour emojis to life. Why do bitmaps depend on hinting?

That's a bug. File a bug at bugs.freedesktop.org against cairo graphics library.

Filed https://bugs.freedesktop.org/show_bug.cgi?id=105035

@simonbcn
Copy link

simonbcn commented Mar 1, 2018

This is what I see in Firefox 58.0.2 on Arch Linux:
captura_20180301_152546

I use Noto fonts in Firefox.

@miguelsousa
Copy link
Contributor

@simonbcn your screenshot is mostly displaying 2 fonts, EmojiOne and Symbola. I can't tell if any of the glyphs shown is from NotoEmoji.

@jfkthame
Copy link

jfkthame commented Mar 1, 2018

AFAICS, the getemoji.com site is rather Windows-centric: it applies "font-family: Segoe UI Emoji" (which is only likely to be available on Windows) to the emoji content, and doesn't specify any alternative fonts for other platforms. So you're likely to be seeing the result of default font fallback.

Explicitly including Noto Color Emoji in the font-family list would probably change the result; or for Firefox 59 and later, the patch that landed in bug 1032671 may help to improve the fallback behavior.

@simonbcn
Copy link

simonbcn commented Apr 7, 2018

I've uninstalled Symbola, NotoEmoji, DejaVu and I have installed EmojiOne only. Now it works well in all webs: https://www.emojicopy.com/ http://getemoji.com/ https://es.piliapp.com/facebook-symbols/ ...
gnome-characters and gedit also works well.
For me NotoEmoji is failing on Linux. Perhaps it should be revised.

@denysvitali
Copy link

I can confirm @ugjka solution worked in my case for Polybar (polybar/polybar#905)

@herbsmn
Copy link

herbsmn commented Jun 4, 2018

A few notes: NotoColorEmoji now is packaged in Debian Buster and Sid https://packages.debian.org/sid/fonts-noto-color-emoji

I think they are just using the binary from the Releases page of this repo instead of building it from source: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=848198#64

It should be noted that fonttools, which is required to build the font from source, has been switched over to the MIT license six months ago, so this font should now be able to be built from source with all free software build tools: fonttools/fonttools@b990a01

@jbicha
Copy link

jbicha commented Jun 6, 2018

The Noto Color Emoji package in Debian is built from source using fonttools and zopfli.

@Moelf
Copy link

Moelf commented Aug 9, 2018

I followed @wpaulino method, and now I have huge white spaces between words in Chromium in arch. But somehow this only occurs in github, not other website. Also, numbers are rendered incorrectly into emoji. Any ideas?

@Moelf
Copy link

Moelf commented Aug 9, 2018

@ugjka some how it messes up my chromium rendering
2018-08-09_12 15 20

@ugjka
Copy link

ugjka commented Aug 10, 2018

¯\_(ツ)_/¯

works fine here on arch kde

@drott
Copy link

drott commented Aug 13, 2018

I followed @wpaulino method, and now I have huge white spaces between words in Chromium in arch. But somehow this only occurs in github, not other website. Also, numbers are rendered incorrectly into emoji. Any ideas?

The @wpaulino method from the comment above is a bit too coarse in my opinion: It makes Noto Color Emoji your default system font. Github is using the system font to display text. This makes spaces and numbers render as emoji, and the actual sans-serif text on github is then rendered using fallback. Release versions of Chrome ship their own versions of FontConfig and FreeType, which should work with Noto Color Emoji, however, we still need to fix issue 767754 to address more precise selection of the emoji font.

@rafasc
Copy link

rafasc commented Aug 13, 2018

@Moelf Don't use github as your way to test font configuration. It replaces emojis with images under some conditions, one of them being your user-agent matchthing \bLinux\b.

@brikler
Copy link

brikler commented Jan 12, 2019

@Moelf
i had the same issue and i was able to solve it by remove noto-color-emoji because it overwrite settings

tom@donar ~]$ fc-match sans
NotoSans-Regular.ttf: "Noto Sans" "Regular"
[tom@donar ~]$ LC_ALL=C sudo pacman -S ttf-noto-color-emoji
[sudo] password for tom: 
resolving dependencies...
looking for conflicting packages...

Packages (1) ttf-noto-color-emoji-20181028-1

Total Installed Size:  6.94 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                                [#################################] 100%
(1/1) checking package integrity                              [#################################] 100%
(1/1) loading package files                                   [#################################] 100%
(1/1) checking for file conflicts                             [#################################] 100%
(1/1) checking available disk space                           [#################################] 100%
:: Processing package changes...
(1/1) installing ttf-noto-color-emoji                         [#################################] 100%
:: Running post-transaction hooks...
(1/3) Updating fontconfig cache...
(2/3) Arming ConditionNeedsUpdate...
(3/3) Updating X fontdir indices...
[tom@donar ~]$ fc-match sans
NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"
[tom@donar ~]$ LC_ALL=C sudo pacman -R ttf-noto-color-emoji
checking dependencies...

Packages (1) ttf-noto-color-emoji-20181028-1

Total Removed Size:  6.94 MiB

:: Do you want to remove these packages? [Y/n] 
:: Processing package changes...
(1/1) removing ttf-noto-color-emoji                           [#################################] 100%
:: Running post-transaction hooks...
(1/3) Updating fontconfig cache...
(2/3) Arming ConditionNeedsUpdate...
(3/3) Updating X fontdir indices...
[tom@donar ~]$ fc-match sans
NotoSans-Regular.ttf: "Noto Sans" "Regular"

@abcfy2
Copy link

abcfy2 commented Dec 4, 2019

I have the same issue on terminal.

It's working in Chrome:
image

Also Firefox:
image

But it's very huge on terminal:
深度截图_选择区域_20191204164834

Here is my config:
$ cat ~/.config/fontconfig/conf.d/50-noto-color-emoji.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="scan">
        <test name="family">
            <string>Noto Color Emoji</string>
        </test>
        <edit name="scalable" mode="assign">
            <bool>true</bool>
        </edit>
    </match>

    <match>
        <test name="family"><string>sans-serif</string></test>
        <edit name="family" mode="prepend" binding="weak">
            <string>Noto Color Emoji</string>
        </edit>
    </match>

    <match>
        <test name="family"><string>serif</string></test>
        <edit name="family" mode="prepend" binding="weak">
            <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>

</fontconfig>

And terminal output:

$ FC_DEBUG=1024 deepin-terminal 
FC_DEBUG=1024
	Loading config file /etc/fonts/fonts.conf
	Scanning config dir /etc/fonts/conf.d
	Loading config file /etc/fonts/conf.d/10-scale-bitmap-fonts.conf
	Loading config file /etc/fonts/conf.d/11-lcdfilter-default.conf
	Loading config file /etc/fonts/conf.d/20-unhint-small-vera.conf
	Loading config file /etc/fonts/conf.d/30-metric-aliases.conf
	Loading config file /etc/fonts/conf.d/30-urw-aliases.conf
	Loading config file /etc/fonts/conf.d/40-nonlatin.conf
	Loading config file /etc/fonts/conf.d/45-latin.conf
	Loading config file /etc/fonts/conf.d/49-sansserif.conf
	Loading config file /etc/fonts/conf.d/50-user.conf
	Scanning config dir /home/fengyu/.config/fontconfig/conf.d
	Loading config file /home/fengyu/.config/fontconfig/conf.d/10-font-optimizing.conf
	Loading config file /home/fengyu/.config/fontconfig/conf.d/50-noto-color-emoji.conf
	Loading config file /home/fengyu/.config/fontconfig/conf.d/99-deepin.conf
	Loading config file /etc/fonts/conf.d/51-local.conf
	Loading config file /etc/fonts/conf.d/60-latin.conf
	Loading config file /etc/fonts/conf.d/65-fonts-persian.conf
	Loading config file /etc/fonts/conf.d/65-nonlatin.conf
	Loading config file /etc/fonts/conf.d/69-unifont.conf
	Loading config file /etc/fonts/conf.d/70-fonts-noto-cjk.conf
	Loading config file /etc/fonts/conf.d/70-no-bitmaps.conf
	Loading config file /etc/fonts/conf.d/80-delicious.conf
	Loading config file /etc/fonts/conf.d/90-synthetic.conf

Any one can help?

@wimstefan
Copy link

You could add

    <edit name="pixelsize" mode="assign">
      <double>16</double>
    </edit>

at the end of the <match target="scan"> section. Hope this helps.

@travankor
Copy link

Can someone please add the tl;dr instructions to the Arch Linux wiki?

There are like 10+ different fontconfig settings floating around on the internet and most of them don't work...

@FayeAlephNil
Copy link

Would anyone know why Noto Color Emoji would render well in Konsole but not in st or urxvt? I've been digging through configs trying to figure this out for a few days and have come up with nothing

blueboxd pushed a commit to blueboxd/chromium-legacy that referenced this issue May 28, 2020
Prior to this CL, Chrome on desktop Linux often inconsistently used
contour fonts (e.g., DejaVu Sans and Noto Sans Symbols2) for some
emojis, even when a dedicated emoji font (e.g., Noto Color Emoji) is
available and used for all other emojis. In order to force the color
emoji font to be used always, hacks [1] have been mentioned in online
forums that prepend the color emoji font to the list of system fonts in
fonts.conf, which can have highly deletorious effects on other
applications (like normal numerals becoming their emoji versions).

The ISO locale code "und-Zsye" [2] is one of the ways of informing
fontconfig (as of version 2.12.5) that color emoji fonts should be
preferred, along with the special font family "emoji" [3]. fontconfig
also has default configurations that automatically map the locale and
the "emoji" family to any available color emoji font. By explicitly
setting the locale to "und-Zsye", this CL provides the desired
out-of-the-box experience to desktop Linux users.

While we could also specify the "emoji" font family either instead of or
in addition to the locale, doing so requires more plumbing in the code
and may be done in the future.

[1]: googlefonts/noto-emoji#36
[2]: https://unicode.org/reports/tr51/#Emoji_Script
[3]: https://bugs.freedesktop.org/show_bug.cgi?id=94551

Bug: 767754
Change-Id: Ie8019cc0540a177c816c8131ca7c6a504952aa09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2207627
Commit-Queue: Timothy Gu <[email protected]>
Reviewed-by: Dominik Röttsches <[email protected]>
Cr-Commit-Position: refs/heads/master@{#772414}
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this issue Oct 14, 2022
Prior to this CL, Chrome on desktop Linux often inconsistently used
contour fonts (e.g., DejaVu Sans and Noto Sans Symbols2) for some
emojis, even when a dedicated emoji font (e.g., Noto Color Emoji) is
available and used for all other emojis. In order to force the color
emoji font to be used always, hacks [1] have been mentioned in online
forums that prepend the color emoji font to the list of system fonts in
fonts.conf, which can have highly deletorious effects on other
applications (like normal numerals becoming their emoji versions).

The ISO locale code "und-Zsye" [2] is one of the ways of informing
fontconfig (as of version 2.12.5) that color emoji fonts should be
preferred, along with the special font family "emoji" [3]. fontconfig
also has default configurations that automatically map the locale and
the "emoji" family to any available color emoji font. By explicitly
setting the locale to "und-Zsye", this CL provides the desired
out-of-the-box experience to desktop Linux users.

While we could also specify the "emoji" font family either instead of or
in addition to the locale, doing so requires more plumbing in the code
and may be done in the future.

[1]: googlefonts/noto-emoji#36
[2]: https://unicode.org/reports/tr51/#Emoji_Script
[3]: https://bugs.freedesktop.org/show_bug.cgi?id=94551

Bug: 767754
Change-Id: Ie8019cc0540a177c816c8131ca7c6a504952aa09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2207627
Commit-Queue: Timothy Gu <[email protected]>
Reviewed-by: Dominik Röttsches <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#772414}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 671511b00e2d6c374a3079c1c379d2d0dfad32fe
@haarp
Copy link

haarp commented Aug 13, 2023

Since some people (in forums and other places) are still struggling getting this font to work properly, here's the necessary steps.

Problem 1: Noto Color Emoji renders with inverted colors -> Bug in your toolkit/lib. Should be fixed everywhere by now, go upgrade.

Problem 2: Emoji are much larger than surrounding text -> Noto is a bitmap font with 64px tall glyphs. To allow them to shrink, scaling must be allowed in fontconfig. Either enable globally (look for 10-scale-bitmap-fonts.conf or so), or just for Noto with this:

<match target="font">
	<test name="family"><string>Noto Color Emoji</string></test>
	<edit name="pixelsizefixupfactor" mode="assign">
		<divide>
			<name target="pattern">pixelsize</name>
			<name target="font"   >pixelsize</name>
		</divide>
	</edit>
	<edit name="matrix" mode="assign">
		<times>
			<name>matrix</name>
			<matrix>
				<name>pixelsizefixupfactor</name> <double>0</double>
				<double>0</double> <name>pixelsizefixupfactor</name>
			</matrix>
		</times>
	</edit>
	<edit name="size" mode="assign">
		<divide>
			<name>size</name>
			<name>pixelsizefixupfactor</name>
		</divide>
	</edit>
</match>

Problem 3: Getting emojis from other/black-and-white fonts mixed in -> Your regular fontset (usually DejaVu) has some emoji glyphs that are being preferred. Tell fontconfig to prepend Noto:

<match>
	<test name="family"><string>sans-serif</string></test>
	<test name="prgname" compare="not_contains"><string>Ripcord</string></test>
	<edit name="family" mode="prepend" binding="weak">
		<string>Noto Color Emoji</string>
	</edit>
</match>
<match>
	<test name="family"><string>serif</string></test>
	<test name="prgname" compare="not_contains"><string>Ripcord</string></test>
	<edit name="family" mode="prepend" binding="weak">
		<string>Noto Color Emoji</string>
	</edit>
</match>

Problem 4: Random stuff, not just emoji get replaced with Noto -> Do you have an older Noto (non-color) Emoji installed? Get rid of it.

Problem 5: Some apps still render broken fonts? Likely the app is broken. Ripcord is known to be problematic, see here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests