phronmophobic / membrane.term

A terminal emulator in pure clojure
Eclipse Public License 1.0
53 stars 1 forks source link

WIP: Consider supporting emoji characters #20

Open lread opened 2 years ago

lread commented 2 years ago

Opportunity

We chould have membrane.term support showing emoji characters. Not sure if this is worth it or interesting, but we could do it.

Current behavior

Let's run echo -e '\U0001f602' and compare the results:

From an membrane.term session (with #18 included): image

Same from an iTerm2 session: image

Analysis

My understanding is currently shallow here.

Here's vaguely what I'm starting to learn:

Next Steps

phronmophobic commented 2 years ago

Not all emoji are 2 cells. For example, any of the emojis that use the zero width joiner: https://tonsky.me/blog/emoji/#zero-width-joiner. If you try: 👩‍✈️. You can actually see some pretty funny results in Mac osx built in terminal.

emoji

It's currently possible to display emoji in membrane with the skia and java2d backends:

;; (require '[membrane.java2d :as backend])
(require '[membrane.skia :as backend])

(backend/run
  (constantly
   (ui/label "👍" (ui/font "Apple Color Emoji" 12))))

What's interesting is that it seems like you have to pick the emoji font based on the byte sequence and potentially combine several cells for a single emoji.

lread commented 2 years ago

Huh! Fascinating!