Skip to content

Instantly share code, notes, and snippets.

@DeeDeeG
Created January 31, 2017 08:23
Show Gist options
  • Save DeeDeeG/d562a997ba8e79fad165c7d01cbdd22f to your computer and use it in GitHub Desktop.
Save DeeDeeG/d562a997ba8e79fad165c7d01cbdd22f to your computer and use it in GitHub Desktop.
Due to my fontconfig setup, Noto Color Emoji is literally the last fallback for Segoe UI Emoji
mint@mint-Inspiron-518 ~ $ fc-match -s "Segoe UI Emoji"
DejaVuSans.ttf: "DejaVu Sans" "Book"
DejaVuSans-Bold.ttf: "DejaVu Sans" "Bold"
DejaVuSans-Oblique.ttf: "DejaVu Sans" "Oblique"
DejaVuSans-BoldOblique.ttf: "DejaVu Sans" "Bold Oblique"
n019003l.pfb: "Nimbus Sans L" "Regular"
Waree.ttf: "Waree" "Regular"
Laksaman.ttf: "Laksaman" "Regular"
Meera.ttf: "Meera" "Regular"
KhmerOS.ttf: "Khmer OS" "Regular"
MuktiNarrow.ttf: "Mukti Narrow" "Regular"
padmaa-Medium-0.5.ttf: "padmaa" "regular"
padmaa.ttf: "padmaa" "Normal"
padmaa-Bold.1.1.ttf: "padmaa-Bold.1.1" "Bold.1.1"
NanumGothic.ttf: "NanumGothic" "Regular"
Lohit-Bengali.ttf: "Lohit Bengali" "Regular"
Lohit-Gujarati.ttf: "Lohit Gujarati" "Regular"
Lohit-Punjabi.ttf: "Lohit Punjabi" "Regular"
Lohit-Tamil.ttf: "Lohit Tamil" "Regular"
Lohit-Kannada.ttf: "Lohit Kannada" "Regular"
Lohit-Telugu.ttf: "Lohit Telugu" "Regular"
Lohit-Oriya.ttf: "Lohit Oriya" "Regular"
lklug.ttf: "LKLUG" "Regular"
wqy-microhei.ttc: "WenQuanYi Micro Hei" "Regular"
FreeSans.ttf: "FreeSans" "Regular"
FreeMono.ttf: "FreeMono" "Regular"
FreeSerif.ttf: "FreeSerif" "Regular"
opens___.ttf: "OpenSymbol" "Regular"
Norasi.ttf: "Norasi" "Regular"
KacstOne.ttf: "KacstOne" "Regular"
fonts-japanese-gothic.ttf: "TakaoPGothic" "Regular"
Purisa.ttf: "Purisa" "Regular"
MathJax_AMS-Regular.otf: "MathJax_AMS" "Regular"
MathJax_Fraktur-Regular.otf: "MathJax_Fraktur" "Regular"
MathJax_Main-Regular.otf: "MathJax_Main" "Regular"
MathJax_Size1-Regular.otf: "MathJax_Size1" "Regular"
MathJax_Size4-Regular.otf: "MathJax_Size4" "Regular"
MathJax_Typewriter-Regular.otf: "MathJax_Typewriter" "Regular"
MathJax_WinChrome-Regular.otf: "MathJax_WinChrome" "Regular"
MathJax_WinIE6-Regular.otf: "MathJax_WinIE6" "Regular"
Padauk-book.ttf: "Padauk Book" "Regular"
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
DejaVuSerif.ttf: "DejaVu Serif" "Book"
Sawasdee.ttf: "Sawasdee" "Regular"
NanumMyeongjo.ttf: "NanumMyeongjo" "Regular"
TibetanMachineUni.ttf: "Tibetan Machine Uni" "Regular"
AbyssinicaSIL-R.ttf: "Abyssinica SIL" "Regular"
Pothana2000.ttf: "Pothana2000" "Regular"
chandas1-2.ttf: "Chandas" "Regular"
Pagul.ttf: "Pagul" "Regular"
NotoSansSymbols-Regular.ttf: "Noto Sans Symbols" "Regular"
NotoSans-Regular.ttf: "Noto Sans" "Regular"
NotoNaskhArabic-Regular.ttf: "Noto Naskh Arabic" "Regular"
NotoSansDevanagari-Regular.ttf: "Noto Sans Devanagari" "Regular"
NotoSansBatak-Regular.ttf: "Noto Sans Batak" "Regular"
NotoSansBuginese-Regular.ttf: "Noto Sans Buginese" "Regular"
NotoSansCarian-Regular.ttf: "Noto Sans Carian" "Regular"
NotoSansCuneiform-Regular.ttf: "Noto Sans Cuneiform" "Regular"
NotoSansJavanese-Regular.ttf: "Noto Sans Javanese" "Regular"
NotoSansKaithi-Regular.ttf: "Noto Sans Kaithi" "Regular"
NotoSansLimbu-Regular.ttf: "Noto Sans Limbu" "Regular"
NotoSansNewTaiLue-Regular.ttf: "Noto Sans New Tai Lue" "Regular"
NotoSansRejang-Regular.ttf: "Noto Sans Rejang" "Regular"
NotoSansSundanese-Regular.ttf: "Noto Sans Sundanese" "Regular"
NotoSansTifinagh-Regular.ttf: "Noto Sans Tifinagh" "Regular"
NotoSansAvestan-Regular.ttf: "Noto Sans Avestan" "Regular"
NotoSansEgyptianHieroglyphs-Regular.ttf: "Noto Sans Egyptian Hieroglyphs" "Regular"
NotoSansGlagolitic-Regular.ttf: "Noto Sans Glagolitic" "Regular"
NotoSansLinearB-Regular.ttf: "Noto Sans Linear B" "Regular"
NotoSansLycian-Regular.ttf: "Noto Sans Lycian" "Regular"
NotoSansMeeteiMayek-Regular.ttf: "Noto Sans Meetei Mayek" "Regular"
NotoSansMongolian-Regular.ttf: "Noto Sans Mongolian" "Regular"
NotoSansSylotiNagri-Regular.ttf: "Noto Sans Syloti Nagri" "Regular"
NotoSansTagbanwa-Regular.ttf: "Noto Sans Tagbanwa" "Regular"
NotoSansTaiTham-Regular.ttf: "Noto Sans Tai Tham" "Regular"
NotoSansBalinese-Regular.ttf: "Noto Sans Balinese" "Regular"
NotoSansBamum-Regular.ttf: "Noto Sans Bamum" "Regular"
NotoSansBrahmi-Regular.ttf: "Noto Sans Brahmi" "Regular"
NotoSansBuhid-Regular.ttf: "Noto Sans Buhid" "Regular"
NotoSansCoptic-Regular.ttf: "Noto Sans Coptic" "Regular"
NotoSansCypriot-Regular.ttf: "Noto Sans Cypriot" "Regular"
NotoSansImperialAramaic-Regular.ttf: "Noto Sans Imperial Aramaic" "Regular"
NotoSansInscriptionalParthian-Regular.ttf: "Noto Sans Inscriptional Parthian" "Regular"
NotoSansKharoshthi-Regular.ttf: "Noto Sans Kharoshthi" "Regular"
NotoSansLepcha-Regular.ttf: "Noto Sans Lepcha" "Regular"
NotoSansLydian-Regular.ttf: "Noto Sans Lydian" "Regular"
NotoSansOlChiki-Regular.ttf: "Noto Sans Ol Chiki" "Regular"
NotoSansOldSouthArabian-Regular.ttf: "Noto Sans Old South Arabian" "Regular"
NotoSansPhagsPa-Regular.ttf: "Noto Sans Phags Pa" "Regular"
NotoSansSamaritan-Regular.ttf: "Noto Sans Samaritan" "Regular"
NotoSansShavian-Regular.ttf: "Noto Sans Shavian" "Regular"
NotoSansSyriacEastern-Regular.ttf: "Noto Sans Syriac Eastern" "Regular"
NotoSansTagalog-Regular.ttf: "Noto Sans Tagalog" "Regular"
NotoSansTaiViet-Regular.ttf: "Noto Sans Tai Viet" "Regular"
NotoNastaliqUrdu-Regular.ttf: "Noto Nastaliq Urdu" "Regular"
NotoSansDeseret-Regular.ttf: "Noto Sans Deseret" "Regular"
NotoSansInscriptionalPahlavi-Regular.ttf: "Noto Sans Inscriptional Pahlavi" "Regular"
NotoSansLao-Regular.ttf: "Noto Sans Lao" "Regular"
NotoSansMandaic-Regular.ttf: "Noto Sans Mandaic" "Regular"
NotoSansNKo-Regular.ttf: "Noto Sans NKo" "Regular"
NotoSansOldTurkic-Regular.ttf: "Noto Sans Old Turkic" "Regular"
NotoSansYi-Regular.ttf: "Noto Sans Yi" "Regular"
NotoSansCham-Regular.ttf: "Noto Sans Cham" "Regular"
NotoSansTibetan-Regular.ttf: "Noto Sans Tibetan" "Regular"
NotoSansCJK-Regular.ttc: "Noto Sans CJK JP" "Regular"
NanumBarunGothic.ttf: "NanumBarunGothic" "Regular"
NotoSerifBengali-Regular.ttf: "Noto Serif Bengali" "Regular"
NotoSerifKannada-Regular.ttf: "Noto Serif Kannada" "Regular"
NotoSerifMalayalam-Regular.ttf: "Noto Serif Malayalam" "Regular"
Ubuntu-C.ttf: "Ubuntu Condensed" "Regular"
Ubuntu-R.ttf: "Ubuntu" "Regular"
s050000l.pfb: "Standard Symbols L" "Regular"
Symbola_hint.ttf: "Symbola" "Regular"
Samyak-Devanagari.ttf: "Samyak Devanagari" "Regular"
LiberationSans-Italic.ttf: "Liberation Sans" "Italic"
NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"
@averissimo
Copy link

I got it in #2

image

.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>
      <!--<string>Twitter Color Emoji</string>-->
    </edit> 
  </match> 
</fontconfig>

@DeeDeeG
Copy link
Author

DeeDeeG commented Jan 31, 2017

The only ideas I have to fix this come from reading https://github.com/eosrei/emojione-color-font and the fontconfig file he uses.

  • You might be able to try "mode=prepend_first" rather than "mode=prepend".

  • Or you might be able to prepend Bitsream Vera before Noto Color Emoji, because Bistream Vera has none of the black and white emojis... and it may ensure no black and white emojis show up, by bumping DejaVu Sans out of first place.

  • You can add a number to the beginning of your .conf's filename, which gives the file a priority of some kind, relative to other .conf files on the system. (Is it 1 - 100? Is 1 highest proprity, or is 100 highest priority? I don't know the details. He uses 56, as in "56-[sometext].conf")

  • Lastly, although I'm not sure if any of these suggestions work, two related suggestions: You could place the noto font in [your-home-dir]/.local/share/fonts/[noto-font-file-here]

  • And you can place the fontconfig file in [your-home-dir]/.config/fontconfig/conf.d/[your-.conf-file-here]

(Last two suggestions are from his install script.)

If you end up using any of these suggestions maybe he should get credit in your license.md or readme.md, but I leave that to you to decide.

@polarathene
Copy link

You might be able to try "mode=prepend_first" rather than "mode=prepend".

I would not advise prepend_first for an emoji font. It will mess up text if it is the primary font applied. You want a regular font to supply the usual normal text glyphs, and fallback to emoji. There are various ways to do this, and some have used prepend_first in combination with a regular font like Bitstream Vera so that two fonts are placed at the start of the font list being generated. So long as no other third-party config is trying the same approach, you shouldn't have to be concerned about any races for priority and this will probably work fine...but afaik it would likely also equate to enforcing that font over any other, which might not be desirable?(I have not confirmed if that happens but I think it does).

Is it 1 - 100? Is 1 highest proprity, or is 100 highest priority? I don't know the details.

They actually have designated purposes for the different stages of building a font list, as mentioned here. Unfortunately that's not always reliable when third-party fonts are involved with their own configs that treat it as priority alone(which technically works, but can result in confusion with interactions from other configs/rules timing).

00 is the lowest and will be run first, followed by 99 at the end as last. 50 should have a 50-user.conf file which will load user config, which can be a single config file or it's own conf.d(which afaik is more like a priority in the sense that I believe these all load from that halfway point, and when finished will resume the remainder of system configs from 50, I've not verified that). The one notable case where 50 is a bit too late, is due to 49-sansserif.conf which will assign any font query to sans-serif generic family if it has not received a generic family prior. A solution for this and description of the problem is mentioned here about Source Code Pro, it's probably not going to be an issue for emoji.

Lastly, although I'm not sure if any of these suggestions work

$HOME/.config/fontconfig/conf.d and $HOME/.config/fontconfig/fonts.conf, or their XDG equivalent paths, are defined in /etc/fonts/conf.d/50-user.conf, these are the official locations. The local one I'm not familiar with, perhaps its outdated/deprecated or distro specific.


Anyone else that comes across this, I've provided some more details about fontconfig and Chrome behaviour here.

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