Fork me on GitHub
#membrane
<
2023-02-18
>
genekim18:02:51

@smith.adriane Thanks for all your amazing help yesterday — quick question: is there a way to display unicode/emojis, ideally in ui/label? (Using the skia backend, as you had recommended. for those looking to do something similar.) Was trying to render “🛋️ moving”, but got what’s displayed below.

phronmophobic18:02:30

yes, there's 2 options. 1. You can use the new stuff in membrane.skia.paragraph , https://phronmophobic.github.io/membrane/styled-text/index.html. 2. You can specify an emoji font specifically.

(ui/label "🛋️"
          (ui/font "Apple Color Emoji" nil))
Unfortunately, ui/label only accepts one font at at time, so you would need to layout multiple labels if you want to mix regular text and emoji.

phronmophobic18:02:14

I don't think you need to do anything special to use the first approach. Just require the paragraph namespace and replace ui/label with para/paragraph

(require '[membrane.skia.paragraph :as para])

(para/paragraph "🛋️")

phronmophobic18:02:40

actually, you might need to update your skialib dependency to the following:

com.phronemophobic.membrane/skialib-macosx-aarch64 {:mvn/version "0.11.1-beta"}

genekim18:02:06

Woot! It worked! Thx! Is there any way to get the paragraphs with emojis and those without emojis to line up? (Holy cow, it doesn’t take long to start running into all these complications! 😂

phronmophobic18:02:40

I can look into that. Is the latest code pushed to your github repo?

genekim19:02:52

Yes! https://github.com/realgenekim/simulator-couch-paint/blob/e6a50c3f444b34708dc3d1a04b153a6b914a7471/src/ui/membrane_ui.clj#L182 🙏 (I was just telling my mentor from MIT Sloan yesterday how difficult emojis and unicode are — I think I may have said, “luckily, I never have to deal with it.” Was thinking mostly MySQL, not UIs. 🙂

😆 2
phronmophobic19:02:32

Here's one approach.

phronmophobic19:02:31

I'm not sure why the couch is huge, but if you make the couch smaller (ie. adjust the font size), then it won't screw up the baseline.

genekim19:02:17

Hahaha! That’s hilarious! OMG, all these complications that emojis create — so different that ASCII. THANK YOU! Will try this in just a second.

phronmophobic19:02:20

weird, if you just type the couch emoji in slack, it's huge. But, if you type the emoji and add more text it shrinks again? Maybe the slack text input already does that for you?

genekim19:02:39

Can you post a screenshot of what you see on your screen?

phronmophobic19:02:00

of the couch sim or slack?

genekim19:02:11

Of the sim —

genekim19:02:19

(Trying to confirm what I see matches yours.)

genekim19:02:17

WOOT! (I forgot to refresh — now mine matches yours.). Awesome! (I merged changes in. You may have to restart, because I added logging to get output under control. 🙂

genekim19:02:17

I’ll keep you posted — starting to add buttons, to make app window the main way you setup, run sim, select schedulers, etc. 🎉 Still very fun!!!

🎉 2
phronmophobic19:02:58

I'm gonna go eat some lunch, but if you would be interested in pairing and going over some of the membrane state management, I would love to try to explain it to see if it makes sense.

genekim19:02:36

Yes! Could we shoot to do mid- to late-afternoon?

phronmophobic19:02:49

Yea, that works!

genekim20:02:13

Anytime after 3pm works for me! 🙏