language entry using Trackpad Handwriting

Currently, the OS supports many different symbol based languages, like Chinese, where you can use the Trackpad Handwriting feature to draw a Chinese character and then choose from possible closest matches and have that font character inserted into a document.


I am trying to develop the same thing for a new symbol based language for a minority group.


Is there a way to write code to add languages and Trackpad Handwriting support to the OS? Or to open and modify what has already been done so that I can just enter in a new dictionary of symbols while using the same Trackpad Handwriting and matching that already exists?

You're posting in Other/Developer Forums, which means that it's ambiguous which operating system you're talking about.


So, the answer to your questions is "Yes, but depending on which operating system you're talking about the details change and the answer becomes 'sort of'".

Sorry about the ambiguity 🙂 I'm talking about developing for the Mac, OS 10.10.4 (Yosemite). Trying to integrate a new language into the system to be able to use the Trackpad Handwriting feature to input a symbol based language into a text entry field in various programs, just like you can do now with 3-set Korean, or Sucheng, or various others.


Thanks for the response!

Hmm. If you were trying to write a virtual keyboard for iOS, all of the documentation you need for "my keyboard extension needs to generate some keystrokes, what's next?" is in one convenient spot.


For OS X, I don't think there's a way to integrate with the existing trackpad handwriting system, but you can basically do everything else yourself:

  • There are API calls you can make to generate keystrokes
  • You can provide custom fonts with the glyphs you want, and install them into the system font library
  • You can add a menu to the upper right hand toolbar for convenience
  • Once you get used to generating keystrokes and posting keystroke events, an application like the OS X virtual keyboard (or the trackpad writing window) isn't that special. It's sort of like a drawing application, really.

The actual code to generate a keystroke looks something like this:

  CGEventRef zDown; 
  CGEventRef zUp; 
zDown = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)6, true); // press down on Z key

zUp = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)6, false); // Z key release
  CGEventPost(kCGHIDEventTap, zDown); CGEventPost(kCGHIDEventTap, zUp);// and now send the events into the system


See also, Quartz Event Taps for tieing into the event system (needed to intercept and generate keyboard events): http://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html


But, really, that's all just to say "Yes, you can implement your custom keyboard/character input method for OS X". If you've got questions about the technical details, it's going to be in your best interest to start a thread in Core OS / Kernel: https://forums.developer.apple.com/community/core-os/kernel

Kernel

or somewhere similar, depending on what your stuck on.


Just as a quick add on, in the search results for

"OS X" IME source code

on Google, the first two or three results look promising. In particular, I assume the IPA Palette v2.2.1 project looks like it would hit all of the big technical issues concerning trying to display custom characters.


I'd paste the links directly, but the new forum software seems to be set to delay posts containing external links until they can be checked by a human moderator.

There's probably also the Input Method Kit documentation, too. :-)


https://developer.apple.com/library/mac/documentation/Cocoa/Reference/InputMethodKitFrameworkRef/

language entry using Trackpad Handwriting
 
 
Q