kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.84k stars 996 forks source link

Emojis on the terminal #73

Closed thorerik closed 7 years ago

thorerik commented 7 years ago

Might be way out of scope for the project, so feel free to close this issue.

I got a small curveball for a lot of terminal emulators: my mac has a user named 🐈 and hostname 😇.

Most terminals are able to at least somewhat deal with it: image

In Kitty however, it turns into some odd things: image

this might be somewhat related to #50 as far as my understanding goes.

kovidgoyal commented 7 years ago

Emoji's (techincally all unicode single character glyphs) render fine in kitty, provided two things:

1) The system wcwidth() is new enough to return the character cell width for the emojis 2) The font you have specified for kitty support emojis, or you specify a different font in the config for the emoji unicode range. While kitty does use fallback fonts when the specified font does not have glyphs for a character, it is best to explicitly use the font you like for emojis rather than relying on the fallback mechanism, which is fairly opaque.

The only caveat is that currently color fonts are not supported. Looking at your screenshot, that does not look like an emoji problem but more a character encoding problem.

For exampl, in kitty on my system: screenshot_20170508_080615

So what version of kitty and what operating system is this?

kovidgoyal commented 7 years ago

And just for completeness here is what both those emoji's pluss some surrounding text look like:

screenshot_20170508_080944

As you can see, they are rendered perfectly, with no cutoff parts, in exactly one character cell, because wcwidth() on my system returns one for them. Using

kitty -o use_system_wcwidth=no

which tells kitty to use its internal modern wcwidth(), it look like:

screenshot_20170508_081227

which shows perfectly render two character emoji's with no artifacts whatsoever.

This is on a linux (Arch system).

kovidgoyal commented 7 years ago

Closing, no followup

dkasak commented 7 years ago

Is support for colour fonts planned in the future?

kovidgoyal commented 7 years ago

It's not on my TODO list. It will be somewhat awkward because the rendering sytem in kitty assumes text is in the form of 8bpp alpha masks. You'd probably have to create a separate texture array on the GPU to store colored characters and put in a conditional into the shader to use that store. I generally try to avoid conditionals in shaders as they are often performance bottlenecks. And then there is the limitation that the cell structure in kitty only allows at most two combining unicode marks. Choosing shades requires upto 5. So you'd have to add at least another 12 bytes to the size of the cell structure. All this decreases performance in the general case for what is a not very compelling feature, IMO.

Still I am not adamantly opposed. If someone were to come up with a patch and show that its impact on performance is minimal, I would be willing to merge.

kovidgoyal commented 6 years ago

Well I decided to implement color emoji. With some work I could get the performance impact to be mimimal and I just decided to ignore the shades. Implementation is in the color branch.

spacekookie commented 6 years ago

@kovidgoyal Has there been any development on this? Any way people can help out? Gotta have my coloured twitter emoji :heart: in my hostname :grimacing:

maximbaz commented 6 years ago

Works for me:

image

spacekookie commented 6 years ago

@maximbaz Hmm, with what version is that? And if I'm already on the right version, I guess I have my fonts not setup correctly? I have emoji installed on my system (Arch Linux) but I'm not sure what else I have to do (like specify a font for the range?)

Also, what emoji set is that? :grimacing:

maximbaz commented 6 years ago

kitty is of version 0.11.1 as you can see on the screenshot 😉 The emoji set is EmojiOne, since you are on Arch, you can use my AUR package ttf-emojione — in addition to installing the font files it will also add the proper fontconfig. I don't have any other configuration on my system besides what I put in that AUR package.

spacekookie commented 6 years ago

@maximbaz Ah, thanks, that kitty version in the picture was being overshadowed by the unicorn :sweat_smile: :joy:

I got it to work now, although I'm now having some other (unrelated) issues, to do with how my shell (fish) handles emoji width

esn89 commented 5 years ago

@maximbaz

Did you just have to install that font in Arch and that's it? Or do you need to do some settings in kitty.conf?

maximbaz commented 5 years ago

Install font and configure fontconfig, the Arch package comes with the config 75-emojione.conf, so all you need to do is to run

ln -sf ../conf.avail/75-emojione.conf /etc/fonts/conf.d/75-emojione.conf

No changes to kitty.conf after that, having fontconfig makes emoji appear properly in all apps.

merlinND commented 5 years ago

Just a quick note that on Ubuntu 18.10, emojis displayed correctly in Kitty after installing the emojione package:

sudo apt install fonts-emojione
insidewhy commented 5 years ago

ttf-joypixels replaces ttf-emojione on arch for anyone looking.

Cassianokunsch commented 5 years ago

Anybody can help me, i have deepin terminal, but the emoji don't get color look... Captura de Tela_Área de Seleção_20190725130829

Luflosi commented 5 years ago

kitty has nothing to do with the deepin terminal. If you want to report an issue for the deepin terminal, you should do that in the repo https://github.com/linuxdeepin/deepin-terminal since their bug tracker https://bugzilla.deepin.io/describecomponents.cgi?product=深度终端 seems to be unreachable.

amishbni commented 4 years ago

On Arch, installing ttf-twemoji worked for me.

abluedot commented 3 years ago

The new font-package on AUR is now ttf-joypixels which replaced ttf-emojione.

It works well and looks great with Kitty. Thanks. Finally emojis in emacs without a hassle! 📣