membrane

genekim 2023-02-18T18:15:51.696359Z

@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.

phronmophobic 2023-02-18T18:23:30.225169Z

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.

phronmophobic 2023-02-18T18:25:14.117099Z

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 "πŸ›‹οΈ")

phronmophobic 2023-02-18T18:26:40.603039Z

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

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

genekim 2023-02-18T18:49:06.039349Z

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! πŸ˜‚

phronmophobic 2023-02-18T18:59:40.807339Z

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

genekim 2023-02-18T19:22:52.404449Z

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. πŸ™‚

πŸ˜† 1
phronmophobic 2023-02-18T19:49:26.319169Z

https://github.com/realgenekim/simulator-couch-paint/pull/2

phronmophobic 2023-02-18T19:49:32.811609Z

Here's one approach.

phronmophobic 2023-02-18T19:50:31.732169Z

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.

genekim 2023-02-18T19:51:17.200309Z

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

phronmophobic 2023-02-18T19:52:20.354049Z

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?

genekim 2023-02-18T19:52:39.565959Z

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

phronmophobic 2023-02-18T19:53:00.847519Z

of the couch sim or slack?

genekim 2023-02-18T19:53:11.365699Z

Of the sim β€”

genekim 2023-02-18T19:53:19.718479Z

(Trying to confirm what I see matches yours.)

phronmophobic 2023-02-18T19:53:52.688309Z

genekim 2023-02-18T19:55:17.834109Z

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. πŸ™‚

genekim 2023-02-18T19:56:17.261499Z

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!!!

πŸŽ‰ 1
phronmophobic 2023-02-18T19:58:58.926969Z

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.

genekim 2023-02-18T19:59:36.744579Z

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

phronmophobic 2023-02-18T19:59:49.827229Z

Yea, that works!

genekim 2023-02-18T20:00:13.196629Z

Anytime after 3pm works for me! πŸ™