Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Input Method (IME)? #804

Open
real-zony opened this issue Nov 25, 2022 · 9 comments
Open

Support for Input Method (IME)? #804

real-zony opened this issue Nov 25, 2022 · 9 comments

Comments

@real-zony
Copy link

I am a MonoGame beginner and I would love to develop modules for blishhud, but blishhud doesn't seem to provide support for IME. (My friend and I are both Chinese client)

Can you give me some advice? My intuition tell me to start with TextInputBase.

Of course, I'm trying to implement it.

@dlamkins
Copy link
Member

Hello,

Yes, that would likely be the place to start. You may also need to play around with the keyboardmanager under the input service. I'm afraid I'm not familiar with the ins and outs of IME input and what hurdles there might be.

Feel free to join our Discord for more real-time discussions, if you wish. 👍

@real-zony
Copy link
Author

Thank you very much for your advice, so far I have some idea and am implementing it. 🤓
I have joined Discord.

@entrhopi
Copy link
Member

Hi!
I'm probably the guy with the most Blish keyboard madness on my record. 😊

Like @dlamkins I'm not very familiar with IME but I out of the top of my head I suggest looking at KeyboardHandler and TypedInputUtil. Those are probably the best candidates. I rewrote both of those substantially to support modifier keys at all.

If you need help just hit me up. Either here or on Discord. I'm trying to be more present again. This year has been crazy....

@real-zony
Copy link
Author

Hi @entrhopi ,I'm back. Could you give me some advice? I tried to enable IME support using the method of WindowsDXTests in IMEHelper, but unfortunately, it doesn't work. https://github.com/ryancheung/MonoGame.IMEHelper

@real-zony
Copy link
Author

I ran this test project alone and it worked well. I am a beginner in MonoGame/Windows development (I mainly work on web server), so I can only guess if Blish HUD intercepted the key events or if there is something special about Blish HUD's form?

@entrhopi
Copy link
Member

I think the main challenge is, that we need to use pretty low level access for keyboard input. This is because we need to catch some things even before they are passed to the game.
So all 'text' input fields are not native to whatever the operating system will use.

I'm currently on the road and can't test things, but here are some quick thoughts until I'm back on the weekends:

Pardon my unknowingness, but my understanding is, that you type a few letters and then there will probably be a selection for the right Chinese symbol?

My first intuition would be to test if you can copy and paste Chinese into Blish text input fields. If so, then your first post might be correct in the assumption that you probably need to extend the TextInputBase with a kind of autocomplete-popup routine and a library of the Chinese symbols.

@real-zony
Copy link
Author

real-zony commented Jun 14, 2023

Hi @entrhopi , thank you very much for your answer. Your guess is correct. The actual scenario is that after entering English letters, a candidate box will pop up to select the matching Chinese symbol. Currently, TextInput cannot display Chinese characters, and this issue is closely related to #423. Of course, I tested it myself and found that replacing BitmapFont with the font class provided by FontStashSharp can enable normal copy and paste of Chinese characters.
image

And @dlamkins do you have any suggestions on this? I believe that the change in font system will allow more regions' text to be displayed properly on Blish HUD. #866 #282

@dlamkins
Copy link
Member

We have plans to switch to FontStashSharp in the future, but it's a larger change that likely isn't coming soon because it comes with some breaking changes.

@real-zony
Copy link
Author

real-zony commented Jun 14, 2023

OK, I understand. I have tested it locally and the scope of changes is significant, which may be a breaking change for some modules. I can do this job (#423) if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants