Skip to content

Instantly share code, notes, and snippets.

@robotslave
Last active February 6, 2021 12:22
Show Gist options
  • Save robotslave/4633393 to your computer and use it in GitHub Desktop.
Save robotslave/4633393 to your computer and use it in GitHub Desktop.
How to get Emoji in your Ubuntu Terminal
<!--
1. Download the Android Jelly Bean fonts and the Symbola font:
https://www.dropbox.com/s/tvtzcnzkvbe0nrt/jelly-bean-fonts.zip
http://users.teilar.gr/~g1951d/Symbola707.zip
2. unzip the files and put AndroidEmoji.ttf and Symbola.ttf (and any of the other fonts that strike your fancy)
in your ~/.fonts/ directory
3. run `fc-cache -f`. You can check to make sure the new fonts
were installed with `fc-list`. You'll probably want to grep the copious output for Symbola or Emoji
4. Put this file in ~/.config/fontconfig/fonts.conf (>=12.10) or ~/.fonts.conf (<=12.04)
5. Close all terminal windows, restart terminal
6. In your terminal Profile Preferences, set your font to 'Monospace'
If you're not using ubuntu's default terminal (gnome-terminal) then figure
out how to set your terminal font to 'monospace'
If you don't like the Ubuntu Mono font, change it to whatever you prefer,
see comment in the file below
If you're going through various layers of ssh and tmux (don't use gnu screen) and such,
you'll need to make sure you've got your locale set up properly with an encoding of
UTF-8 at every link in the chain.
If you prefer Symbola to the Android Emoji glyphs, you can put that first in your config.
Symbola is used here to fill in some glyphs missing from the Android Emoji.
-->
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- Font families -->
<alias>
<family>serif</family>
<prefer>
<family>DejaVu Serif</family>
<family>Android Emoji</family>
<family>Symbola</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>DejaVu Sans</family>
<family>Android Emoji</family>
<family>Symbola</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Ubuntu Mono</family> <!-- change this to your prefered monospace font if you like -->
<family>DejaVu Sans Mono</family>
<family>Android Emoji</family> <!-- put the Symbola line before this if you prefer Symbola to Android Emoji -->
<family>Symbola</family>
</prefer>
</alias>
</fontconfig>
@liuyang1
Copy link

liuyang1 commented Nov 17, 2016

But how to verify it? just type :smile: in terminal? 😄

@dugagjin
Copy link

I did it but I only have black and white emojis? is this normal?

Copy link

ghost commented Aug 13, 2017

@shrx
Download

and place them in the /system/fonts/ folder.

You either need root access and root-explorer with system mount ability,
or Android Kitchen to create a custom-rom.

Next you need to edit /system/etc/fallback_fonts.xml, replacing:

    <family>
        <fileset>
            <file>AndroidEmoji.ttf</file>
        </fileset>
    </family>

with

    <family>
        <fileset>
            <file>NotoColorEmoji.ttf</file>
        </fileset>
    </family>
    <family>
        <fileset>
            <file>NotoEmoji-Regular.ttf</file>
        </fileset>
    </family>
    <family>
        <fileset>
            <file>NotoSansSymbols-Regular.ttf</file>
        </fileset>
    </family>
    <family>
        <fileset>
            <file>AndroidEmoji.ttf</file>
        </fileset>
    </family>

You don't have to delete the old entry (but you can if you want),
the xml works by trying to resolve missing glyphs,
so if a missing character-glyph is found "and answered" in NotoColorEmoji.ttf
it will stop and resolve there, without continuing beyond, for NotoEmoji-Regular.ttf,
NotoSansSymbols-Regular.ttf or AndroidEmoji.ttf.

I've added the symbols font under the text-version of the emoji,
and kept the old entry for maximum compatibility. :]

Repeat the process of adding NotoColorEmoji.ttf, NotoEmoji-Regular.ttf and NotoSansSymbols-Regular.ttf to /system/etc/fallback_fonts-ja.xml.

Save the xml file, probably a hard-reboot is needed.


Ps. If you're already messing with fonts, download the latest roboto-android.zip from github.com/google/roboto/releases/ and dump the zip content into /system/fonts/, most smartphone (unless yours if very old) already are using Roboto, so you don't need to change anything more.

Last thing,
If you do wish to configure an alternative font,
for example replacing DroidSans with Noto,
all you have to do is to copy the new font-file to /system/fonts/ and edit /system/etc/system_fonts.xml for the main font (NotoSans-Regular.ttf, Bold, Italic, etc..) and optionally a language specific version for /system/etc/fallback_fonts.xml (NotoSansHebrew-Regular.ttf).

@rain1024
Copy link

@eladkarako Is it possible to use emoji color in ubuntu terminal?

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