emilk / egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native
https://www.egui.rs/
Apache License 2.0
21.69k stars 1.56k forks source link

Color Emoji support #2551

Open mikedilger opened 1 year ago

mikedilger commented 1 year ago

Lack of full color emoji support makes egui a poor fit for a chat program

I'm developing a nostr client in which, like chat or twitter, people use emojis often. I'm trying to decide whether to change GUIs or whether egui might step up to this challenge. Funding may be available.

This issue is tightly related to font rendering, which there are other open issues for. Depending on the solution to those issues, this issue may also resolve. But I'm listing it explicitly because it might not. Many font rendering libraries do not handle the several font tables needed for color emoji support.

Describe the solution you'd like

I'd like color emoji support.

I'd also like font hinting (the fonts look blurry to me, including in your screenshots so it's not an issue on my side), although it occurs to me that font hinting behaves differently depending on where the pixels line up and pre-rendering to a texture couldn't know where they will line up... but maybe I misunderstand. Nonetheless I didn't include it as I'm not sure it's possible in egui.

I personally don't care if non-rust libraries are involved, but I understand that egui wishes to avoid that.

cosmic-text uses swash IIRC for rasterization and rustybuzz for layout. Swash is probably the upstream solution for rasterization as far as I can tell (not all of cosmic-text is applicable). According to my tests, cosmic-text isn't alpha blending right (partial pixels of one character overwrite partial pixels of previous characters).

Describe alternatives you've considered

I tried seeing if I was bright enough to implement this myself but I got quite bogged down in parts I still don't understand.

I've considered switching to iced gui or imgui.

Additional context

If color emojis are listed first as a FontFamily, layout breaks pretty badly.

jb55 commented 7 months ago

@mikedilger you make any progress on this? I am also interested for damus notedeck. maybe we can get a bounty going from the nostr fund.

mikedilger commented 7 months ago

I haven't looked into this since, so more than a year. I'm still living with B/W emojis. Once I finish my relay, maybe I'll have time to dig into this.