Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering Emojis with plugins #169

Open
scd31 opened this issue Sep 19, 2024 · 4 comments
Open

Rendering Emojis with plugins #169

scd31 opened this issue Sep 19, 2024 · 4 comments

Comments

@scd31
Copy link

scd31 commented Sep 19, 2024

I'm interested in implementing a plugin which can render emojis. Not all of them, but a few common ones. I wanted to know - is this possible, and are plugins the correct tool for the job?

Thanks!

@bugadani
Copy link
Member

I don't really remember the details, but it shouldn't be impossible. To make it work, you need a font that has the symbols, or a TextRenderer implementation that does the actual drawing. Then, I think you need to implement Plugin::next_token that recognises the emojis you want to render, and maps them to the correct emoji characters in your font.

@scd31
Copy link
Author

scd31 commented Sep 22, 2024

I see, thanks. In that case, can I just do all the logic in the custom TextRenderer - no custom plugin required?

@bugadani
Copy link
Member

It depends on embedded-text, and I don't know if it breaks up :) and such into multiple tokens. If it does, you'll need a plugin to re-merge the emojis before passing to a text renderer (otherwise it'd see a : in one call, and ) in another).

@scd31
Copy link
Author

scd31 commented Sep 23, 2024

I was actually thinking of emojis like 😄 but I suppose there'd still need to be merging for multi-character emojis, like country flags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants