Text and emojis

I have a couple of observations from my recent tinkering with text and emojis.

  1. My game involves lots of moving text or emojis and I was noticing quite a bit of stuttering. The average framerate wasn’t too bad (mid 50s) but it was very clear that within this there were some marked slowdowns. I experimented with instead creating sprite sheets of the text or emojis I need and drawing them with meshes. This creates a MUCH smoother framerate. So I can only assume the mesh engine is more efficient than the text engine, at least when creating lots of individual letters or emojis. This surprised me, but I thought it might be useful.

  2. Even though there’s an emoji font, emojis work just fine if you’re using any other font too. Again, a surprise to me. Does anyone know the purpose of the emoji font?

@epicurus101 pre-rendering text is definitely the way to go. The text() function will cache text so it doesn’t have to re-render it, but that only goes so far.

I believe it just switches to the emoji font when it needs to render those unicode symbols, so there probably isn’t any need for an explicit emoji font.

Thanks @Simeon. set context made my life so much easier once I got the hang of it!

Is there an easy way for Codea to identify if a single character is an emoji or ordinary character? When generating my sprite sheets I need one to be fill white and the other black. Am I going to have to manually tell Codea when I’m feeding it emojis vs text?

@epicurus101 I don’t have a solution to detect emoji off the top of my head, the next version of Codea may make it easier or possible to do so.

You can detect emoji by the fact that they are stored as multibyte characters rather than as single bytes.

If you search through my font example code there is a demo of this - I was able to encode emoji’s so that I could edit the code in Aircode and not have the emoji characters get messed up.

You can also look at this example as well


@TechDojo superb knowledge! What an easy test. I missed that emoji thread first time round but am tucking in now