Emoji glyphs in pure C?

,

Hi All,

Is there any way to get the Emoji glyphs for A, B, D-Pad, etc. working with C? I tried to use a wchar_t and using the k16BitLEEncoding but it didn't do the trick.

I haven't done this myself yet, the way I'm handling it is putting my emoji in regular ASCII code points

Thank you Alex, I might do that if I can't find a solution.

I tried with UTF8 and the code for circled A (i.e. Ⓐ, see reference) but still no glyph.

const char *msg = "\xE2\x93\x90"; 
pd->graphics->drawText(msg, strlen(msg), kUTF8Encoding, 0, 0);

What OS are you using? On macOS, it works if I use the character as-is in a const char*:

Using \x or \u should also work but you were not looking at the right glyph. The right one is: “Ⓐ” U+24B6 Circled Latin Capital Letter A Unicode Character

If you still can't see the character, check the font you are using. There are several circle A and not all fonts support the same. Sometimes the one to use is 🅐.

Edit: Just for information, the length argument of drawText is the number of characters to draw, not the number of bytes in the given buffer. Here it's OK because strlen always returns a value greater than the number of characters and drawText always stops when it encounter a \0 but you may be surprised if you try to display only part of a string as it may display more text than what you expected.

2 Likes

Thank you @Daeke! I was using the Asheville Bold font, that apparently is missing these Glyphs! Asheville Light works as expected.

2 Likes