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
Kernelor somewhere similar, depending on what your stuck on.