How to native text with emoji on Solar 2D?

I want to show a native text with emoji from input keyboard. Please help me!

I struggled mightily trying to add emoji support to a chat feature I have in my game. My problems were mainly centered around older versions of Android but I did eventually get it working. You will need to familiarize yourself with Unicode just a bit.

It is a little hard to follow but here is the post I used to try and figure out my issue. Maybe it will shed some light on how to use multibyte characters such as emojis in a text field.

Hope this helps,
Scott

1 Like

FYI, I found the Coronalabs UTF8 plugin to work fine on all platforms, even the older versions of Android:

["plugin.utf8"] = { publisherId = "com.coronalabs" } --from build.settings

1 Like

Thanks for reply. I want to ask one more question: how to show text with emoji on my app. I used display.newtext but it was colored differently, not the original emoji

Hi @Trung_Kien_Tran - display.newtext is only for display on-screen in the app; it uses a font to draw what we see as text. I don’t think that’s what you need. Does your app already text to others? If so, how are you doing it?

1 Like

This is my game. I use display.newText which only shows single color, not one full color for emoji. Please suggest me a solution. Many thanks for your help

I’m pretty sure, 99%, that display.newText will not display emojis using the right UTF8 code. If the issue isn’t how you are sending the icons, then perhaps you’ll have to keep images of all the emojis and display them yourself manually using display.newImage or display.newImageRect

How to show text with emoji on app code by Solar 2D. Please help me!

As far as I know, you’ll have to create your own library of the emoji images and create your own custom routine (i.e. displayNewTextWithEmojis).

The issue is that Solar2D renders all fonts using a single color. The emojis do work, as you can see below, but they are just one colour plus negative space.

emoji

If you’ve looked around, you know that most platforms have their own versions of the same emoji. In a similar fashion, probably the best way to get emojis to your projects is to use bitmap fonts. With bitmap fonts, every character/symbol is an image, so you have total control over how they render.

1 Like