mirror of
https://github.com/bevyengine/bevy.git
synced 2026-05-06 06:06:42 -04:00
61042b10f0
# Objective IME support during text input is extremely important for non-Latin languages: notably the CJK family (Chinese, Japanese, Korean). It would be very nice to support it in our initial release! Fixes #23795. ## Solution 1. Peek at the `input/text_input` example that @mockersf made and I forgot about. 2. Steal its strategy and wire up the IME events to Bevy's proper text input widgets. 3. Delete the now-obsolete example. 4. Add underlines to tentative characters (exposed by parley :D) so then users can distinguish what they're typing from what they have typed. 5. Rename `editable_text` to the nicer `text_input`. 6. Create a dedicated example for `ime_support`, which uses system fonts. 7. Add an `error_once!` to fix a footgun I tripped on when using system fonts... Per @mockersf's complaints, I've opted not to ship any new fonts in this PR: the system fonts actually worked great! ## Testing I've setup IME support on Windows, and added a small font with Japanese support to the `editable_text` example. It works quite well! We can even submit the values! Known issues: - when entering Japanese characters, the console is spammed with "ICU4X data error: No segmentation model found for language: ja". I have no idea where this is coming from: I think a system dependency is causing this, and it's bubbled up by `parley`? IDK. Doesn't happen with Latin characters, and it renders fine so... -~~tab selecting the IME suggestion causes the selected text entry box to change. I wasn't sure how we want to fix that, so Ieft it for now.~~ EDIT: fixed! ## Showcase <img width="470" height="233" alt="image" src="https://github.com/user-attachments/assets/8f8721b3-6746-46d5-8a20-40de634f52e5" /> --------- Co-authored-by: ickshonpe <david.curthoys@googlemail.com>