JakeK
JakeK

Reputation: 61

Is there an OSX API to draw input method candidates myself?

I want to add Japanese (and other language) input support to a full screen OpenGL game where the input boxes are custom rendered widgets, i.e. not NSViews.

I think adopting NSTextInputClient will allow me to take advantage of the input method, but I don't want the OS to render it's OSX style input method UI over my game as that will break continuity with the style.

Is there a lower-level API that would allow me to a.) hide the default candidate list UI, and b.) listen to events on the input method and receive the list of candidates for the text being composed, such that I can render the candidate list over my in-game text widget in the style of the surrounding UI?

Upvotes: 1

Views: 1040

Answers (1)

uchuugaka
uchuugaka

Reputation: 12782

Not really. If you don't want to use Cocoa views for this, you're in for a HUGE amount of kludgy work. You might have no idea how complex those things are. There are not any direct ways to just ask the built in system input methods for their conversion routines. Apple wants you to use those in the way they've been designed to be used. You might be able to pull off something with hidden views and accessibility APIs but it would be an incredible uphill battle. You'll be better off spending your effort on just figuring out how to make those fit in as best as possible and move along. The interesting thing is, users who do normally use input methods for their languages will actually feel fine and at home the consistent appearance of those input methods. Probably more so than if anybody customized those in a way they are not familiar with. Many aspects of those input methods, even if translated into English, will make little sense without some real understanding of the language that uses them.

Koteri - The Japanese input method on OS X

In this example of Koteri, you can see quite a few things that you might not be able to deal with.

The Cocoa Text System is rich, deep and complex. In general, you should adopt it rather than try to bend it. (and you'll have a lot more success with that)

Upvotes: 4

Related Questions