lime icon indicating copy to clipboard operation
lime copied to clipboard

Fix Font.getGlyph(s) with emoji characters

Open tobil4sk opened this issue 9 months ago • 1 comments

The original code didn't work for emojis, but the stack overflow discussion since then includes a fix for this issue. See the comment:

https://stackoverflow.com/questions/2948308/how-do-i-read-utf-8-characters-via-a-pointer#comment72311507_2953960

Now readNextChar can extract the unicode value correctly, however, it still does not result in a correct glyph index being found.

tobil4sk avatar Mar 11 '25 10:03 tobil4sk

I was able to get it working properly by adding in FT_Select_Charmap((FT_Face)face, FT_ENCODING_UNICODE);. We already have some code to set the char map, so that probably needs to be updated or replaced: https://github.com/openfl/lime/blob/a9f72d65d906b6dec70f9237a9f6e85e6695bf83/project/src/text/Font.cpp#L402-L422

tobil4sk avatar Mar 18 '25 22:03 tobil4sk