Navigation Menu

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

nixos/fontconfig: Allow setting default emoji font #67667

Merged
merged 4 commits into from Sep 1, 2019

Conversation

jtojnar
Copy link
Contributor

@jtojnar jtojnar commented Aug 29, 2019

In fontconfig’s 60-generic.conf, order of preference is established for emoji font family. Because fontconfig parses the config files in lexicographic order, appending each <prefer> from <alias> element to the family’s prefer list (to be prepended before the family) 1, our font family defaults stored in 52-nixos-default-fonts.conf will take precedence. That is, of course, unless the default weak binding 2 is used. Emoji family binds strongly 3, so we need to set binding to same for our <alias>es to be considered before the ones from 60-generic.conf.

By default, we will set the option to all emoji fonts supported by fontconfig, so that emoji works for user if they have at least one emoji font installed. If they have multiple emoji fonts installed, we will use the fontconfig’s order of preference 4.

Blocking PRs

Related PRs

@jtojnar jtojnar added this to the 19.09 milestone Aug 29, 2019
@jtojnar
Copy link
Contributor Author

jtojnar commented Aug 29, 2019

cc @vcunat @ttuegel (#9110 (comment)) re binding="same".

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested using #67522 which adds the noto font default for gnome3 and the following configuration

fonts.fonts = [ pkgs.joypixels ];
fonts.fontconfig.defaultFonts.emoji = ["JoyPixels"];

(note penultimate has to be disabled for this to work properly)

And fc-match --verbose "Emoji" shows that JoyPixels was matched. ✔️

@worldofpeace
Copy link
Contributor

cc @volth (perhaps could be helpful as well)

@jtojnar
Copy link
Contributor Author

jtojnar commented Aug 29, 2019

Moved JoyPixels before EmojiOne as per https://gitlab.freedesktop.org/fontconfig/fontconfig/merge_requests/67#note_216169.

@jtojnar
Copy link
Contributor Author

jtojnar commented Aug 29, 2019

Added a test, which depends on #67529.

And apparently it does not work with TwEmoji, even though it work with JoyPixels just fine:

--- a/nixos/tests/fontconfig-default-fonts.nix
+++ b/nixos/tests/fontconfig-default-fonts.nix
@@ -8,6 +8,7 @@ import ./make-test.nix ({ lib, ... }:
       noto-fonts-emoji
       cantarell-fonts
       twemoji-color-font
+      joypixels
       source-code-pro
       gentium
     ];
@@ -15,8 +16,9 @@ import ./make-test.nix ({ lib, ... }:
       serif = [ "Gentium Plus" ];
       sansSerif = [ "Cantarell" ];
       monospace = [ "Source Code Pro" ];
-      emoji = [ "Twitter Color Emoji" ];
+      emoji = [ "JoyPixels" ];
     };
+    nixpkgs.config.allowUnfree = true;
   };
 
   testScript = ''
@@ -27,6 +29,6 @@ import ./make-test.nix ({ lib, ... }:
     $machine->succeed("fc-match serif | grep '\"Gentium Plus\"'");
     $machine->succeed("fc-match sans-serif | grep '\"Cantarell\"'");
     $machine->succeed("fc-match monospace | grep '\"Source Code Pro\"'");
-    $machine->succeed("fc-match emoji | grep '\"Twitter Color Emoji\"'");
+    $machine->succeed("fc-match emoji | grep '\"JoyPixels\"'");
   '';
 })

At this point, I am tempted to just call it a quits and add a comment that you can only switch between Noto and JoyPixels 😫

@jtojnar
Copy link
Contributor Author

jtojnar commented Aug 29, 2019

These are the outputs of matching for each default:

fonts.fontconfig.defaultFonts.emoji = [ "Noto Color Emoji" ];

$ env FC_DEBUG=1 pango-view e
FC_DEBUG=1
Match Pattern has 27 elts (size 32)
	family: "Noto Color Emoji"(s) "JoyPixels"(s) "Emoji Two"(s) "Emoji One"(s) "Noto Color Emoji"(s) "Apple Color Emoji"(s) "Segoe UI Emoji"(s) "Twitter Color Emoji"(s) "EmojiOne Mozilla"(s) "Noto Emoji"(s) "Android Emoji"(s) "emoji"(s) "DejaVu Sans"(w) "Bitstream Vera Sans"(w) "DejaVu Sans"(w) "Verdana"(w) "Arial"(w) "Albany AMT"(w) "Luxi Sans"(w) "Nimbus Sans L"(w) "Nimbus Sans"(w) "Helvetica"(w) "Lucida Sans Unicode"(w) "BPG Glaho International"(w) "Tahoma"(w) "Nachlieli"(w) "Lucida Sans Unicode"(w) "Yudit Unicode"(w) "Kerkis"(w) "ArmNet Helvetica"(w) "Artsounk"(w) "BPG UTF8 M"(w) "Waree"(w) "Loma"(w) "Garuda"(w) "Umpush"(w) "Saysettha Unicode"(w) "JG Lao Old Arial"(w) "GF Zemen Unicode"(w) "Pigiarniq"(w) "B Davat"(w) "B Compset"(w) "Kacst-Qr"(w) "Urdu Nastaliq Unicode"(w) "Raghindi"(w) "Mukti Narrow"(w) "malayalam"(w) "Sampige"(w) "padmaa"(w) "Hapax Berbère"(w) "MS Gothic"(w) "UmePlus P Gothic"(w) "Microsoft YaHei"(w) "Microsoft JhengHei"(w) "WenQuanYi Zen Hei"(w) "WenQuanYi Bitmap Song"(w) "AR PL ShanHeiSun Uni"(w) "AR PL New Sung"(w) "MgOpen Modata"(w) "VL Gothic"(w) "IPAMonaGothic"(w) "IPAGothic"(w) "Sazanami Gothic"(w) "Kochi Gothic"(w) "AR PL KaitiM GB"(w) "AR PL KaitiM Big5"(w) "AR PL ShanHeiSun Uni"(w) "AR PL SungtiL GB"(w) "AR PL Mingti2L Big5"(w) "MS ゴシック"(w) "ZYSong18030"(w) "TSCu_Paranar"(w) "NanumGothic"(w) "UnDotum"(w) "Baekmuk Dotum"(w) "Baekmuk Gulim"(w) "KacstQura"(w) "Lohit Bengali"(w) "Lohit Gujarati"(w) "Lohit Hindi"(w) "Lohit Marathi"(w) "Lohit Maithili"(w) "Lohit Kashmiri"(w) "Lohit Konkani"(w) "Lohit Nepali"(w) "Lohit Sindhi"(w) "Lohit Punjabi"(w) "Lohit Tamil"(w) "Meera"(w) "Lohit Malayalam"(w) "Lohit Kannada"(w) "Lohit Telugu"(w) "Lohit Oriya"(w) "LKLUG"(w) "FreeSans"(w) "Arial Unicode MS"(w) "Arial Unicode"(w) "Code2000"(w) "Code2001"(w) "sans-serif"(w) "Roya"(w) "Koodak"(w) "Terafik"(w)
	familylang: "en"(s) "en-us"(w)
	stylelang: "en"(s) "en-us"(w)
	fullnamelang: "en"(s) "en-us"(w)
	slant: 0(i)(s)
	weight: 80(f)(s)
	width: 100(i)(s)
	size: 12(f)(s)
	pixelsize: 16(f)(s)
	antialias: True(w)
	hintstyle: 1(i)(w) 1(i)(w)
	hinting: True(w)
	verticallayout: False(s)
	autohint: False(w)
	globaladvance: True(s)
	dpi: 96(f)(s)
	rgba: 1(i)(w)
	lang: "und-zsye"(w) "en-us"(s) "en"(w)
	fontversion: 2147483647(i)(s)
	embeddedbitmap: True(s)
	decorative: False(s)
	lcdfilter: 1(i)(w)
	namelang: "en"(s)
	prgname: "pango-view"(s)
	color: True(w)
	symbol: False(s)
	pangoversion: 14300(i)(s)

Best score 0 0 0 0 0 0 0 0 0 1012 0 0 0 0 93000 0 0 0 0 0 1000 0 0 2.14735e+12
Pattern has 26 elts (size 26)
	family: "Noto Color Emoji"(w)
	familylang: "en"(w)
	style: "Regular"(w)
	stylelang: "en"(w)
	fullname: "Noto Color Emoji"(w)
	fullnamelang: "en"(w)
	slant: 0(i)(w)
	weight: 80(i)(w)
	width: 100(i)(w)
	pixelsize: 109(f)(w)
	spacing: 100(i)(w)
	foundry: "GOOG"(w)
	antialias: False(w)
	file: "/nix/store/bva6hrnq16rnapcmlqrhw9fpqn91xzsw-noto-fonts-emoji-2018-08-10-unicode11/share/fonts/noto/NotoColorEmoji.ttf"(w)
	index: 0(i)(w)
	outline: False(w)
	scalable: True(w)
	charset: 
	0000: 00002001 03ff0409 00000000 00000000 00000000 00004200 00000000 00000000
	0020: 00002000 10000000 00000200 00000000 00000000 00000000 00000000 00000008
	0021: 00000000 02000004 00000000 00000000 03f00000 00000600 00000000 00000000
	0023: 0c000000 00000100 00000000 00000000 00000000 00000000 00008000 070ffe00
	0024: 00000000 00000000 00000000 00000000 00000000 00000000 00000004 00000000
	0025: 00000000 00000000 00000000 00000000 00000000 00400c00 00000001 78000000
	0026: 2132401f 0700c44d 800fff05 c8000169 1afc0000 60030c03 001ac130 27bf0600
	0027: 2054bf24 00180102 00b85090 00000018 00e00000 80010002 00000000 00000000
	0029: 00000000 00300000 00000000 00000000 00000000 00000000 00000000 00000000
	002b: 180000e0 00000000 00210000 00000000 00000000 00000000 00000000 00000000
	0030: 00000000 20010000 00000000 00000000 00000000 00000000 00000000 00000000
	0032: 00000000 00000000 00000000 00000000 02800000 00000000 00000000 00000000
	01f0: 00000010 00000000 00000000 00000000 00000000 00000000 00008000 00000000
	01f1: 00000000 00000000 00000000 c0030000 07fe4000 00000000 00000000 ffffffc0
	01f2: 04000006 07fc8000 00030000 00000000 00000000 00000000 00000000 00000000
	01f3: ffffffff fffffff3 ffffffff ffffffff cecfffff ffffffff ffffffff ffb9ffff
	01f4: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff bfffffff
	01f5: ffffffff 3fffffff ffff7e00 07f980ff 00613c80 10060130 700e001c fc08810a
	01f6: ffffffff ffffffff 0000ffff 00000000 ffffffff ffffffff 0007f83f 03f91a3f
	01f9: ffff0000 77ffffff ffffffbf f479ffff ffffffff 03ff0007 ffff0007 ffffffff
	0e00: 00000000 03ff0000 00000000 87fffffe 00000000 00000000 00000000 00000000
	0fe4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00007fe0
	0fe8: 00000000 00ffd000 00000000 00000000 00000000 00000000 00000000 00000000
(w)
	lang: und-zsye(w)
	fontversion: 132186(i)(w)
	capability: "otlayout:DFLT"(w)
	fontformat: "TrueType"(w)
	decorative: False(w)
	postscriptname: "NotoColorEmoji"(w)
	color: True(w)
	symbol: False(w)

fonts.fontconfig.defaultFonts.emoji = [ "JoyPixels" ];

$ env FC_DEBUG=1 pango-view e
FC_DEBUG=1
Fontconfig warning: "/etc/fonts/2.11/conf.d/45-generic.conf", line 4: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/2.11/conf.d/45-generic.conf", line 5: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/2.11/conf.d/45-generic.conf", line 5: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/2.11/conf.d/45-generic.conf", line 5: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/2.11/conf.d/45-generic.conf", line 6: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/2.11/conf.d/45-generic.conf", line 6: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/2.11/conf.d/45-generic.conf", line 8: unknown element "description"
Fontconfig warning: "/etc/fonts/2.11/conf.d/60-generic.conf", line 4: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/2.11/conf.d/60-generic.conf", line 5: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/2.11/conf.d/60-generic.conf", line 5: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/2.11/conf.d/60-generic.conf", line 5: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/2.11/conf.d/60-generic.conf", line 6: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/2.11/conf.d/60-generic.conf", line 6: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/2.11/conf.d/60-generic.conf", line 8: unknown element "description"
Match Pattern has 27 elts (size 32)
	family: "JoyPixels"(s) "Noto Color Emoji"(s) "Apple Color Emoji"(s) "Segoe UI Emoji"(s) "Twitter Color Emoji"(s) "EmojiOne Mozilla"(s) "Emoji Two"(s) "JoyPixels"(s) "Emoji One"(s) "Noto Emoji"(s) "Android Emoji"(s) "emoji"(s) "DejaVu Sans"(w) "Bitstream Vera Sans"(w) "DejaVu Sans"(w) "Verdana"(w) "Arial"(w) "Albany AMT"(w) "Luxi Sans"(w) "Nimbus Sans L"(w) "Nimbus Sans"(w) "Helvetica"(w) "Lucida Sans Unicode"(w) "BPG Glaho International"(w) "Tahoma"(w) "Nachlieli"(w) "Lucida Sans Unicode"(w) "Yudit Unicode"(w) "Kerkis"(w) "ArmNet Helvetica"(w) "Artsounk"(w) "BPG UTF8 M"(w) "Waree"(w) "Loma"(w) "Garuda"(w) "Umpush"(w) "Saysettha Unicode"(w) "JG Lao Old Arial"(w) "GF Zemen Unicode"(w) "Pigiarniq"(w) "B Davat"(w) "B Compset"(w) "Kacst-Qr"(w) "Urdu Nastaliq Unicode"(w) "Raghindi"(w) "Mukti Narrow"(w) "malayalam"(w) "Sampige"(w) "padmaa"(w) "Hapax Berbère"(w) "MS Gothic"(w) "UmePlus P Gothic"(w) "Microsoft YaHei"(w) "Microsoft JhengHei"(w) "WenQuanYi Zen Hei"(w) "WenQuanYi Bitmap Song"(w) "AR PL ShanHeiSun Uni"(w) "AR PL New Sung"(w) "MgOpen Modata"(w) "VL Gothic"(w) "IPAMonaGothic"(w) "IPAGothic"(w) "Sazanami Gothic"(w) "Kochi Gothic"(w) "AR PL KaitiM GB"(w) "AR PL KaitiM Big5"(w) "AR PL ShanHeiSun Uni"(w) "AR PL SungtiL GB"(w) "AR PL Mingti2L Big5"(w) "MS ゴシック"(w) "ZYSong18030"(w) "TSCu_Paranar"(w) "NanumGothic"(w) "UnDotum"(w) "Baekmuk Dotum"(w) "Baekmuk Gulim"(w) "KacstQura"(w) "Lohit Bengali"(w) "Lohit Gujarati"(w) "Lohit Hindi"(w) "Lohit Marathi"(w) "Lohit Maithili"(w) "Lohit Kashmiri"(w) "Lohit Konkani"(w) "Lohit Nepali"(w) "Lohit Sindhi"(w) "Lohit Punjabi"(w) "Lohit Tamil"(w) "Meera"(w) "Lohit Malayalam"(w) "Lohit Kannada"(w) "Lohit Telugu"(w) "Lohit Oriya"(w) "LKLUG"(w) "FreeSans"(w) "Arial Unicode MS"(w) "Arial Unicode"(w) "Code2000"(w) "Code2001"(w) "sans-serif"(w) "Roya"(w) "Koodak"(w) "Terafik"(w)
	familylang: "en"(s) "en-us"(w)
	stylelang: "en"(s) "en-us"(w)
	fullnamelang: "en"(s) "en-us"(w)
	slant: 0(i)(s)
	weight: 80(f)(s)
	width: 100(i)(s)
	size: 12(f)(s)
	pixelsize: 16(f)(s)
	antialias: True(w)
	hintstyle: 1(i)(w) 1(i)(w)
	hinting: True(w)
	verticallayout: False(s)
	autohint: False(w)
	globaladvance: True(s)
	dpi: 96(f)(s)
	rgba: 1(i)(w)
	lang: "und-zsye"(w) "en-us"(s) "en"(w)
	fontversion: 2147483647(i)(s)
	embeddedbitmap: True(s)
	decorative: False(s)
	lcdfilter: 1(i)(w)
	namelang: "en"(s)
	prgname: "pango-view"(s)
	color: True(w)
	symbol: False(s)
	pangoversion: 14300(i)(s)

Best score 0 0 0 0 0 0 0 0 0 1012 0 0 0 0 93000 0 0 0 0 0 1000 0 0 2.14722e+12
Pattern has 25 elts (size 25)
	family: "JoyPixels"(w)
	familylang: "en"(w)
	style: "Regular"(w)
	stylelang: "en"(w)
	fullname: "JoyPixels"(w)
	fullnamelang: "en"(w)
	slant: 0(i)(w)
	weight: 80(i)(w)
	width: 100(i)(w)
	pixelsize: 109(f)(w)
	foundry: "GOOG"(w)
	antialias: False(w)
	file: "/nix/store/wklakiizblrblaxj1zfwc3k1f8s7lgf7-emojione-5.0.2/share/fonts/truetype/joypixels.ttf"(w)
	index: 0(i)(w)
	outline: False(w)
	scalable: True(w)
	charset: 
	0000: 00002001 03ff0409 00000000 00000000 00000000 00004200 00000000 00000000
	0020: 00002000 10000000 00000200 00000000 00000000 00000000 00000000 00000008
	0021: 00000000 02000004 00000000 00000000 03f00000 00000600 00000000 00000000
	0023: 0c000000 00000100 00000000 00000000 00000000 00000000 00008000 070ffe00
	0024: 00000000 00000000 00000000 00000000 00000000 00000000 00000004 00000000
	0025: 00000000 00000000 00000000 00000000 00000000 00400c00 00000001 78000000
	0026: 2132401f 0700c44d 800fff05 c8000169 1afc0000 60030c03 001ac130 27bf0600
	0027: 2054bf24 00180102 00b85090 00000018 00e00000 80010002 00000000 00000000
	0029: 00000000 00300000 00000000 00000000 00000000 00000000 00000000 00000000
	002b: 180000e0 00000000 00210000 00000000 00000000 00000000 00000000 00000000
	0030: 00000000 20010000 00000000 00000000 00000000 00000000 00000000 00000000
	0032: 00000000 00000000 00000000 00000000 02800000 00000000 00000000 00000000
	01f0: 00000010 00000000 00000000 00000000 00000000 00000000 00008000 00000000
	01f1: 00000000 00000000 00000000 c0030000 07fe4000 00000000 00000000 ffffffc0
	01f2: 04000006 07fc8000 00030000 00000000 00000000 00000000 00000000 00000000
	01f3: ffffffff fffffff3 ffffffff ffffffff cecfffff ffffffff ffffffff ffb9ffff
	01f4: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff bfffffff
	01f5: ffffffff 3fffffff ffff7e00 07f980ff 00613c80 10060130 700e001c fc08810a
	01f6: ffffffff ffffffff 0000ffff 00000000 ffffffff ffffffff 0027f83f 07f91a3f
	01f7: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000fff
	01f9: ffffe000 f7ffffff ffffffbf fc7bffff ffffffff ffffc7e7 ffffe7ff ffffffff
	01fa: 00000000 00000000 00000000 070f0000 003f0007 00000000 00000000 00000000
	0e00: 00000000 03ff0000 00000000 87fffffe 00000000 00000000 00000000 00000000
	0fe4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00007fe0
	0fe8: 00000000 00ffd000 00000000 00000000 00000000 00000000 00000000 00000000
(w)
	lang: und-zsye(w)
	fontversion: 262144(i)(w)
	capability: "otlayout:DFLT"(w)
	fontformat: "TrueType"(w)
	decorative: False(w)
	postscriptname: "JoyPixels"(w)
	color: True(w)
	symbol: False(w)

fonts.fontconfig.defaultFonts.emoji = [ "Twitter Color Emoji" ];

$ env FC_DEBUG=1 pango-view e
FC_DEBUG=1
Fontconfig warning: "/etc/fonts/2.11/conf.d/45-generic.conf", line 4: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/2.11/conf.d/45-generic.conf", line 5: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/2.11/conf.d/45-generic.conf", line 5: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/2.11/conf.d/45-generic.conf", line 5: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/2.11/conf.d/45-generic.conf", line 6: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/2.11/conf.d/45-generic.conf", line 6: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/2.11/conf.d/45-generic.conf", line 8: unknown element "description"
Fontconfig warning: "/etc/fonts/2.11/conf.d/60-generic.conf", line 4: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/2.11/conf.d/60-generic.conf", line 5: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/2.11/conf.d/60-generic.conf", line 5: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/2.11/conf.d/60-generic.conf", line 5: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/2.11/conf.d/60-generic.conf", line 6: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/2.11/conf.d/60-generic.conf", line 6: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/2.11/conf.d/60-generic.conf", line 8: unknown element "description"
Match Pattern has 27 elts (size 32)
	family: "Twitter Color Emoji"(s) "Noto Color Emoji"(s) "Apple Color Emoji"(s) "Segoe UI Emoji"(s) "Twitter Color Emoji"(s) "EmojiOne Mozilla"(s) "Emoji Two"(s) "JoyPixels"(s) "Emoji One"(s) "Noto Emoji"(s) "Android Emoji"(s) "emoji"(s) "DejaVu Sans"(w) "Bitstream Vera Sans"(w) "DejaVu Sans"(w) "Verdana"(w) "Arial"(w) "Albany AMT"(w) "Luxi Sans"(w) "Nimbus Sans L"(w) "Nimbus Sans"(w) "Helvetica"(w) "Lucida Sans Unicode"(w) "BPG Glaho International"(w) "Tahoma"(w) "Nachlieli"(w) "Lucida Sans Unicode"(w) "Yudit Unicode"(w) "Kerkis"(w) "ArmNet Helvetica"(w) "Artsounk"(w) "BPG UTF8 M"(w) "Waree"(w) "Loma"(w) "Garuda"(w) "Umpush"(w) "Saysettha Unicode"(w) "JG Lao Old Arial"(w) "GF Zemen Unicode"(w) "Pigiarniq"(w) "B Davat"(w) "B Compset"(w) "Kacst-Qr"(w) "Urdu Nastaliq Unicode"(w) "Raghindi"(w) "Mukti Narrow"(w) "malayalam"(w) "Sampige"(w) "padmaa"(w) "Hapax Berbère"(w) "MS Gothic"(w) "UmePlus P Gothic"(w) "Microsoft YaHei"(w) "Microsoft JhengHei"(w) "WenQuanYi Zen Hei"(w) "WenQuanYi Bitmap Song"(w) "AR PL ShanHeiSun Uni"(w) "AR PL New Sung"(w) "MgOpen Modata"(w) "VL Gothic"(w) "IPAMonaGothic"(w) "IPAGothic"(w) "Sazanami Gothic"(w) "Kochi Gothic"(w) "AR PL KaitiM GB"(w) "AR PL KaitiM Big5"(w) "AR PL ShanHeiSun Uni"(w) "AR PL SungtiL GB"(w) "AR PL Mingti2L Big5"(w) "MS ゴシック"(w) "ZYSong18030"(w) "TSCu_Paranar"(w) "NanumGothic"(w) "UnDotum"(w) "Baekmuk Dotum"(w) "Baekmuk Gulim"(w) "KacstQura"(w) "Lohit Bengali"(w) "Lohit Gujarati"(w) "Lohit Hindi"(w) "Lohit Marathi"(w) "Lohit Maithili"(w) "Lohit Kashmiri"(w) "Lohit Konkani"(w) "Lohit Nepali"(w) "Lohit Sindhi"(w) "Lohit Punjabi"(w) "Lohit Tamil"(w) "Meera"(w) "Lohit Malayalam"(w) "Lohit Kannada"(w) "Lohit Telugu"(w) "Lohit Oriya"(w) "LKLUG"(w) "FreeSans"(w) "Arial Unicode MS"(w) "Arial Unicode"(w) "Code2000"(w) "Code2001"(w) "sans-serif"(w) "Roya"(w) "Koodak"(w) "Terafik"(w)
	familylang: "en"(s) "en-us"(w)
	stylelang: "en"(s) "en-us"(w)
	fullnamelang: "en"(s) "en-us"(w)
	slant: 0(i)(s)
	weight: 80(f)(s)
	width: 100(i)(s)
	size: 12(f)(s)
	pixelsize: 16(f)(s)
	antialias: True(w)
	hintstyle: 1(i)(w) 1(i)(w)
	hinting: True(w)
	verticallayout: False(s)
	autohint: False(w)
	globaladvance: True(s)
	dpi: 96(f)(s)
	rgba: 1(i)(w)
	lang: "und-zsye"(w) "en-us"(s) "en"(w)
	fontversion: 2147483647(i)(s)
	embeddedbitmap: True(s)
	decorative: False(s)
	lcdfilter: 1(i)(w)
	namelang: "en"(s)
	prgname: "pango-view"(s)
	color: True(w)
	symbol: False(s)
	pangoversion: 14300(i)(s)

Best score 0 0 0 0 0 0 1 0 0 1012 0 0 0 0 93000 0 0 0 0 0 1000 0 0 2.14735e+12
Pattern has 26 elts (size 26)
	family: "Noto Color Emoji"(w)
	familylang: "en"(w)
	style: "Regular"(w)
	stylelang: "en"(w)
	fullname: "Noto Color Emoji"(w)
	fullnamelang: "en"(w)
	slant: 0(i)(w)
	weight: 80(i)(w)
	width: 100(i)(w)
	pixelsize: 109(f)(w)
	spacing: 100(i)(w)
	foundry: "GOOG"(w)
	antialias: False(w)
	file: "/nix/store/bva6hrnq16rnapcmlqrhw9fpqn91xzsw-noto-fonts-emoji-2018-08-10-unicode11/share/fonts/noto/NotoColorEmoji.ttf"(w)
	index: 0(i)(w)
	outline: False(w)
	scalable: True(w)
	charset: 
	0000: 00002001 03ff0409 00000000 00000000 00000000 00004200 00000000 00000000
	0020: 00002000 10000000 00000200 00000000 00000000 00000000 00000000 00000008
	0021: 00000000 02000004 00000000 00000000 03f00000 00000600 00000000 00000000
	0023: 0c000000 00000100 00000000 00000000 00000000 00000000 00008000 070ffe00
	0024: 00000000 00000000 00000000 00000000 00000000 00000000 00000004 00000000
	0025: 00000000 00000000 00000000 00000000 00000000 00400c00 00000001 78000000
	0026: 2132401f 0700c44d 800fff05 c8000169 1afc0000 60030c03 001ac130 27bf0600
	0027: 2054bf24 00180102 00b85090 00000018 00e00000 80010002 00000000 00000000
	0029: 00000000 00300000 00000000 00000000 00000000 00000000 00000000 00000000
	002b: 180000e0 00000000 00210000 00000000 00000000 00000000 00000000 00000000
	0030: 00000000 20010000 00000000 00000000 00000000 00000000 00000000 00000000
	0032: 00000000 00000000 00000000 00000000 02800000 00000000 00000000 00000000
	01f0: 00000010 00000000 00000000 00000000 00000000 00000000 00008000 00000000
	01f1: 00000000 00000000 00000000 c0030000 07fe4000 00000000 00000000 ffffffc0
	01f2: 04000006 07fc8000 00030000 00000000 00000000 00000000 00000000 00000000
	01f3: ffffffff fffffff3 ffffffff ffffffff cecfffff ffffffff ffffffff ffb9ffff
	01f4: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff bfffffff
	01f5: ffffffff 3fffffff ffff7e00 07f980ff 00613c80 10060130 700e001c fc08810a
	01f6: ffffffff ffffffff 0000ffff 00000000 ffffffff ffffffff 0007f83f 03f91a3f
	01f9: ffff0000 77ffffff ffffffbf f479ffff ffffffff 03ff0007 ffff0007 ffffffff
	0e00: 00000000 03ff0000 00000000 87fffffe 00000000 00000000 00000000 00000000
	0fe4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00007fe0
	0fe8: 00000000 00ffd000 00000000 00000000 00000000 00000000 00000000 00000000
(w)
	lang: und-zsye(w)
	fontversion: 132186(i)(w)
	capability: "otlayout:DFLT"(w)
	fontformat: "TrueType"(w)
	decorative: False(w)
	postscriptname: "NotoColorEmoji"(w)
	color: True(w)
	symbol: False(w)

@jtojnar
Copy link
Contributor Author

jtojnar commented Aug 29, 2019

Using FC_DEBUG=3, I can see the score of Twitter Color Emoji:

Font 3325 Pattern has 23 elts (size 23)
	family: "Twitter Color Emoji"(w)
	familylang: "en"(w)
	style: "Regular"(w)
	stylelang: "en"(w)
	fullname: "Twitter Color Emoji SVGinOT"(w)
	fullnamelang: "en"(w)
	slant: 0(i)(w)
	weight: 80(i)(w)
	width: 100(i)(w)
	foundry: "PfEd"(w)
	file: "/nix/store/i4738pfasil4bzx2pnmk3yl62mfi4mpz-twemoji-color-font-12.0.1/share/fonts/truetype/TwitterColorEmoji-SVGinOT.ttf"(w)
	index: 0(i)(w)
	outline: True(w)
	scalable: True(w)
	charset: 
	0000: 00000000 00000001 00000000 00000000 00000000 00004200 00000000 00000000
	0020: 00002000 10000000 00000200 00000000 00000000 00000000 00000000 00000000
	0021: 00000000 02000004 00000000 00000000 03f00000 00000600 00000000 00000000
	0023: 0c000000 00000100 00000000 00000000 00000000 00000000 00008000 7f0ffe00
	0024: 00000000 00000000 00000000 00000000 00000000 00000000 00000004 00000000
	0025: 00000000 00000000 00000000 00000000 00000000 00400c00 00000001 78000000
	0026: 2132401f 0700c44d 800fff05 c8000169 1afc0000 60030c03 001ac130 27bf0600
	0027: 2054bf24 00180102 00b85090 00000018 00e00000 80010002 00000000 00000000
	0029: 00000000 00300000 00000000 00000000 00000000 00000000 00000000 00000000
	002b: 180000e0 00000000 01210000 00000000 00000000 00000000 00000000 00000000
	0030: 00000000 20010000 00000000 00000000 00000000 00000000 00000000 00000000
	0032: 00000000 00000000 00000000 00000000 02800000 00000000 00000000 00000000
	00e5: 00000400 00000000 00000000 00000000 00000000 00000000 00000000 00000000
	00fe: 00008000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
	01f0: 00000010 00000000 00000000 00000000 00000000 00000000 00008000 00000000
	01f1: 00000000 00000000 00000000 c0030000 07fe4000 00000000 00000000 ffffffc0
	01f2: 04000006 07fc8000 00030000 00000000 00000000 00000000 00000000 00000000
	01f3: ffffffff fffffff3 ffffffff ffffffff cecfffff ffffffff ffffffff ffb9ffff
	01f4: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff bfffffff
	01f5: ffffffff 3fffffff ffff7e00 07f980ff 00613c80 10060130 700e001c fc08810a
	01f6: ffffffff ffffffff 0000ffff 00000000 ffffffff ffffffff 0027f83f 07f91a3f
	01f7: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000fff
	01f9: ffffe000 f7ffffff ffffffbf fc7bffff ffffffff ffffc7e7 ffffe7ff ffffffff
	01fa: 00000000 00000000 00000000 070f0000 003f0007 00000000 00000000 00000000
(w)
	lang: und-zsye(w)
	fontversion: 65536(i)(w)
	capability: "otlayout:latn"(w)
	fontformat: "TrueType"(w)
	decorative: False(w)
	postscriptname: "TwitterColorEmojiSVGinOT"(w)
	color: False(w)
	symbol: False(w)

 family: 0  "Twitter Color Emoji"(s) "Noto Color Emoji"(s) "Apple Color Emoji"(s) "Segoe UI Emoji"(s) "Twitter Color Emoji"(s) "EmojiOne Mozilla"(s) "Emoji Two"(s) "JoyPixels"(s) "Emoji One"(s) "Noto Emoji"(s) "Android Emoji"(s) "emoji"(s) "DejaVu Sans"(w) "Bitstream Vera Sans"(w) "DejaVu Sans"(w) "Verdana"(w) "Arial"(w) "Albany AMT"(w) "Luxi Sans"(w) "Nimbus Sans L"(w) "Nimbus Sans"(w) "Helvetica"(w) "Lucida Sans Unicode"(w) "BPG Glaho International"(w) "Tahoma"(w) "Nachlieli"(w) "Lucida Sans Unicode"(w) "Yudit Unicode"(w) "Kerkis"(w) "ArmNet Helvetica"(w) "Artsounk"(w) "BPG UTF8 M"(w) "Waree"(w) "Loma"(w) "Garuda"(w) "Umpush"(w) "Saysettha Unicode"(w) "JG Lao Old Arial"(w) "GF Zemen Unicode"(w) "Pigiarniq"(w) "B Davat"(w) "B Compset"(w) "Kacst-Qr"(w) "Urdu Nastaliq Unicode"(w) "Raghindi"(w) "Mukti Narrow"(w) "malayalam"(w) "Sampige"(w) "padmaa"(w) "Hapax Berbère"(w) "MS Gothic"(w) "UmePlus P Gothic"(w) "Microsoft YaHei"(w) "Microsoft JhengHei"(w) "WenQuanYi Zen Hei"(w) "WenQuanYi Bitmap Song"(w) "AR PL ShanHeiSun Uni"(w) "AR PL New Sung"(w) "MgOpen Modata"(w) "VL Gothic"(w) "IPAMonaGothic"(w) "IPAGothic"(w) "Sazanami Gothic"(w) "Kochi Gothic"(w) "AR PL KaitiM GB"(w) "AR PL KaitiM Big5"(w) "AR PL ShanHeiSun Uni"(w) "AR PL SungtiL GB"(w) "AR PL Mingti2L Big5"(w) "MS ゴシック"(w) "ZYSong18030"(w) "TSCu_Paranar"(w) "NanumGothic"(w) "UnDotum"(w) "Baekmuk Dotum"(w) "Baekmuk Gulim"(w) "KacstQura"(w) "Lohit Bengali"(w) "Lohit Gujarati"(w) "Lohit Hindi"(w) "Lohit Marathi"(w) "Lohit Maithili"(w) "Lohit Kashmiri"(w) "Lohit Konkani"(w) "Lohit Nepali"(w) "Lohit Sindhi"(w) "Lohit Punjabi"(w) "Lohit Tamil"(w) "Meera"(w) "Lohit Malayalam"(w) "Lohit Kannada"(w) "Lohit Telugu"(w) "Lohit Oriya"(w) "LKLUG"(w) "FreeSans"(w) "Arial Unicode MS"(w) "Arial Unicode"(w) "Code2000"(w) "Code2001"(w) "sans-serif"(w) "Roya"(w) "Koodak"(w) "Terafik"(w),  "Twitter Color Emoji"(w)
 slant: 0  0(i)(s),  0(i)(w)
 weight: 0  80(f)(s),  80(i)(w)
 width: 0  100(i)(s),  100(i)(w)
 lang: 0  "und-zsye"(w) "en-us"(s) "en"(w),  und-zsye(w)
 fontversion: 2.14742e+12  2147483647(i)(s),  65536(i)(w)
 decorative: 0  False(s),  False(w)
 color: 1000  True(w),  False(w)
 symbol: 0  False(s),  False(w)
Score 0 0 0 1000 0 0 0 0 0 1012 0 0 0 0 0 0 0 0 0 0 0 0 0 2.14742e+12

@jtojnar
Copy link
Contributor Author

jtojnar commented Aug 29, 2019

I guess the main issue is that the Twitter Color Emoji font claims it does not support colours, getting a 1000 score penalty there. Compare it with Noto Color Emoji, which gets 1 in name penalty:

Font 3323 Pattern has 26 elts (size 26)
	family: "Noto Color Emoji"(w)
	familylang: "en"(w)
	style: "Regular"(w)
	stylelang: "en"(w)
	fullname: "Noto Color Emoji"(w)
	fullnamelang: "en"(w)
	slant: 0(i)(w)
	weight: 80(i)(w)
	width: 100(i)(w)
	pixelsize: 109(f)(w)
	spacing: 100(i)(w)
	foundry: "GOOG"(w)
	antialias: False(w)
	file: "/nix/store/bva6hrnq16rnapcmlqrhw9fpqn91xzsw-noto-fonts-emoji-2018-08-10-unicode11/share/fonts/noto/NotoColorEmoji.ttf"(w)
	index: 0(i)(w)
	outline: False(w)
	scalable: True(w)
	charset: 
	0000: 00002001 03ff0409 00000000 00000000 00000000 00004200 00000000 00000000
	0020: 00002000 10000000 00000200 00000000 00000000 00000000 00000000 00000008
	0021: 00000000 02000004 00000000 00000000 03f00000 00000600 00000000 00000000
	0023: 0c000000 00000100 00000000 00000000 00000000 00000000 00008000 070ffe00
	0024: 00000000 00000000 00000000 00000000 00000000 00000000 00000004 00000000
	0025: 00000000 00000000 00000000 00000000 00000000 00400c00 00000001 78000000
	0026: 2132401f 0700c44d 800fff05 c8000169 1afc0000 60030c03 001ac130 27bf0600
	0027: 2054bf24 00180102 00b85090 00000018 00e00000 80010002 00000000 00000000
	0029: 00000000 00300000 00000000 00000000 00000000 00000000 00000000 00000000
	002b: 180000e0 00000000 00210000 00000000 00000000 00000000 00000000 00000000
	0030: 00000000 20010000 00000000 00000000 00000000 00000000 00000000 00000000
	0032: 00000000 00000000 00000000 00000000 02800000 00000000 00000000 00000000
	01f0: 00000010 00000000 00000000 00000000 00000000 00000000 00008000 00000000
	01f1: 00000000 00000000 00000000 c0030000 07fe4000 00000000 00000000 ffffffc0
	01f2: 04000006 07fc8000 00030000 00000000 00000000 00000000 00000000 00000000
	01f3: ffffffff fffffff3 ffffffff ffffffff cecfffff ffffffff ffffffff ffb9ffff
	01f4: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff bfffffff
	01f5: ffffffff 3fffffff ffff7e00 07f980ff 00613c80 10060130 700e001c fc08810a
	01f6: ffffffff ffffffff 0000ffff 00000000 ffffffff ffffffff 0007f83f 03f91a3f
	01f9: ffff0000 77ffffff ffffffbf f479ffff ffffffff 03ff0007 ffff0007 ffffffff
	0e00: 00000000 03ff0000 00000000 87fffffe 00000000 00000000 00000000 00000000
	0fe4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00007fe0
	0fe8: 00000000 00ffd000 00000000 00000000 00000000 00000000 00000000 00000000
(w)
	lang: und-zsye(w)
	fontversion: 132186(i)(w)
	capability: "otlayout:DFLT"(w)
	fontformat: "TrueType"(w)
	decorative: False(w)
	postscriptname: "NotoColorEmoji"(w)
	color: True(w)
	symbol: False(w)

 family: 1  "Twitter Color Emoji"(s) "Noto Color Emoji"(s) "Apple Color Emoji"(s) "Segoe UI Emoji"(s) "Twitter Color Emoji"(s) "EmojiOne Mozilla"(s) "Emoji Two"(s) "JoyPixels"(s) "Emoji One"(s) "Noto Emoji"(s) "Android Emoji"(s) "emoji"(s) "DejaVu Sans"(w) "Bitstream Vera Sans"(w) "DejaVu Sans"(w) "Verdana"(w) "Arial"(w) "Albany AMT"(w) "Luxi Sans"(w) "Nimbus Sans L"(w) "Nimbus Sans"(w) "Helvetica"(w) "Lucida Sans Unicode"(w) "BPG Glaho International"(w) "Tahoma"(w) "Nachlieli"(w) "Lucida Sans Unicode"(w) "Yudit Unicode"(w) "Kerkis"(w) "ArmNet Helvetica"(w) "Artsounk"(w) "BPG UTF8 M"(w) "Waree"(w) "Loma"(w) "Garuda"(w) "Umpush"(w) "Saysettha Unicode"(w) "JG Lao Old Arial"(w) "GF Zemen Unicode"(w) "Pigiarniq"(w) "B Davat"(w) "B Compset"(w) "Kacst-Qr"(w) "Urdu Nastaliq Unicode"(w) "Raghindi"(w) "Mukti Narrow"(w) "malayalam"(w) "Sampige"(w) "padmaa"(w) "Hapax Berbère"(w) "MS Gothic"(w) "UmePlus P Gothic"(w) "Microsoft YaHei"(w) "Microsoft JhengHei"(w) "WenQuanYi Zen Hei"(w) "WenQuanYi Bitmap Song"(w) "AR PL ShanHeiSun Uni"(w) "AR PL New Sung"(w) "MgOpen Modata"(w) "VL Gothic"(w) "IPAMonaGothic"(w) "IPAGothic"(w) "Sazanami Gothic"(w) "Kochi Gothic"(w) "AR PL KaitiM GB"(w) "AR PL KaitiM Big5"(w) "AR PL ShanHeiSun Uni"(w) "AR PL SungtiL GB"(w) "AR PL Mingti2L Big5"(w) "MS ゴシック"(w) "ZYSong18030"(w) "TSCu_Paranar"(w) "NanumGothic"(w) "UnDotum"(w) "Baekmuk Dotum"(w) "Baekmuk Gulim"(w) "KacstQura"(w) "Lohit Bengali"(w) "Lohit Gujarati"(w) "Lohit Hindi"(w) "Lohit Marathi"(w) "Lohit Maithili"(w) "Lohit Kashmiri"(w) "Lohit Konkani"(w) "Lohit Nepali"(w) "Lohit Sindhi"(w) "Lohit Punjabi"(w) "Lohit Tamil"(w) "Meera"(w) "Lohit Malayalam"(w) "Lohit Kannada"(w) "Lohit Telugu"(w) "Lohit Oriya"(w) "LKLUG"(w) "FreeSans"(w) "Arial Unicode MS"(w) "Arial Unicode"(w) "Code2000"(w) "Code2001"(w) "sans-serif"(w) "Roya"(w) "Koodak"(w) "Terafik"(w),  "Noto Color Emoji"(w)
 slant: 0  0(i)(s),  0(i)(w)
 weight: 0  80(f)(s),  80(i)(w)
 width: 0  100(i)(s),  100(i)(w)
 pixelsize: 93000  16(f)(s),  109(f)(w)
 antialias: 1000  True(w),  False(w)
 lang: 0  "und-zsye"(w) "en-us"(s) "en"(w),  und-zsye(w)
 fontversion: 2.14735e+12  2147483647(i)(s),  132186(i)(w)
 decorative: 0  False(s),  False(w)
 color: 0  True(w),  True(w)
 symbol: 0  False(s),  False(w)
Score 0 0 0 0 0 0 1 0 0 1012 0 0 0 0 93000 0 0 0 0 0 1000 0 0 2.14735e+12

@jtojnar
Copy link
Contributor Author

jtojnar commented Aug 29, 2019

Confirmed it works with #67701

@jtojnar
Copy link
Contributor Author

jtojnar commented Aug 29, 2019

@GrahamcOfBorg test fontconfig-default-fonts

@jtojnar
Copy link
Contributor Author

jtojnar commented Aug 29, 2019

Yay, we still need #67529 or tests will fail.

@worldofpeace
Copy link
Contributor

Got a good consensus on #67529 during office-hours today.
Gonna check the test, maybe see if there's any opinions on the same thing. But I think we're good, I'll test the minimal image just to see there's no size jump.

@worldofpeace
Copy link
Contributor

@GrahamcOfBorg test fontconfig-default-fonts

@worldofpeace
Copy link
Contributor

So downloading the latest unstable minimal image

Firefox said 536 MB.

I built the image on this branch and used du

du --human-readable nixos-minimal-19.09pre130979.gfedcba-x86_64-linux.iso 
537M	nixos-minimal-19.09pre130979.gfedcba-x86_64-linux.iso

Seems fine, think that's the correct check to be doing.

@worldofpeace
Copy link
Contributor

Release note looks like
Screenshot from 2019-08-30 20 36 31

jtojnar and others added 4 commits September 1, 2019 00:09
In fontconfig’s 60-generic.conf, order of preference is estabilished for emoji
font family. Because fontconfig parses the config files in lexicographic order,
appending each <prefer> from <alias> element to the family’s prefer list
(to be prepended before the family) [1], our font family defaults stored
in 52-nixos-default-fonts.conf will take precedence. That is, of course, unless
the default „weak“ binding [2] is used. Emoji family binds strongly [3],
so we need to set binding to “same” for our <alias>es to be considered before
the ones from 60-generic.conf.

By default, we will set the option to all emoji fonts supported by fontconfig,
so that emoji works for user if they have at least one emoji font installed.
If they have multiple emoji fonts installed, we will use the fontconfig’s
order of preference [4].

[1]: bohoomil/fontconfig-ultimate#51 (comment)
[2]: https://www.freedesktop.org/software/fontconfig/fontconfig-user.html#AEN25
[3]: https://gitlab.freedesktop.org/fontconfig/fontconfig/commit/cc8442dec85e9d416436d19eeae1783f2d3008f0
[4]: https://gitlab.freedesktop.org/fontconfig/fontconfig/commit/c41c9220181b203d1cf1f6435f6e3735cb7c84ac
Make sure the fonts.enableDefaultFonts option works.
These days, emoji are ubiqitous so we need to add emoji font.
@worldofpeace
Copy link
Contributor

Rebase as the release notes are quickly getting conflicts.

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

Successfully merging this pull request may close these issues.

None yet

3 participants