godot icon indicating copy to clipboard operation
godot copied to clipboard

[FreeType] Add Apple EMJC emoji font support (for iOS built-in emoji font).

Open bruvzg opened this issue 2 years ago β€’ 1 comments

Fixes https://github.com/godotengine/godot/issues/77914

Adds support for EMJC bitmaps to the FreeType, not a high-priority, so I'll extensively test it after 3.1 release and probably make an upstream PR. I have not found any documentation for the bitmap format, so implementation is based on this decoder - https://github.com/PoomSmart/EmojiFonts/blob/main/emjc.py + some format info - https://qiita.com/496_/items/80cfc03ad2ed26c2ab52

Upstream issue - https://gitlab.freedesktop.org/freetype/freetype/-/issues/1051

bruvzg avatar Jun 07 '23 11:06 bruvzg

would be really great to shoot for this in 4.4. emojis on ios are huge for mobile dev.

jbromberg avatar Aug 16 '24 22:08 jbromberg

any update on this? That would be awesome to properly support iOS system emojis on Godot 😊

SebMenozzi avatar Dec 10 '24 03:12 SebMenozzi

May I request at least a rebase of this PR? That way I can do a custom build and try it out. This would be a much appreciated enhancement.

Koyper avatar May 22 '25 19:05 Koyper

Rebased and tested on iOS 18.4.1, seems to be working, but will require the same hack as in https://github.com/godotengine/godot/pull/106666 to have correct baseline.

bruvzg avatar May 22 '25 20:05 bruvzg

Rebased and tested on iOS 18.4.1, seems to be working, but will require the same hack as in #106666 to have correct baseline.

Thank you! Will the #106666 hack work as is, or is there a different symbol for iOS than MACOS_ENABLED? Also, is the iOS emoji font name also ".Apple Color Emoji UI"?

Koyper avatar May 22 '25 23:05 Koyper

Tested and works on iOS 18.4.1. The modification I suggested for #106666 seems to work for iOS and baseline position looks correct.

Koyper avatar May 23 '25 18:05 Koyper

Working on iOS 18.5, except for an issue where TextServer.shaped_text_prev_character_pos() via TextEdit.get_previous_composite_character_column() seems to be returning an incorrect character length for certain composite characters (emoji). The obvious behavior is if you enter some emoji and then backspace, more than one emoji will all be deleted at once.

For example, these three emoji πŸ™πŸ’ͺβ›³ all return a length of 2 on iOS if TextEdit.get_previous_composite_character_column() is called with the caret set at the end of the character, but return a length of 1 on MacOS.

Only some emoji exhibit the wrong-length behavior, for example, πŸŽπŸ›ΈπŸš’ all show a length of 1, however, the backspacing across multiple characters issue still happens.

Attached is a MRP you can run on iOS and MacOS/Win that will show the character length of emoji as they are added to the TextEdit field, and you can experiment with backspacing. You'll have to set up your own provisioning profile to export for iOS.

iOS: Screenshot 2025-08-03 at 5 19 47β€―PM

MacOS: Screenshot 2025-08-03 at 5 31 10β€―PM

MRP: ios-get-previous-composite-character-column-issue-mrp.zip

Koyper avatar Aug 03 '25 22:08 Koyper